19 Commits

Author SHA1 Message Date
094528b1b8 allow deserialization for IUniquieID 2023-09-18 08:48:33 +02:00
fb752da740 jsonconverter for IUniquieID 2023-09-18 08:39:41 +02:00
a2f986e666 fix Telerik reference for Pilz.UI.Telerik.SymbolFactory 2023-09-14 20:00:14 +02:00
e4a2fefabc fix empty size 2023-09-01 19:35:10 +02:00
d0ac4e3b84 add Pilz.UI.Telerik & Pilz.UI.Telerik.SymbolFactory 2023-08-29 13:25:11 +02:00
743bd7f19c Pilz.IO: change target framework to net6.0-windows 2023-08-26 20:36:28 +02:00
cec14841f7 Merge branch 'master' into net6 2023-08-26 20:35:21 +02:00
77cbcd0dcb add GetExecutablePath() 2023-08-26 20:34:42 +02:00
926951e268 PaintingControl: Zoom with Alt instead of Control 2023-08-09 09:26:33 +02:00
79168466bc Merge branch 'master' into net6 2023-06-12 10:06:37 +02:00
fa96e2cf3e Merge branch 'master' into net6 2023-01-02 15:07:04 +01:00
9b7e4f1c6d Merge branch 'master' into net6 2023-01-02 14:46:02 +01:00
f2611e3f05 Merge branch 'master' into net6 2023-01-02 14:43:03 +01:00
e269c16521 Merge branch 'master' into net6 2023-01-02 14:36:27 +01:00
efb522d842 fix highlighter 2022-06-27 21:33:24 +02:00
68f26c6c9f Merge branch 'master' into net6 2022-06-27 20:33:30 +02:00
39ea821fee upgrade to .net6 part 2 2022-06-07 12:54:35 +02:00
0d4322c2b3 ref opentk3 2022-06-07 12:50:39 +02:00
446bd0111c upgrade to .net6 part 1 2022-06-07 12:47:34 +02:00
45 changed files with 1119 additions and 79 deletions

6
NuGet.Config Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="Telerik UI for WinForms 2023.1.117" value="C:\Program Files (x86)\Progress\Telerik UI for WinForms R1 2023\Bin60\NuGet" />
</packageSources>
</configuration>

View File

@@ -26,6 +26,9 @@
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.914.856</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DefineDebug>true</DefineDebug>

View File

@@ -24,12 +24,17 @@
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.914.856</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />

View File

