make some projects compatible with netframework4.8 again

This commit is contained in:
2025-02-11 07:18:14 +01:00
parent f08c94908a
commit 07ab60666a
32 changed files with 57 additions and 55 deletions

View File

@@ -84,11 +84,6 @@ public partial class FlyoutBase : UserControl
ParentChanged += FlyoutBase_ParentChanged;
}
[MemberNotNull(nameof(tableLayoutPanel_TitlePanel))]
[MemberNotNull(nameof(label_Title))]
[MemberNotNull(nameof(tableLayoutPanel_ActionPanel))]
[MemberNotNull(nameof(button_Cancel))]
[MemberNotNull(nameof(button_Accept))]
private void InitializeComponent()
{
// button_Accept
@@ -180,7 +175,7 @@ public partial class FlyoutBase : UserControl
base.OnLoad(e);
}
private void FlyoutBase_ParentChanged(object? sender, EventArgs e)
private void FlyoutBase_ParentChanged(object sender, EventArgs e)
{
var frm = FindForm();
if (frm != null)
@@ -214,13 +209,13 @@ public partial class FlyoutBase : UserControl
tableLayoutPanel_TitlePanel.Visible = !string.IsNullOrWhiteSpace(label_Title.Text);
}
protected virtual void Button_Accept_Click(object? sender, EventArgs e)
protected virtual void Button_Accept_Click(object sender, EventArgs e)
{
if (ValidateOK())
Close(DialogResult.OK);
}
protected virtual void Button_Cancel_Click(object? sender, EventArgs e)
protected virtual void Button_Cancel_Click(object sender, EventArgs e)
{
Close(DialogResult.Cancel);
}

View File

@@ -5,7 +5,7 @@ namespace Pilz.UI.Extensions;
public static class FlyoutBaseExtensions
{
public static bool IsValid([NotNullWhen(true)] this FlyoutBase? @this)
public static bool IsValid(this FlyoutBase? @this)
{
return @this != null && @this.Result == DialogResult.OK;
}

View File

@@ -225,7 +225,7 @@ internal class HighlightPanel : Control
Pilz.Win32.Native.User32.GetWindowRect(control.Handle, ref rect);
var pp = control.Parent.PointToClient(new Point(rect.Left + 3, rect.Top + 3));
var handle = Pilz.Win32.Native.User32.ChildWindowFromPointEx(control.Parent.Handle, new Pilz.Win32.Native.POINT(pp.X, pp.Y), (uint)Pilz.Win32.Native.WindowFromPointFlags.CWP_SKIPINVISIBLE);
if (handle == nint.Zero)
if (handle == IntPtr.Zero)
return control.Visible;
var c = Control.FromHandle(handle);

View File

@@ -1,5 +1,4 @@
using Microsoft.VisualBasic.CompilerServices;
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
@@ -81,7 +80,7 @@ public class Highlighter : Component
private void ControlHighlightVisibleChanged(object sender, EventArgs e)
{
if (_HighlightPanel is not null && Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(_HighlightPanel.FocusHighlightControl, sender, false)))
if (_HighlightPanel is not null && sender.Equals(_HighlightPanel.FocusHighlightControl))
UpdateHighlighterRegion();
}

View File

@@ -1,5 +1,4 @@
using Microsoft.VisualBasic.CompilerServices;
using Pilz.Drawing;
using Pilz.Drawing;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -94,7 +93,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
{
get
{
return Conversions.ToInteger(GetType().GetField("layoutSuspendCount", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(this)) != 0;
return Convert.ToInt32(GetType().GetField("layoutSuspendCount", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(this)) != 0;
}
}
@@ -545,8 +544,8 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
/// <param name="m"></param>
protected override void WndProc(ref Message m)
{
const int WM_NCHITTEST = 0x84;
const int HTTRANSPARENT = -1;
const nint WM_NCHITTEST = 0x84;
const nint HTTRANSPARENT = -1;
if (!VisibleForMouseEvents && m.Msg == WM_NCHITTEST)
m.Result = HTTRANSPARENT;

View File

@@ -1,5 +1,4 @@
using Microsoft.VisualBasic.CompilerServices;
using Newtonsoft.Json;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -590,7 +589,7 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer
get
{
if (Tag is string)
return Conversions.ToString(Tag);
return Convert.ToString(Tag);
else
{
return string.Empty;

View File

@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFrameworks>net8.0-windows</TargetFrameworks>
<TargetFrameworks>net8.0-windows;netframework4.8</TargetFrameworks>
<LangVersion>latest</LangVersion>
<DocumentationFile>Pilz.UI.xml</DocumentationFile>
<UseWindowsForms>true</UseWindowsForms>
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Nullable>annotations</Nullable>
</PropertyGroup>
<PropertyGroup>
<Version>2.4.5</Version>
<Version>2.4.6</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />

View File

@@ -25,7 +25,6 @@ namespace Pilz.UI.My.Resources
[System.CodeDom.Compiler.GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode()]
[System.Runtime.CompilerServices.CompilerGenerated()]
[HideModuleName()]
internal static class Resources
{