@@ -1,9 +1,11 @@
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;
namespace Pilz.Cryptography
{
[JsonConverter(typeof(Json.Converters.UniquieIDStringJsonConverter))]
public interface IUniquieID
{
bool HasID { get; }

View File

@@ -12,7 +12,7 @@ namespace Pilz.Json.Converters
public override bool CanConvert(Type objectType)
{
return typeof(UniquieID).IsAssignableFrom(objectType);
return typeof(IUniquieID).IsAssignableFrom(objectType);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)

View File

@@ -5,13 +5,18 @@
<Product>Pilz.Cryptography</Product>
<Copyright>Copyright © 2020</Copyright>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.918.846</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Management" Version="4.7.0" />
<PackageReference Include="System.Management" Version="7.0.2" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>

View File

@@ -1,5 +1,7 @@
Imports System.Windows.Forms
Imports OpenTK
Imports OpenTK.Mathematics
Namespace CameraN

View File

@@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFramework>net48</TargetFramework>
<TargetFramework>net6.0-windows</TargetFramework>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DocumentationFile>Pilz.Drawing.Drawing3D.OpenGLFactory.xml</DocumentationFile>
<DefineTrace>true</DefineTrace>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineDebug>true</DefineDebug>
@@ -24,19 +25,21 @@
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.914.856</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OpenTK.Input" Version="4.8.0" />
<PackageReference Include="OpenTK.WinForms" Version="4.0.0-pre.6" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="OpenTK" Version="3.2" />
<PackageReference Include="OpenTK.GLControl" Version="3.1.0" />
<PackageReference Include="OpenTK" Version="4.8.0" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
@@ -52,9 +55,7 @@
<Compile Update="Preview\ModelPreview.Designer.vb">
<DependentUpon>ModelPreview.vb</DependentUpon>
</Compile>
<Compile Update="Preview\ModelPreview.vb">
<SubType>Form</SubType>
</Compile>
<Compile Update="Preview\ModelPreview.vb" />
<Compile Update="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
@@ -98,4 +99,9 @@
<ItemGroup>
<Compile Remove="ModelPreview.Designer.vb" />
</ItemGroup>
<ItemGroup>
<Reference Include="OpenTK3">
<HintPath>..\Shared Libs\OpenTK3.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@@ -6,10 +6,12 @@ Imports OpenTK
Imports OpenTK.Graphics.OpenGL
Imports Pilz.S3DFileParser
Imports Point = System.Drawing.Point
Imports KeyboardState = OpenTK.Input.KeyboardState
Imports Keyboard = OpenTK.Input.Keyboard
Imports Key = OpenTK.Input.Key
Imports Color = System.Drawing.Color
Imports OpenTK.Mathematics
Imports OpenTK.WinForms
Imports OpenTK.Input
Imports OpenTK.Windowing.GraphicsLibraryFramework
Imports Key = OpenTK3.Input.Key
Namespace PreviewN
@@ -30,6 +32,12 @@ Namespace PreviewN
Public Property Scaling As Single = 500.0F
Public Property ClearColor As Color = Color.CornflowerBlue
Public ReadOnly Property Keyboard As OpenTK3.Input.KeyboardState
Get
Return OpenTK3.Input.Keyboard.GetState
End Get
End Property
Public Property EnableCameraControlling As Boolean
Get
Return _EnableCameraControlling
@@ -81,14 +89,14 @@ Namespace PreviewN
Private ReadOnly Property IsStrgPressed As Boolean
Get
Dim state As KeyboardState = Keyboard.GetState()
Dim state = Keyboard
Return state(Key.ControlLeft) OrElse state(Key.ControlRight)
End Get
End Property
Private ReadOnly Property IsShiftPressed As Boolean
Get
Dim state As KeyboardState = Keyboard.GetState()
Dim state = Keyboard
Return state(Key.ShiftLeft) OrElse state(Key.ShiftRight)
End Get
End Property
@@ -132,7 +140,6 @@ Namespace PreviewN
Me.glControl1.Size = Me.ClientSize
Me.glControl1.TabIndex = 0
Me.glControl1.TabStop = False
Me.glControl1.VSync = False
Me.Controls.Add(Me.glControl1)
Me.ResumeLayout(False)
@@ -247,7 +254,7 @@ Namespace PreviewN
End Sub
Private Sub glControl1_Resize(sender As Object, e As EventArgs) Handles glControl1.Resize
glControl1.Context.Update(glControl1.WindowInfo)
'glControl1.Context.Update(glControl1.WindowInfo)
GL.Viewport(0, 0, glControl1.Width, glControl1.Height)
ProjMatrix = Matrix4.CreatePerspectiveFieldOfView(FOV, glControl1.Width / glControl1.Height, 100.0F, 100000.0F)
glControl1.Invalidate()
@@ -286,7 +293,7 @@ Namespace PreviewN
Dim allowCamMove As Boolean = Not (IsMouseDown AndAlso IsShiftPressed)
If allowCamMove Then
Dim state As KeyboardState = Keyboard.GetState
Dim state = Keyboard
If state(Key.W) Then
'camera.Move(moveSpeed, moveSpeed, camMtx)

View File

@@ -1,9 +1,13 @@
Imports System.Drawing
Imports System.Threading
Imports System.Windows.Forms
Imports OpenTK
Imports OpenTK.Graphics.OpenGL
Imports OpenTK.Mathematics
Imports Pilz.S3DFileParser
Imports Bitmap = System.Drawing.Bitmap
Imports Color = System.Drawing.Color
Imports Image = System.Drawing.Image

View File

@@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFramework>net48</TargetFramework>
<TargetFramework>net6.0-windows</TargetFramework>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DocumentationFile>Pilz.Drawing.xml</DocumentationFile>
<DefineTrace>true</DefineTrace>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineDebug>true</DefineDebug>
@@ -24,6 +25,11 @@
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.914.856</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />

26
Pilz.IO/Extensions.cs Normal file
View File

@@ -0,0 +1,26 @@
using Pilz.Runtime;
using Pilz.Win32.Native;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
namespace Pilz.IO
{
public static class Extensions
{
static readonly int MAX_PATH = 255;
public static string GetExecutablePath(bool checkRealOS = false)
{
if (RuntimeInformationsEx.IsOSPlatform(OSType.Windows, checkRealOS))
{
var sb = new StringBuilder(MAX_PATH);
Kernel32.GetModuleFileName(IntPtr.Zero, sb, MAX_PATH);
return sb.ToString();
}
else
return Process.GetCurrentProcess().MainModule.FileName;
}
}
}

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net6.0-windows</TargetFramework>
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
<LangVersion>latest</LangVersion>
<AssemblyTitle>NamedPipeManaging</AssemblyTitle>
@@ -43,12 +43,17 @@
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.914.856</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
@@ -86,4 +91,8 @@
<LastGenOutput>Application.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Pilz.Win32\Pilz.Win32.vbproj" />
<ProjectReference Include="..\Pilz\Pilz.vbproj" />
</ItemGroup>
</Project>

View File

@@ -7,6 +7,11 @@
<Copyright>Copyright © DRSN 2018</Copyright>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.914.1955</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />

View File

@@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFramework>net48</TargetFramework>
<TargetFramework>net6.0-windows</TargetFramework>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DocumentationFile>Pilz.Networking.xml</DocumentationFile>
<DefineTrace>true</DefineTrace>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineDebug>true</DefineDebug>
@@ -24,12 +25,18 @@
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.914.856</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />

View File

@@ -24,6 +24,11 @@
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.914.856</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />

View File

@@ -26,9 +26,14 @@
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.914.1955</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>

View File

@@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFramework>net48</TargetFramework>
<TargetFramework>net6.0-windows</TargetFramework>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DocumentationFile>Pilz.Threading.xml</DocumentationFile>
<DefineTrace>true</DefineTrace>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineDebug>true</DefineDebug>
@@ -34,13 +35,16 @@
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.914.856</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />

View File

@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>Pilz.UI.Telerik</PackageId>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>Pilz.UI.Telerik</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.914.1955</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="UI.for.WinForms.AllControls.Net60" Version="2023.1.117" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pilz.UI.Telerik
{
public enum SvgImageSize
{
Default,
Small,
Medium,
Large
}
}

View File

@@ -0,0 +1,87 @@
using System.Drawing;
using System.Reflection;
using Telerik.WinControls;
using Telerik.WinControls.Svg;
namespace Pilz.UI.Telerik
{
public abstract class SymbolFactory<TSvgSymbols> where TSvgSymbols : Enum
{
public abstract string GetSvgImageRessourcePath(TSvgSymbols svgImage);
public abstract Assembly GetSvgImageResourceAssembly();
protected virtual Size ResolveCommonSize(SvgImageSize size)
{
return size switch
{
SvgImageSize.Small => new Size(16, 16),
SvgImageSize.Medium => new Size(20, 20),
SvgImageSize.Large => new Size(32, 32),
_ => Size.Empty,
};
}
public virtual Stream? GetSvgImageRessourceStream(TSvgSymbols svgImage)
{
var asm = GetSvgImageResourceAssembly();
var path = GetSvgImageRessourcePath(svgImage);
return asm.GetManifestResourceStream(path);
}
public virtual RadSvgImage GetSvgImage(TSvgSymbols svgImage, SvgImageSize size)
{
return GetSvgImage(svgImage, ResolveCommonSize(size));
}
public virtual RadSvgImage GetSvgImage(TSvgSymbols svgImage, Size size)
{
using var stream = GetSvgImageRessourceStream(svgImage);
var img = RadSvgImage.FromStream(stream);
if (!size.IsEmpty)
img.Size = size;
return img;
}
public virtual RadSvgImage GetSvgImageColored(TSvgSymbols svgImage, SvgImageSize size, Color color)
{
return GetSvgImageColored(svgImage, ResolveCommonSize(size), color);
}
public virtual RadSvgImage GetSvgImageColored(TSvgSymbols svgImage, Size size, Color color)
{
var img = GetSvgImage(svgImage, size);
img.Document.Fill = new SvgColourServer(color);
img.ClearCache();
return img;
}
public virtual Image GetImage(TSvgSymbols svgImage, SvgImageSize size)
{
return GetImage(svgImage, ResolveCommonSize(size));
}
public virtual Image GetImage(TSvgSymbols svgImage, Size size)
{
return GetImageFromSvg(GetSvgImage(svgImage, size));
}
public virtual Image GetImageColored(TSvgSymbols svgImage, SvgImageSize size, Color color)
{
return GetImageColored(svgImage, ResolveCommonSize(size), color);
}
public virtual Image GetImageColored(TSvgSymbols svgImage, Size size, Color color)
{
return GetImageFromSvg(GetSvgImageColored(svgImage, size, color));
}
public virtual Image GetImageFromSvg(RadSvgImage svg)
{
return svg.Document.Draw(svg.Width, svg.Height);
}
}
}

View File

@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Pilz.UI.Telerik.Dialogs
{
partial class DialogBaseForm
{
public delegate void DialogLoadingEventHandler(DialogLoadingEventArgs e);
public delegate void DialogClosedEventHandler(DialogClosedEventArgs e);
public static event DialogLoadingEventHandler? DialogLoading;
public static event DialogClosedEventHandler? DialogClosed;
public static T ShowDialog<T>(string title, Icon icon, object? tag = null) where T : FlyoutDialogBase
{
return ShowDialog<T>(null, title, icon, tag);
}
public static T ShowDialog<T>(IWin32Window? parent, string title, Icon icon, object? tag = null) where T : FlyoutDialogBase
{
var dialogPanel = Activator.CreateInstance<T>();
dialogPanel.Dock = DockStyle.Fill;
dialogPanel.Tag = tag;
var dialog = new DialogBaseForm
{
DialogPanel = dialogPanel,
Text = title,
Icon = icon,
StartPosition = parent == null ? FormStartPosition.CenterScreen : FormStartPosition.CenterParent,
ClientSize = dialogPanel.Size
};
dialog.Controls.Add(dialogPanel);
dialog.ShowDialog(parent);
return dialogPanel;
}
}
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Telerik.WinControls.UI;
namespace Pilz.UI.Telerik.Dialogs
{
public partial class DialogBaseForm : RadForm
{
public FlyoutDialogBase? DialogPanel { get; private set; }
private DialogBaseForm()
{
Load += DialogBaseForm_Load;
FormClosed += DialogBaseForm_FormClosed;
}
private void DialogBaseForm_Load(object? sender, EventArgs e)
{
if (DialogPanel is ILoadContent iLoadContent)
iLoadContent.LoadContent();
DialogLoading?.Invoke(new DialogLoadingEventArgs(this));
}
private void DialogBaseForm_FormClosed(object? sender, FormClosedEventArgs e)
{
DialogClosed?.Invoke(new DialogClosedEventArgs(this));
}
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Pilz.UI.Telerik.Dialogs
{
public class DialogClosedEventArgs : EventArgs
{
public DialogBaseForm Parent { get; private set; }
public FlyoutDialogBase? Content => Parent?.DialogPanel;
public DialogClosedEventArgs(DialogBaseForm dialog)
{
Parent = dialog;
}
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Forms.Design;
namespace Pilz.UI.Telerik.Dialogs
{
public class DialogLoadingEventArgs : EventArgs
{
public DialogBaseForm Parent { get; private set; }
public FlyoutDialogBase? Content => Parent?.DialogPanel;
public DialogLoadingEventArgs(DialogBaseForm dialog)
{
Parent = dialog;
}
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Pilz.UI.Telerik.Dialogs
{
public class FlyoutClosedEventArgs : global::Telerik.WinControls.UI.SplashScreen.FlyoutClosedEventArgs
{
public new FlyoutDialogBase? Content => base.Content as FlyoutDialogBase;
public FlyoutClosedEventArgs(FlyoutDialogBase content) : base(content)
{
}
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Telerik.WinControls.UI.SplashScreen;
namespace Pilz.UI.Telerik.Dialogs
{
public class FlyoutCreatedEventArgs : ContentCreatedEventArgs
{
public new FlyoutDialogBase? Content => base.Content as FlyoutDialogBase;
public FlyoutCreatedEventArgs(FlyoutDialogBase content) : base(content)
{
}
}
}

View File

@@ -0,0 +1,77 @@
namespace Pilz.UI.Telerik.Dialogs
{
partial class FlyoutDialogBase
{
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Vom Komponenten-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FlyoutDialogBase));
radButton_Cancel = new global::Telerik.WinControls.UI.RadButton();
radButton_Confirm = new global::Telerik.WinControls.UI.RadButton();
panel_ActionButtons = new System.Windows.Forms.Panel();
((System.ComponentModel.ISupportInitialize)radButton_Cancel).BeginInit();
((System.ComponentModel.ISupportInitialize)radButton_Confirm).BeginInit();
panel_ActionButtons.SuspendLayout();
SuspendLayout();
//
// radButton_Cancel
//
resources.ApplyResources(radButton_Cancel, "radButton_Cancel");
radButton_Cancel.Name = "radButton_Cancel";
radButton_Cancel.Click += RadButton_Cancel_Click;
//
// radButton_Confirm
//
resources.ApplyResources(radButton_Confirm, "radButton_Confirm");
radButton_Confirm.Name = "radButton_Confirm";
radButton_Confirm.Click += RadButton_Confirm_Click;
//
// panel_ActionButtons
//
panel_ActionButtons.Controls.Add(radButton_Cancel);
panel_ActionButtons.Controls.Add(radButton_Confirm);
resources.ApplyResources(panel_ActionButtons, "panel_ActionButtons");
panel_ActionButtons.Name = "panel_ActionButtons";
//
// FlyoutDialogBase
//
resources.ApplyResources(this, "$this");
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
Controls.Add(panel_ActionButtons);
Name = "FlyoutDialogBase";
((System.ComponentModel.ISupportInitialize)radButton_Cancel).EndInit();
((System.ComponentModel.ISupportInitialize)radButton_Confirm).EndInit();
panel_ActionButtons.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private global::Telerik.WinControls.UI.RadButton radButton_Cancel;
private global::Telerik.WinControls.UI.RadButton radButton_Confirm;
private System.Windows.Forms.Panel panel_ActionButtons;
}
}

View File

@@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telerik.WinControls.UI.SplashScreen;
using Telerik.WinControls.UI;
using System.Windows.Forms;
namespace Pilz.UI.Telerik.Dialogs
{
partial class FlyoutDialogBase
{
public delegate void FlyoutCreatedEventHandler(FlyoutCreatedEventArgs e);
public delegate void FlyoutClosedEventHandler(FlyoutClosedEventArgs e);
public static event FlyoutCreatedEventHandler FlyoutCreated
{
add => flyoutCreatedHandlers.Add(value);
remove => flyoutCreatedHandlers.Remove(value);
}
public static event FlyoutClosedEventHandler FlyoutClosed
{
add => flyoutCloseHandlers.Add(value);
remove => flyoutCloseHandlers.Remove(value);
}
private static readonly List<FlyoutCreatedEventHandler> flyoutCreatedHandlers = new();
private static readonly List<FlyoutClosedEventHandler> flyoutCloseHandlers = new();
private static object? tagToAssign = null;
public static Control? ParentContext { get; private set; } = null;
static FlyoutDialogBase()
{
RadFlyoutManager.ContentCreated += RadFlyoutManager_ContentCreated;
RadFlyoutManager.FlyoutClosed += RadFlyoutManager_FlyoutClosed;
}
private static void RadFlyoutManager_ContentCreated(ContentCreatedEventArgs e)
{
if (e.Content is FlyoutDialogBase dialogBase)
{
if (tagToAssign != null)
dialogBase.Tag = tagToAssign;
var eventArgs = new FlyoutCreatedEventArgs((FlyoutDialogBase)e.Content);
if (dialogBase is ILoadContent iLoadContent)
iLoadContent.LoadContent();
foreach (var args in flyoutCreatedHandlers)
{
if (ParentContext != null)
ParentContext?.Invoke(args, eventArgs);
else
args.Invoke(eventArgs);
}
}
}
private static void RadFlyoutManager_FlyoutClosed(global::Telerik.WinControls.UI.SplashScreen.FlyoutClosedEventArgs e)
{
if (e.Content is FlyoutDialogBase dialogBase)
{
var eventArgs = new FlyoutClosedEventArgs((FlyoutDialogBase)e.Content);
foreach (var args in flyoutCloseHandlers)
{
if (ParentContext != null)
ParentContext?.Invoke(args, eventArgs);
else
args.Invoke(eventArgs);
}
}
ParentContext = null;
}
public static void Show<T>(Control controlToAssociate, object? tag = null)
{
Show(controlToAssociate, typeof(T), tag);
}
public static void Show(Control controlToAssociate, Type flyoutContentType, object? tag = null)
{
tagToAssign = tag;
ParentContext = controlToAssociate;
RadFlyoutManager.Show(controlToAssociate, flyoutContentType);
}
protected static void CloseFlyout()
{
if (ParentContext == null)
throw new NullReferenceException(nameof(ParentContext));
ParentContext.BeginInvoke(RadFlyoutManager.Close);
}
}
}

View File

@@ -0,0 +1,86 @@
using Pilz.UI.Telerik;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Telerik.WinControls;
using Telerik.WinControls.UI;
using Telerik.WinControls.UI.SplashScreen;
using static Telerik.WinControls.UI.PopupEditorNotificationData;
namespace Pilz.UI.Telerik.Dialogs
{
public partial class FlyoutDialogBase : UserControl
{
public static RadSvgImage? CancelSvg { get; set; } = null;
public static RadSvgImage? ConfirmSvg { get; set; } = null;
public DialogResult Result { get; protected set; }
protected bool ActionPanelVisible
{
get => panel_ActionButtons.Visible;
set => panel_ActionButtons.Visible = value;
}
protected bool CancelButtonEnable
{
get => radButton_Cancel.Enabled;
set => radButton_Cancel.Enabled = value;
}
protected bool ConfirmButtonEnable
{
get => radButton_Confirm.Enabled;
set => radButton_Confirm.Enabled = value;
}
protected FlyoutDialogBase()
{
InitializeComponent();
ParentChanged += FlyoutDialogBase_ParentChanged;
// SVG Symbols
radButton_Cancel.SvgImage = CancelSvg;
radButton_Confirm.SvgImage = ConfirmSvg;
}
private void FlyoutDialogBase_ParentChanged(object? sender, EventArgs e)
{
var frm = FindForm();
if (frm != null)
frm.AcceptButton = radButton_Confirm;
}
protected void Close(DialogResult result)
{
Result = result;
if (FindForm() is DialogBaseForm dialogForm)
dialogForm.Close();
else
CloseFlyout();
}
private void RadButton_Confirm_Click(object sender, EventArgs e)
{
if (ValidateOK())
Close(DialogResult.OK);
}
private void RadButton_Cancel_Click(object sender, EventArgs e)
{
Close(DialogResult.Cancel);
}
protected virtual bool ValidateOK()
{
return true;
}
}
}

View File

@@ -0,0 +1,234 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="radButton_Cancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="radButton_Cancel.ImageAlignment" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleRight</value>
</data>
<data name="radButton_Cancel.Location" type="System.Drawing.Point, System.Drawing">
<value>187, 3</value>
</data>
<data name="radButton_Cancel.Size" type="System.Drawing.Size, System.Drawing">
<value>110, 24</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="radButton_Cancel.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="radButton_Cancel.Text" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="radButton_Cancel.TextAlignment" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="radButton_Cancel.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageBeforeText</value>
</data>
<data name="&gt;&gt;radButton_Cancel.Name" xml:space="preserve">
<value>radButton_Cancel</value>
</data>
<data name="&gt;&gt;radButton_Cancel.Type" xml:space="preserve">
<value>Telerik.WinControls.UI.RadButton, Telerik.WinControls.UI, Culture=neutral, PublicKeyToken=5bb2a467cbec794e</value>
</data>
<data name="&gt;&gt;radButton_Cancel.Parent" xml:space="preserve">
<value>panel_ActionButtons</value>
</data>
<data name="&gt;&gt;radButton_Cancel.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="radButton_Confirm.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
</data>
<data name="radButton_Confirm.ImageAlignment" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleRight</value>
</data>
<data name="radButton_Confirm.Location" type="System.Drawing.Point, System.Drawing">
<value>71, 3</value>
</data>
<data name="radButton_Confirm.Size" type="System.Drawing.Size, System.Drawing">
<value>110, 24</value>
</data>
<data name="radButton_Confirm.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="radButton_Confirm.Text" xml:space="preserve">
<value>Okay</value>
</data>
<data name="radButton_Confirm.TextAlignment" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="radButton_Confirm.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageBeforeText</value>
</data>
<data name="&gt;&gt;radButton_Confirm.Name" xml:space="preserve">
<value>radButton_Confirm</value>
</data>
<data name="&gt;&gt;radButton_Confirm.Type" xml:space="preserve">
<value>Telerik.WinControls.UI.RadButton, Telerik.WinControls.UI, Culture=neutral, PublicKeyToken=5bb2a467cbec794e</value>
</data>
<data name="&gt;&gt;radButton_Confirm.Parent" xml:space="preserve">
<value>panel_ActionButtons</value>
</data>
<data name="&gt;&gt;radButton_Confirm.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="panel_ActionButtons.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Bottom</value>
</data>
<data name="panel_ActionButtons.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 120</value>
</data>
<data name="panel_ActionButtons.Size" type="System.Drawing.Size, System.Drawing">
<value>300, 30</value>
</data>
<data name="panel_ActionButtons.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="&gt;&gt;panel_ActionButtons.Name" xml:space="preserve">
<value>panel_ActionButtons</value>
</data>
<data name="&gt;&gt;panel_ActionButtons.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;panel_ActionButtons.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;panel_ActionButtons.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>7, 15</value>
</data>
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>300, 150</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>FlyoutDialogBase</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pilz.UI.Telerik.Dialogs
{
public interface ILoadContent
{
void LoadContent();
}
}

View File

@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.914.856</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="UI.for.WinForms.AllControls.Net60" Version="2023.1.117" />
</ItemGroup>
</Project>

View File

@@ -149,6 +149,12 @@ Public Class DisplayHelp
If cornerSize = 0 Then
path.AddRectangle(r)
Else
AddCornerArc(path, r, cornerSize, eCornerArc.TopLeft)
AddCornerArc(path, r, cornerSize, eCornerArc.TopRight)
AddCornerArc(path, r, cornerSize, eCornerArc.BottomRight)
AddCornerArc(path, r, cornerSize, eCornerArc.BottomLeft)
path.CloseAllFigures()
End If
Return path
@@ -160,4 +166,67 @@ Public Class DisplayHelp
Return New LinearGradientBrush(New Rectangle(r.X, r.Y - 1, r.Width, r.Height + 1), color1, color2, gradientAngle)
End Function
Public Shared Sub AddCornerArc(ByVal path As GraphicsPath, ByVal bounds As Rectangle, ByVal cornerDiameter As Integer, ByVal corner As eCornerArc)
If cornerDiameter > 0 Then
Dim a As ArcData = GetCornerArc(bounds, cornerDiameter, corner)
path.AddArc(a.X, a.Y, a.Width, a.Height, a.StartAngle, a.SweepAngle)
Else
If corner = eCornerArc.TopLeft Then
path.AddLine(bounds.X, bounds.Y + 2, bounds.X, bounds.Y)
ElseIf corner = eCornerArc.BottomLeft Then
path.AddLine(bounds.X + 2, bounds.Bottom, bounds.X, bounds.Bottom)
ElseIf corner = eCornerArc.TopRight Then
path.AddLine(bounds.Right - 2, bounds.Y, bounds.Right, bounds.Y)
ElseIf corner = eCornerArc.BottomRight Then
path.AddLine(bounds.Right, bounds.Bottom - 2, bounds.Right, bounds.Bottom)
End If
End If
End Sub
Friend Shared Function GetCornerArc(ByVal bounds As Rectangle, ByVal cornerDiameter As Integer, ByVal corner As eCornerArc) As ArcData
Dim a As ArcData
If cornerDiameter = 0 Then cornerDiameter = 1
Dim diameter As Integer = cornerDiameter * 2
Select Case corner
Case eCornerArc.TopLeft
a = New ArcData(bounds.X, bounds.Y, diameter, diameter, 180, 90)
Case eCornerArc.TopRight
a = New ArcData(bounds.Right - diameter, bounds.Y, diameter, diameter, 270, 90)
Case eCornerArc.BottomLeft
a = New ArcData(bounds.X, bounds.Bottom - diameter, diameter, diameter, 90, 90)
Case Else
a = New ArcData(bounds.Right - diameter, bounds.Bottom - diameter, diameter, diameter, 0, 90)
End Select
Return a
End Function
Public Enum eCornerArc
TopLeft
TopRight
BottomLeft
BottomRight
End Enum
Friend Structure ArcData
Public X As Integer
Public Y As Integer
Public Width As Integer
Public Height As Integer
Public StartAngle As Single
Public SweepAngle As Single
Public Sub New(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal startAngle As Single, ByVal sweepAngle As Single)
Me.X = x
Me.Y = y
Me.Width = width
Me.Height = height
Me.StartAngle = startAngle
Me.SweepAngle = sweepAngle
End Sub
End Structure
End Class

View File

@@ -320,24 +320,26 @@ Public Class Highlighter
Private Sub UpdateHighlightPanelBounds()
Dim bounds As Rectangle = New Rectangle(0, 0, _ContainerControl.ClientRectangle.Width, _ContainerControl.ClientRectangle.Height)
If TypeOf _HighlightPanel.Parent Is Form Then
Dim form As Form = TryCast(_HighlightPanel.Parent, Form)
If _HighlightPanel IsNot Nothing Then
If TypeOf _HighlightPanel.Parent Is Form Then
Dim form As Form = TryCast(_HighlightPanel.Parent, Form)
If form.AutoSize Then
bounds.X += form.Padding.Left
bounds.Y += form.Padding.Top
bounds.Width -= form.Padding.Horizontal
bounds.Height -= form.Padding.Vertical
If form.AutoSize Then
bounds.X += form.Padding.Left
bounds.Y += form.Padding.Top
bounds.Width -= form.Padding.Horizontal
bounds.Height -= form.Padding.Vertical
End If
End If
End If
If _HighlightPanel.Bounds.Equals(bounds) Then
_HighlightPanel.UpdateRegion()
Else
_HighlightPanel.Bounds = bounds
End If
If _HighlightPanel.Bounds.Equals(bounds) Then
_HighlightPanel.UpdateRegion()
Else
_HighlightPanel.Bounds = bounds
End If
_HighlightPanel.BringToFront()
_HighlightPanel.BringToFront()
End If
End Sub
Private _DelayTimer As Timer = Nothing
@@ -386,17 +388,6 @@ Public Class Highlighter
End Set
End Property
Public Function CanExtend(ByVal extendee As Object) As Boolean
Return (TypeOf extendee Is Control)
End Function
Private Sub SetError(ByVal control As Control, ByVal value As String)
Me.SetHighlightColor(control, eHighlightColor.Red)
End Sub
Private Sub ClearError(ByVal control As Control)
Me.SetHighlightColor(control, eHighlightColor.None)
End Sub
End Class
Public Enum eHighlightColor

View File

@@ -644,7 +644,7 @@ Public Class PaintingControl
End Sub
Private Sub CheckMouseWheel(sender As Object, e As MouseEventArgs) Handles Me.MouseWheel
If pressedControl Then
If pressedAlt Then
Dim val As Single = e.Delta / 120 / 10
ZoomFactor = New SizeF(Math.Max(ZoomFactor.Width + val, 0.25), Math.Max(ZoomFactor.Height + val, 0.25))
Refresh()

View File

@@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFramework>net48</TargetFramework>
<TargetFramework>net6.0-windows</TargetFramework>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DocumentationFile>Pilz.UI.xml</DocumentationFile>
<DefineTrace>true</DefineTrace>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineDebug>true</DefineDebug>
@@ -36,15 +37,17 @@
<RemoveIntegerChecks>true</RemoveIntegerChecks>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.914.856</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Windows.Forms" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
@@ -58,9 +61,7 @@
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Update="PaintingControl\PaintingControl.vb">
<SubType>UserControl</SubType>
</Compile>
<Compile Update="PaintingControl\PaintingControl.vb" />
<Compile Update="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>

View File

@@ -0,0 +1,16 @@
Imports System.Runtime.InteropServices
Imports System.Text
Namespace Native
Public Class Kernel32
Private Const LIB_KERNEL32 As String = "kernel32.dll"
<DllImport(LIB_KERNEL32)>
Public Shared Function GetModuleFileName(hModule As IntPtr, lpFilename As StringBuilder, nSize As Integer) As UInteger
End Function
End Class
End Namespace

View File

@@ -4,11 +4,13 @@ Namespace Native
Public Class User32
<DllImport("user32")>
Private Const LIB_USER32 As String = "user32.dll"
<DllImport(LIB_USER32)>
Public Shared Function GetWindowRect(ByVal hWnd As IntPtr, ByRef r As RECT) As Boolean
End Function
<DllImport("user32.dll")>
<DllImport(LIB_USER32)>
Public Shared Function ChildWindowFromPointEx(ByVal hWndParent As IntPtr, ByVal pt As POINT, ByVal uFlags As UInteger) As IntPtr
End Function

View File

@@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFramework>net48</TargetFramework>
<TargetFramework>net6.0-windows</TargetFramework>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DocumentationFile>Pilz.Win32.xml</DocumentationFile>
<DefineTrace>true</DefineTrace>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineDebug>true</DefineDebug>
@@ -24,6 +25,11 @@
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.914.856</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />

View File

@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.329
# Visual Studio Version 17
VisualStudioVersion = 17.7.34018.315
MinimumVisualStudioVersion = 10.0.40219.1
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Pilz", "Pilz\Pilz.vbproj", "{277D2B83-7613-4C49-9CAB-E080195A6E0C}"
EndProject
@@ -31,6 +31,10 @@ Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Pilz.Networking", "Pilz.Net
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Cryptography", "Pilz.Cryptography\Pilz.Cryptography.csproj", "{3F5988E6-439E-4A9D-B2C6-47EFFB161AC6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.UI.Telerik.SymbolFactory", "Pilz.UI.Telerik.SymbolFactory\Pilz.UI.Telerik.SymbolFactory.csproj", "{2B3B8161-29FF-4526-9082-4410AB5144A5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pilz.UI.Telerik", "Pilz.UI.Telerik\Pilz.UI.Telerik.csproj", "{DF674119-CC28-40AA-968F-1E23D184A491}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -151,6 +155,22 @@ Global
{3F5988E6-439E-4A9D-B2C6-47EFFB161AC6}.Release|Any CPU.Build.0 = Release|Any CPU
{3F5988E6-439E-4A9D-B2C6-47EFFB161AC6}.Release|x86.ActiveCfg = Release|Any CPU
{3F5988E6-439E-4A9D-B2C6-47EFFB161AC6}.Release|x86.Build.0 = Release|Any CPU
{2B3B8161-29FF-4526-9082-4410AB5144A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2B3B8161-29FF-4526-9082-4410AB5144A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2B3B8161-29FF-4526-9082-4410AB5144A5}.Debug|x86.ActiveCfg = Debug|Any CPU
{2B3B8161-29FF-4526-9082-4410AB5144A5}.Debug|x86.Build.0 = Debug|Any CPU
{2B3B8161-29FF-4526-9082-4410AB5144A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2B3B8161-29FF-4526-9082-4410AB5144A5}.Release|Any CPU.Build.0 = Release|Any CPU
{2B3B8161-29FF-4526-9082-4410AB5144A5}.Release|x86.ActiveCfg = Release|Any CPU
{2B3B8161-29FF-4526-9082-4410AB5144A5}.Release|x86.Build.0 = Release|Any CPU
{DF674119-CC28-40AA-968F-1E23D184A491}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF674119-CC28-40AA-968F-1E23D184A491}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF674119-CC28-40AA-968F-1E23D184A491}.Debug|x86.ActiveCfg = Debug|Any CPU
{DF674119-CC28-40AA-968F-1E23D184A491}.Debug|x86.Build.0 = Debug|Any CPU
{DF674119-CC28-40AA-968F-1E23D184A491}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF674119-CC28-40AA-968F-1E23D184A491}.Release|Any CPU.Build.0 = Release|Any CPU
{DF674119-CC28-40AA-968F-1E23D184A491}.Release|x86.ActiveCfg = Release|Any CPU
{DF674119-CC28-40AA-968F-1E23D184A491}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -6,7 +6,7 @@
<DefineTrace>true</DefineTrace>
<LangVersion>latest</LangVersion>
<AssemblyTitle>Pilz</AssemblyTitle>
<Company>DRSN</Company>
<Company>Pilzinsel64</Company>
<Product>Pilz</Product>
<Copyright>Copyright © Pilzinsel64 2019 - 2020</Copyright>
<DocumentationFile>Pilz.xml</DocumentationFile>
@@ -30,6 +30,9 @@
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.914.856</Version>
</PropertyGroup>
<ItemGroup>
<Compile Remove="My Project\AssemblyInfo.vb" />

View File

@@ -26,9 +26,9 @@ Namespace Runtime
End Get
End Property
Public ReadOnly Property RealOSType As OSType
Get
Static t As OSType? = Nothing
Public ReadOnly Property RealOSType As OSType
Get
Static t As OSType? = Nothing
If t Is Nothing Then
@@ -69,9 +69,13 @@ Namespace Runtime
End If
Return t
End Get
End Property
End Get
End Property
End Module
Public Function IsOSPlatform(os As OSType, checkRealOS As Boolean) As Boolean
Return If(checkRealOS, RealOSType, OSType) = os
End Function
End Module
End Namespace

BIN
Shared Libs/OpenTK3.dll Normal file

Binary file not shown.