├── .gitattributes
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
└── dependabot.yml
├── .gitignore
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── PULL_REQUEST_TEMPLATE.md
├── Pitures
├── Menu1.jpg
├── Menu2.jpg
├── Visual_Style_Styled.JPG
├── Visual_Style_no_Style.JPG
└── windows_icon.JPG
├── README.md
├── Src
├── ConsleCaller
│ ├── Browser.ico
│ ├── BrowserWindow.cs
│ ├── ConsoleCaller.csproj
│ ├── ControlOnControl.cs
│ ├── ControlTest.cs
│ ├── Firmen_Emblem.ico
│ ├── ListViewTest.cs
│ ├── Program.cs
│ ├── Skype.bmp
│ ├── TabStopTest.cs
│ ├── TestIpAddress.cs
│ ├── TextEditor.cs
│ ├── TreeViewTest.cs
│ ├── Window1.cs
│ ├── Window2.cs
│ ├── Window4.cs
│ ├── app.manifest
│ ├── app.res
│ ├── build.bat
│ ├── lib
│ │ ├── Diga.WebView2.Native.dll
│ │ └── Diga.WebView2.Native.lib
│ └── wwwroot
│ │ ├── dotnet.js
│ │ ├── dotnet.wasm
│ │ ├── index.html
│ │ ├── managed
│ │ ├── Mono.Security.dll
│ │ ├── System.ComponentModel.Composition.dll
│ │ ├── System.Core.dll
│ │ ├── System.Data.DataSetExtensions.dll
│ │ ├── System.Data.dll
│ │ ├── System.Drawing.Common.dll
│ │ ├── System.IO.Compression.FileSystem.dll
│ │ ├── System.IO.Compression.dll
│ │ ├── System.Memory.dll
│ │ ├── System.Net.Http.dll
│ │ ├── System.Numerics.dll
│ │ ├── System.Runtime.Serialization.dll
│ │ ├── System.ServiceModel.Internals.dll
│ │ ├── System.Transactions.dll
│ │ ├── System.Xml.Linq.dll
│ │ ├── System.Xml.dll
│ │ ├── System.dll
│ │ ├── WebAssembly.Bindings.dll
│ │ ├── WebAssembly.Net.Http.dll
│ │ ├── WebAssembly.Net.WebSockets.dll
│ │ ├── mscorlib.dll
│ │ ├── netstandard.dll
│ │ └── sample.dll
│ │ ├── mono-config.js
│ │ └── runtime.js
├── CoreWindowsWrapper
│ ├── AnchorType.cs
│ ├── ControlCollection.cs
│ ├── CoreWindowsWrapper.csproj
│ ├── CoreWindowsWrapper.sln
│ ├── CreateEventArgs.cs
│ ├── DockType.cs
│ ├── Font.cs
│ ├── IControl.cs
│ ├── IMenuItem.cs
│ ├── IWindow.cs
│ ├── IWindowClass.cs
│ ├── KeyCode.cs
│ ├── MenuItemCollection.cs
│ ├── MessageBox.cs
│ ├── MessageBoxOptions.cs
│ ├── MessageBoxResult.cs
│ ├── MouseButton.cs
│ ├── MouseClickEventArgs.cs
│ ├── MouseMoveEventArgs.cs
│ ├── NativeApp.cs
│ ├── NativeAxControlBase.cs
│ ├── NativeBitmap.cs
│ ├── NativeButton.cs
│ ├── NativeCheckBox.cs
│ ├── NativeChildWindow.cs
│ ├── NativeComboBox.cs
│ ├── NativeComboBoxSelChangeEventArgs.cs
│ ├── NativeContainerControl.cs
│ ├── NativeControlBase.cs
│ ├── NativeDateTimePicker.cs
│ ├── NativeGroupBox.cs
│ ├── NativeImageList.cs
│ ├── NativeIpAddressEdit.cs
│ ├── NativeKeyEventArgs.cs
│ ├── NativeLabel.cs
│ ├── NativeLink.cs
│ ├── NativeLinkClickEventArgs.cs
│ ├── NativeListBox.cs
│ ├── NativeListView.cs
│ ├── NativeMenu.cs
│ ├── NativeMenuItem.cs
│ ├── NativeMultiLineTextBox.cs
│ ├── NativeNoCreateControlBase.cs
│ ├── NativePanel.cs
│ ├── NativeProgress.cs
│ ├── NativeRichTextBox.cs
│ ├── NativeSystemInformation.cs
│ ├── NativeTextBox.cs
│ ├── NativeTheaming.cs
│ ├── NativeTimer.cs
│ ├── NativeTreeView.cs
│ ├── NativeUserControl.cs
│ ├── NativeWindow.cs
│ ├── OpenFileDialog.cs
│ ├── OpenFolderDialog.cs
│ ├── PaintEventArgs.cs
│ ├── PaintObject.cs
│ ├── Properties
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ ├── README.md
│ ├── SaveFileDialog.cs
│ ├── SizeEventArgs.cs
│ ├── TaskQueue.cs
│ ├── Tools
│ │ ├── ColorTool.cs
│ │ ├── FontTool.cs
│ │ └── ImageTool.cs
│ ├── Win32ApiForm
│ │ ├── ControlType.cs
│ │ ├── Win32AxControl.cs
│ │ ├── Win32Control.cs
│ │ ├── Win32Dialog.cs
│ │ ├── Win32NoCreateControl.cs
│ │ └── Win32Window.cs
│ ├── WindowState.cs
│ ├── WindowsStartupPosition.cs
│ └── diga_cert.snk
├── DIGAAppSetup
│ ├── DIGAAppSetup.csproj
│ ├── DigaCert.snk
│ ├── Firmen_Emblem.ico
│ ├── MainForm.cs
│ ├── Program.cs
│ ├── app.ico
│ └── app.manifest
├── Diga.NativeControls.WebBrowser.Core
│ ├── Diga.NativeControls.WebBrowser.Core.csproj
│ └── NativeWebBrowser.cs
├── Diga.NativeControls.WebBrowser
│ ├── Diga.NativeControls.WebBrowser.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── app.config
│ └── packages.config
└── WinFormsTest
│ ├── App.config
│ ├── MainForm.Designer.cs
│ ├── MainForm.cs
│ ├── MainForm.resx
│ ├── Program.cs
│ ├── Properties
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ └── WinFormsTest.csproj
└── _config.yml
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # To get started with Dependabot version updates, you'll need to specify which
2 | # package ecosystems to update and where the package manifests are located.
3 | # Please see the documentation for all configuration options:
4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5 |
6 | version: 2
7 | updates:
8 | - package-ecosystem: "nuget" # See documentation for possible values
9 | directory: "/Src/CoreWindowsWrapper" # Location of package manifests
10 | schedule:
11 | interval: "daily"
12 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, sex characteristics, gender identity and expression,
9 | level of experience, education, socio-economic status, nationality, personal
10 | appearance, race, religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team at info@itagnesmeyer.de. All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 |
75 | For answers to common questions about this code of conduct, see
76 | https://www.contributor-covenant.org/faq
77 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributor
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 DIGA
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | # Plull-Request
2 |
--------------------------------------------------------------------------------
/Pitures/Menu1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Pitures/Menu1.jpg
--------------------------------------------------------------------------------
/Pitures/Menu2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Pitures/Menu2.jpg
--------------------------------------------------------------------------------
/Pitures/Visual_Style_Styled.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Pitures/Visual_Style_Styled.JPG
--------------------------------------------------------------------------------
/Pitures/Visual_Style_no_Style.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Pitures/Visual_Style_no_Style.JPG
--------------------------------------------------------------------------------
/Pitures/windows_icon.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Pitures/windows_icon.JPG
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CoreWindowsWrapper
2 | ### Native Windows Wrapper for .NET-Core and .Framework
3 |
4 | CoreWindowsWrapper is a DLL you can use to create Core Applications showing Dialogs without using System.Windows.Forms.
5 | The Project uses the Windows - API to create Native Windows. I personally use this DLL to create Copy-Deploy-Setups.
6 |
7 | The component does not use COM. Unlike WPF or Windows Forms, it is possible to compile AOT Native.
8 |
9 | How to create DotNet-Core apps:
10 | ---
11 | 1. Create a project from the Type Console (Core).
12 | 2. Change the output type from Console to Windows application in the project properties.
13 |
14 | #### Application with Styling enabled.
15 | If the application contains the Manifest it looks like this.
16 |
17 | 
18 |
19 | #### Application with Styling disabled.
20 | If you do not use MT.exe or do not include app.manifest in your Project. The application looks like this.
21 |
22 | 
23 |
24 |
25 |
26 |
27 |
28 |
29 | #### Create a Native Window
30 | Create a new Class derive from NativeWindow
31 |
32 | ```c#
33 | //Native Window
34 | public class Window1:NativeWindow
35 | {
36 | //Add your Controls
37 | //in this example a Button
38 | private NativeButton _Button;
39 |
40 | //Override InitControls Function
41 | protected override void InitControls()
42 | {
43 | //Set the properties of the Form.
44 | this.Text = "Dies ist meine Anwnedung";//Caption of the Window.
45 | this.Name = "Window1";
46 | this.Left = 100;
47 | this.Top = 100;
48 | this.Width = 600;
49 | this.Height = 400;
50 |
51 | //Create the Button
52 | this._Button = new NativeButton
53 | {
54 | Left = 10,
55 | Top = 10,
56 | Width = 100,
57 | Height = 30,
58 | Text = "Test",//Caption of the Button
59 | Name = "bnTest",
60 | Font = new Font(){Name="Arial",Size=14} //set the Font of the Button
61 | };
62 | //Add Eventhandler
63 | this._Button.Clicked += button_OnClicked;
64 |
65 | //Add the Button to the Window.
66 | this.Controls.Add(this._Button);
67 | }
68 | //Eventhandler for the Button
69 | private void button_OnClicked(object sender, EventArgs e)
70 | {
71 | //Show a Messagebox.
72 | MessageBox.Show("Button Clicked!");
73 | }
74 | }
75 | ```
76 | For more Details have a look at the Project ConsoleCaller.
77 |
78 | #### Initialize the Application
79 | To initilize the Application you have to create 2 Lines of Code in the Main-Function.
80 | This is necessary because of Threading and Windows Messaging.
81 | ```C#
82 | using CoreWindowsWrapper;
83 |
84 | namespace ConsleCaller
85 | {
86 | class Program
87 | {
88 | static void Main(string[] args)
89 | {
90 | //Create the Window
91 | Window1 nw = new Window1();
92 | //Run the Application
93 | NativeApp.Run(nw);
94 | }
95 | }
96 | }
97 | ```
98 |
99 | Example Videos:
100 | ---
101 | 1. [How to crate a control with CoreWindowsWrapper](https://www.youtube.com/watch?v=pUK0cw0OkMo)
102 | 2. [Visual Styles](https://www.youtube.com/watch?v=XMHUsqDBWR0)
103 |
104 | Mac-OS comming soon:
105 | ---
106 | [Take a look at the preview](https://www.youtube.com/watch?v=cfcFkxKG4GQ)
107 |
108 | ---
109 |
110 | I hope this helps in many Projects.
111 |
112 | ##### Dipl.-Ing.(FH) Guido Agnesmeyer
113 | ##### MAR 2023
114 |
115 |
--------------------------------------------------------------------------------
/Src/ConsleCaller/Browser.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/Browser.ico
--------------------------------------------------------------------------------
/Src/ConsleCaller/BrowserWindow.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using CoreWindowsWrapper;
3 | using Diga.Core.Api.Win32;
4 | using Diga.NativeControls.WebBrowser;
5 | using Diga.WebView2.Wrapper;
6 | using Diga.WebView2.Wrapper.EventArguments;
7 |
8 | namespace ConsoleCaller
9 | {
10 | class BrowserWindow : NativeWindow
11 | {
12 | private NativeWebBrowser _Browser;
13 | protected override void InitControls()
14 | {
15 | base.InitControls();
16 | this.Text = "WebBrowser";
17 | this.Name = "BrowserWindow";
18 | this.StatusBar = true;
19 | this.IconFile = "Browser.ico";
20 | this.Width = 600;
21 | this.Height = 400;
22 | this.StatusBar = true;
23 | this.StartUpPosition = WindowsStartupPosition.CenterScreen;
24 |
25 | this._Browser = new NativeWebBrowser()
26 | {
27 | Width = this.Width,
28 | Height = this.Height,
29 | Url = "http://localhost:1",
30 | //IsStatusBarEnabled = true,
31 | //DefaultContextMenusEnabled = false,
32 | //DevToolsEnabled = false,
33 | EnableMonitoring = true,
34 | //BrowserExecutableFolder = ".\\edge",
35 | //BrowserUserDataFolder = "C:\\tmp\\diga",
36 | MonitoringFolder = ".\\wwwroot",
37 | MonitoringUrl = "http://localhost:1/",
38 | //AutoDock = true
39 | };
40 | this._Browser.DocumentTitleChanged += OnDocumentTitleChanged;
41 | this._Browser.NavigationStart += OnNavigationStart;
42 | this._Browser.NavigationCompleted += OnNavigationCompleted;
43 | this._Browser.WebResourceRequested += OnWebResourceRequested;
44 | this._Browser.AcceleratorKeyPressed += OnAccessorKeyPressed;
45 | this.Controls.Add(this._Browser);
46 | }
47 |
48 | private const uint NoneStyle = 385941504;
49 |
50 | private const uint NoneExStyle = 327680;
51 |
52 | private uint OldStyle;
53 | private uint OldExStyle;
54 | private void OnAccessorKeyPressed(object sender, AcceleratorKeyPressedEventArgs e)
55 | {
56 | uint currentStyle = this.GetWindowStyle();
57 | uint currentExStyle = this.GetWindowExStyle();
58 | if (e.KeyEventKind == Diga.WebView2.Interop.COREWEBVIEW2_KEY_EVENT_KIND.COREWEBVIEW2_KEY_EVENT_KIND_KEY_DOWN && e.VirtualKey == Diga.Core.Api.Win32.VirtualKeys.VK_F11)
59 | {
60 | if (currentStyle == NoneStyle && currentExStyle == NoneExStyle)
61 | {
62 | this.SetWindowState(WindowState.Normal);
63 | this.UpdateStyle(this.OldStyle);
64 | this.UpdateExStyle(this.OldExStyle);
65 | this.UpdateWidow();
66 |
67 | }
68 | else
69 | {
70 | this.OldStyle = currentStyle;
71 | this.OldExStyle = currentExStyle;
72 | this.SetWindowState(WindowState.Maximized);
73 | this.UpdateStyle(NoneStyle);
74 | this.UpdateExStyle(NoneExStyle);
75 | this.UpdateWidow();
76 |
77 | }
78 | //NativeApp.DoEvents();
79 |
80 | }
81 | }
82 |
83 | private void OnWebResourceRequested(object sender, WebResourceRequestedEventArgs e)
84 | {
85 | Debug.Print(e.Request.Uri);
86 | }
87 |
88 | private void OnNavigationCompleted(object sender, NavigationCompletedEventArgs e)
89 | {
90 | if (e.IsSuccess)
91 | this.Text = e.IsSuccess + "->" + this._Browser.Url;
92 | else
93 | this.Text = "Navigation-Error=>" + e.GetErrorText();
94 |
95 | }
96 | private void OnNavigationStart(object sender, NavigationStartingEventArgs e)
97 | {
98 | this.Text = "Start-Navigate" + e.uri;
99 | }
100 | private void OnDocumentTitleChanged(object sender, WebView2EventArgs e)
101 | {
102 | this.Text = this._Browser.Url;
103 | }
104 |
105 | //protected override void OnSize(SizeEventArgs e)
106 | //{
107 | // if (e.Width == 0) return;
108 | // base.OnSize(e);
109 | // //Rect rect = this.GetClientRect();
110 | // //this.Left = rect.Left;
111 | // //this.Top = rect.Top;
112 | // //this.Height = rect.Height;
113 | // //this.Width = rect.Width;
114 | // //this._Browser.DoDock();
115 | //}
116 | }
117 | }
--------------------------------------------------------------------------------
/Src/ConsleCaller/ConsoleCaller.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | SAK
4 | SAK
5 | SAK
6 | SAK
7 | AnyCPU;x64
8 |
9 |
10 | WinExe
11 | net8.0
12 |
13 |
14 | app.res
15 | True
16 | true
17 | <_SuppressWinFormsTrimError>true
18 | false
19 |
20 |
21 |
22 | AnyCPU
23 |
24 |
25 |
26 | AnyCPU
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | PreserveNewest
42 |
43 |
44 | Always
45 |
46 |
47 | Always
48 |
49 |
50 | PreserveNewest
51 |
52 |
53 | PreserveNewest
54 |
55 |
56 | PreserveNewest
57 |
58 |
59 | PreserveNewest
60 |
61 |
62 | PreserveNewest
63 |
64 |
65 | PreserveNewest
66 |
67 |
68 | PreserveNewest
69 |
70 |
71 | PreserveNewest
72 |
73 |
74 | PreserveNewest
75 |
76 |
77 | PreserveNewest
78 |
79 |
80 | PreserveNewest
81 |
82 |
83 | PreserveNewest
84 |
85 |
86 | PreserveNewest
87 |
88 |
89 | PreserveNewest
90 |
91 |
92 | PreserveNewest
93 |
94 |
95 | PreserveNewest
96 |
97 |
98 | PreserveNewest
99 |
100 |
101 | PreserveNewest
102 |
103 |
104 | PreserveNewest
105 |
106 |
107 | PreserveNewest
108 |
109 |
110 | PreserveNewest
111 |
112 |
113 | PreserveNewest
114 |
115 |
116 | PreserveNewest
117 |
118 |
119 | PreserveNewest
120 |
121 |
122 | PreserveNewest
123 |
124 |
125 | PreserveNewest
126 |
127 |
128 | PreserveNewest
129 |
130 |
131 | PreserveNewest
132 |
133 |
134 | PreserveNewest
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
--------------------------------------------------------------------------------
/Src/ConsleCaller/ControlOnControl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using CoreWindowsWrapper;
3 | using CoreWindowsWrapper.Tools;
4 | using Diga.Core.Api.Win32;
5 |
6 | namespace ConsoleCaller
7 | {
8 |
9 |
10 | class ControlOnControl : NativeWindow
11 | {
12 | private NativePanel _MainPanel;
13 | private NativePanel _PanelTop;
14 | private NativePanel _PanelBottom;
15 | private NativePanel _PanelCenter;
16 | private NativePanel _PanelLeft;
17 | private NativePanel _panelRight;
18 | private NativeTextBox _topTextBox;
19 | private NativeTextBox _bottomTextBox;
20 | private NativeTextBox _leftTextBox;
21 | private NativeTextBox _rightTextBox;
22 | private NativeTextBox _centerTextBox;
23 | private NativeTextBox _cneterTextBox1;
24 | protected override void InitControls()
25 | {
26 | this.Text = "Control on Control";
27 | this.Name = "MainWindow";
28 | this.Width = 600;
29 | this.Height = 400;
30 | this.StartUpPosition = WindowsStartupPosition.CenterScreen;
31 | this._MainPanel = new NativePanel
32 | {
33 | Name = "main_Panel",
34 | DockType = DockType.Fill,
35 | BackColor = ColorTool.Black
36 | };
37 | this._PanelLeft = new NativePanel
38 | {
39 | DockType = DockType.Left,
40 | Width = 100,
41 | Height = 100,
42 | BackColor = ColorTool.Read,
43 | Name = "left_Panel"
44 | };
45 | this._PanelTop = new NativePanel
46 | {
47 | DockType = DockType.Top,
48 | Height = 100,
49 | Name = "top_Panel",
50 | BackColor = ColorTool.Green
51 |
52 | };
53 | this._PanelBottom = new NativePanel
54 | {
55 | DockType = DockType.Bottom,
56 | Height = 100,
57 | Name = "bottom_Panel",
58 | BackColor = ColorTool.Blue
59 |
60 | };
61 |
62 | this._PanelCenter = new NativePanel
63 | {
64 | DockType = DockType.Fill,
65 | Width = 100,
66 | Name = "center_Panel",
67 | BackColor = ColorTool.White
68 | };
69 |
70 | this._panelRight = new NativePanel
71 | {
72 | DockType = DockType.Right,
73 | Width = 100,
74 | Name = "right_Panel",
75 | BackColor = ColorTool.Yellow
76 |
77 | };
78 | this._topTextBox = new NativeTextBox
79 | {
80 | Left = 0,
81 | Top = 0,
82 | Height = 30,
83 | Width = 100,
84 | Text = "TOP"
85 | };
86 | this._PanelTop.Controls.Add(this._topTextBox);
87 | this._leftTextBox = new NativeTextBox
88 | {
89 | Left = 0,
90 | Top = 0,
91 | Height = 30,
92 | Width = 100,
93 | Text = "LEFT"
94 | };
95 | this._PanelLeft.Controls.Add(this._leftTextBox);
96 |
97 | this._bottomTextBox = new NativeTextBox
98 | {
99 | Left = 0,
100 | Top = 0,
101 | Height = 30,
102 | Width = 100,
103 | Text = "BOTTOM"
104 | };
105 | this._PanelBottom.Controls.Add( this._bottomTextBox);
106 | this._rightTextBox = new NativeTextBox
107 | {
108 | Left = 0,
109 | Top = 0,
110 | Height = 30,
111 | Width = 100,
112 | Text = "RIGHT"
113 | };
114 | this._panelRight.Controls.Add(this._rightTextBox);
115 | this._centerTextBox = new NativeTextBox
116 | {
117 | Left = 0,
118 | Top = 0,
119 | Height = 30,
120 | Width = 100,
121 | Text = "CENTER"
122 | };
123 | this._cneterTextBox1 = new NativeTextBox
124 | {
125 | Left = 0,
126 | Top = 40,
127 | Height = 30,
128 | Width = 100,
129 | Text = "CENTER1"
130 | };
131 | this._PanelCenter.Controls.Add(this._centerTextBox);
132 | this._PanelCenter.Controls.Add(this._cneterTextBox1);
133 | this._PanelCenter.Controls.Add(this._panelRight);
134 | this._MainPanel.Controls.Add(this._PanelLeft);
135 | this._MainPanel.Controls.Add(this._PanelTop);
136 | this._MainPanel.Controls.Add(this._PanelBottom);
137 | this._MainPanel.Controls.Add(this._PanelCenter);
138 | this.Controls.Add(this._MainPanel);
139 |
140 | }
141 |
142 | private void Button_Clicked(object sender, EventArgs e)
143 | {
144 | MessageBox.Show(this.Handle, "Test", "TEST");
145 | }
146 | protected override void OnSize(SizeEventArgs e)
147 | {
148 |
149 | base.OnSize(e);
150 | }
151 | }
152 | }
153 |
--------------------------------------------------------------------------------
/Src/ConsleCaller/ControlTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using CoreWindowsWrapper;
4 | using Diga.Core.Api.Win32;
5 |
6 | namespace ConsoleCaller
7 | {
8 |
9 | public class ControlTest: NativeUserControl//NativeWindow
10 | {
11 | private NativeTextBox _TextBox;
12 | private NativeButton _Button;
13 |
14 | //protected override void OnBeforeCreate(BeforeWindowCreateEventArgs e)
15 | //{
16 | // e.Styles.Style = WindowStylesConst.WS_VISIBLE | WindowStylesConst.WS_CHILD | WindowStylesConst.WS_TABSTOP;
17 | // e.Styles.StyleEx =WindowStylesConst.WS_EX_CONTROLPARENT;
18 | //}
19 | protected override void InitControls()
20 | {
21 | //base.InitControls();
22 | Debug.Print(this.Width.ToString());
23 |
24 | this._TextBox = new NativeTextBox();
25 | this._Button = new NativeButton();
26 | this._TextBox.Width = 100;
27 | this._TextBox.Height = 30;
28 | this._TextBox.Left = 0;
29 | this._TextBox.Top = 0;
30 | this._TextBox.Name = "CONTROL_TEST_TXT";
31 | this._Button.Width = 20;
32 | this._Button.Height = 30;
33 | this._Button.Left = this._TextBox.Width;
34 | this._Button.Top = 0;
35 | this._Button.Name = "CONTROL_TEST_BT";
36 | this._Button.Text = "...";
37 |
38 | this._Button.Clicked += Button_Clicked;
39 | this.Controls.Add(this._TextBox);
40 | this.Controls.Add(this._Button);
41 | }
42 | //protected override void Initialize()
43 | //{
44 | // base.Initialize();
45 | // Debug.Print(this.Width.ToString());
46 |
47 | // this._TextBox = new NativeTextBox();
48 | // this._Button = new NativeButton();
49 | // this._TextBox.Width = 100;
50 | // this._TextBox.Height = 100;
51 | // this._TextBox.Left = 0;
52 | // this._TextBox.Top = 0;
53 | // this._TextBox.Name = "CONTROL_TEST_TXT";
54 | // this._Button.Width = 20;
55 | // this._Button.Height =100;
56 | // this._Button.Left = this._TextBox.Width;
57 | // this._Button.Top = 0;
58 | // this._Button.Name = "CONTROL_TEST_BT";
59 | // this._Button.Text = "...";
60 |
61 | // this._Button.Clicked += Button_Clicked;
62 | // this.Controls.Add(this._TextBox);
63 | // this.Controls.Add(this._Button);
64 |
65 | //}
66 | protected override void OnCreate(CreateEventArgs e)
67 | {
68 | base.OnCreate(e);
69 | Rect rect = this.GetClientRect();
70 | this._Button.Left = rect.Width - this._Button.Width;
71 | this._TextBox.Width = rect.Width - this._Button.Width;
72 |
73 | }
74 | protected override void OnSize(SizeEventArgs e)
75 | {
76 | base.OnSize(e);
77 | this._Button.Left = this.Width - this._Button.Width;
78 | this._TextBox.Width = this.Width - this._Button.Width;
79 | }
80 | private void Button_Clicked(object sender, EventArgs e)
81 | {
82 | this._TextBox.Text = "hallo";
83 | }
84 | }
85 | }
--------------------------------------------------------------------------------
/Src/ConsleCaller/Firmen_Emblem.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/Firmen_Emblem.ico
--------------------------------------------------------------------------------
/Src/ConsleCaller/ListViewTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using CoreWindowsWrapper;
4 | using CoreWindowsWrapper.Tools;
5 | using Diga.Core.Api.Win32;
6 |
7 | namespace ConsoleCaller
8 | {
9 | class ListViewTest : NativeWindow
10 | {
11 | private NativeButton _Button;
12 | private NativeLabel _Label;
13 | private NativeListView _ListView;
14 |
15 | protected override void InitControls()
16 | {
17 | this.Text = "List View Test";
18 | this.BackColor = ColorTool.White;
19 | this._Button = new NativeButton
20 | {
21 | Left = 0,
22 | Top = 0,
23 | Height = 30,
24 | Width = 255,
25 | Text = "Run"
26 | };
27 | this._Button.Clicked += OnButtonClicked;
28 |
29 | this._Label = new NativeLabel
30 | {
31 | Left = 300,
32 | Top = 0,
33 | Width = 255,
34 | Height = 30,
35 | Text = ""
36 | };
37 |
38 | this._ListView = new NativeListView
39 | {
40 | AllowEdit = false,
41 | Left = 0,
42 | Top = 40,
43 | Width = 100,
44 | Height = 100,
45 | Font = new Font { Size = 10}
46 |
47 | };
48 | this._ListView.ItemChanged += ListView_ItemChanged;
49 |
50 | this.Controls.Add(this._Button);
51 | this.Controls.Add(this._Label);
52 | this.Controls.Add(this._ListView);
53 | }
54 |
55 | private void ListView_ItemChanged(object sender, ListViewItemChangeEventArgs e)
56 | {
57 | this._Label.Text = $"Item:{e.ListViewNotify.ItemIndex},SubItem:{e.ListViewNotify.SubItemIndex} => x:{e.ListViewNotify.ActionPoint.X},y:{e.ListViewNotify.ActionPoint.Y}";
58 | }
59 |
60 | protected override void OnCreate(CreateEventArgs e)
61 | {
62 | base.OnCreate(e);
63 | Diga.Core.Api.Win32.Rect rect = this.GetClientRect();
64 | this._ListView.Width = rect.Width;
65 | this._ListView.Height = rect.Height - 50;
66 |
67 | //(uint)ListViewStylesEx.LVS_EX_BORDERSELECT |
68 | this._ListView.SetExStyle( (uint)ListViewStylesEx.LVS_EX_FULLROWSELECT |
69 | (uint)ListViewStylesEx.LVS_EX_DOUBLEBUFFER |
70 | (uint)ListViewStylesEx.LVS_EX_HEADERDRAGDROP| (uint)ListViewStylesEx.LVS_EX_GRIDLINES | (uint)ListViewStylesEx.LVS_EX_BORDERSELECT);
71 | for (int i = 0;i<100;i++)
72 | {
73 | this._ListView.InsertColumn(new ListViewColumn { SubItemIndex = i, Text = $"Column{i}" });
74 |
75 | }
76 | this._ListView.SetBkColor((uint)ColorTool.Rgb(240, 240, 240));//Schnelltaste: Alt+X
77 | this._ListView.SetOutlinedColor((uint)ColorTool.Rgb(255,0,0));
78 | uint hStyle= this._ListView.GetHeaderStyle();
79 | hStyle |= HeaderStylesConst.HDS_NOSIZING;
80 | this._ListView.SetHeaderStyle(hStyle);
81 | //this._ListView.InsertColumn(new ListViewColumn { SubItemIndex = 0, Text = "Column1" });
82 | //this._ListView.InsertColumn(new ListViewColumn { SubItemIndex = 1, Text = "Column2" });
83 | //this._ListView.InsertColumn(new ListViewColumn { SubItemIndex = 2, Text = "Column3" });
84 |
85 |
86 | }
87 |
88 | protected override void OnSize(SizeEventArgs e)
89 | {
90 | base.OnSize(e);
91 | this._ListView.Width = e.Width;
92 | this._ListView.Height = e.Height - 40;
93 | }
94 | private void OnButtonClicked(object sender, EventArgs e)
95 | {
96 |
97 | for (int i = 0; i < 10; i++)
98 | {
99 | int anz = this._ListView.GetItemCount()+1;
100 | int index = this._ListView.InsertItem(new ListViewItem { ItemIndex = anz, Text = "Value1" });
101 |
102 | for (int j = 1; j < 101; j++)
103 | {
104 | this._ListView.SetItemText(index, j, $"Value{j}-{anz}" );
105 | }
106 |
107 | }
108 | //this._ListView.SetBkColor((uint)ColorTool.LightGray);
109 | //this._ListView.SetItemText(index, 1, "Value2-"+ index.ToString());
110 | //this._ListView.SetItemText(index, 2, "value3" + index.ToString());
111 | }
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/Src/ConsleCaller/Program.cs:
--------------------------------------------------------------------------------
1 | using CoreWindowsWrapper;
2 | using System;
3 |
4 | namespace ConsoleCaller
5 | {
6 | class Program
7 | {
8 | [STAThread]
9 | public static int Main(string[] args)
10 | {
11 | NativeApp.ExceptInEvents = true;
12 | TextEditor nw = new TextEditor();
13 | NativeApp.Run(nw);
14 | return 0;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Src/ConsleCaller/Skype.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/Skype.bmp
--------------------------------------------------------------------------------
/Src/ConsleCaller/TabStopTest.cs:
--------------------------------------------------------------------------------
1 | using CoreWindowsWrapper;
2 | using Diga.Core.Api.Win32;
3 | using System;
4 |
5 | namespace ConsoleCaller
6 | {
7 | class TabStopTest :NativeWindow
8 | {
9 | private NativeTextBox txtText1;
10 | private NativeTextBox txtText2;
11 | private NativeTextBox txtText3;
12 | private NativeTextBox txtText4;
13 | private NativeTextBox txtText5;
14 | private NativeButton btnTest;
15 | protected override void InitControls()
16 | {
17 | txtText1 = new NativeTextBox()
18 | {
19 | Left = 0,
20 | Top = 0,
21 | Width = 100,
22 | Height = 25,
23 | };
24 | txtText1.Style |= WindowStylesConst.WS_BORDER;
25 | txtText2 = new NativeTextBox()
26 | {
27 | Left = 0,
28 | Top = 30,
29 | Width = 100,
30 | Height = 25,
31 |
32 | };
33 | txtText2.Style |= WindowStylesConst.WS_BORDER;
34 | txtText3 = new NativeTextBox()
35 | {
36 | Left = 0,
37 | Top = 60,
38 | Width = 100,
39 | Height = 25,
40 |
41 | };
42 | txtText3.Style |= WindowStylesConst.WS_BORDER;
43 | txtText4 = new NativeTextBox()
44 | {
45 | Left = 0,
46 | Top = 90,
47 | Width = 100,
48 | Height = 25,
49 |
50 | };
51 | txtText4.Style |= WindowStylesConst.WS_BORDER;
52 | txtText5 = new NativeTextBox()
53 | {
54 | Left = 0,
55 | Top = 120,
56 | Width = 100,
57 | Height = 25,
58 |
59 | };
60 | txtText5.Style |= WindowStylesConst.WS_BORDER;
61 | this.btnTest = new NativeButton()
62 | {
63 | Left = 0,
64 | Top = 150,
65 | Width = 100,
66 | Height = 25,
67 | Text = "Test"
68 | };
69 | this.btnTest.Clicked += btnTest_Click;
70 | this.Controls.Add(txtText1);
71 | this.Controls.Add(txtText2);
72 | this.Controls.Add(txtText3);
73 | this.Controls.Add(txtText4);
74 | this.Controls.Add(txtText5);
75 | this.Controls.Add(btnTest);
76 | }
77 |
78 | private void btnTest_Click(object sender, EventArgs e)
79 | {
80 | if ((this.txtText1.IsReadOnly))
81 | {
82 | this.txtText1.ReadOnly = false;
83 | }
84 | else
85 | {
86 | this.txtText1.ReadOnly = true;
87 | }
88 | this.txtText5.Focus();
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/Src/ConsleCaller/TestIpAddress.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using CoreWindowsWrapper;
4 |
5 | namespace ConsoleCaller
6 | {
7 | class TestIpAddress : NativeWindow
8 | {
9 | private NativeIpAddressEdit _IpEdit;
10 | private NativeButton _TestButton;
11 | private NativeLabel _Label;
12 |
13 | protected override void InitControls()
14 | {
15 | //this.Width = 400;
16 | //this.Height = 400;
17 | this.Text = "Test TExt";
18 | this.KeyDown += FormKeyDown;
19 |
20 |
21 | this.BackColor = CoreWindowsWrapper.Tools.ColorTool.Rgb(255, 255, 255);
22 | this._IpEdit = new NativeIpAddressEdit()
23 | {
24 | Top = 10,
25 | Left = 10,
26 | Width = 120,
27 | Height = 25
28 | };
29 |
30 | this._TestButton = new NativeButton()
31 | {
32 | Top = 40,
33 | Left = 10,
34 | Width = 100,
35 | Height = 25,
36 | Text = "TEST"
37 | };
38 | this._Label = new NativeLabel()
39 | {
40 | BackColor = CoreWindowsWrapper.Tools.ColorTool.ControlBackground,
41 | Top = 80,
42 | Left = 10,
43 | Width = 150,
44 | Height = 25,
45 | Font = new Font() { Name = "Arial", Size = 15 }
46 | };
47 |
48 | this._TestButton.Clicked += OnTestButtonClick;
49 | this.Controls.Add(this._IpEdit);
50 | this.Controls.Add(this._TestButton);
51 | this.Controls.Add(this._Label);
52 |
53 |
54 | }
55 |
56 |
57 | private void FormKeyDown(object sender, NativeKeyEventArgs e)
58 | {
59 | if (e.VirtalKey == Diga.Core.Api.Win32.VirtualKeys.VK_F11)
60 | {
61 | this.SetWindowState(WindowState.Maximized);
62 | NativeApp.DoEvents();
63 | }
64 | }
65 |
66 | private void OnTestButtonClick(object sender, EventArgs e)
67 | {
68 | this._IpEdit.GetAddress(out byte b1, out byte b2, out byte b3, out byte b4);
69 | Debug.Print($"{b1}.{b2}.{b3}.{b4}");
70 | this._Label.Text = $"{b1}.{b2}.{b3}.{b4}";
71 |
72 | }
73 | }
74 | }
--------------------------------------------------------------------------------
/Src/ConsleCaller/TreeViewTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using CoreWindowsWrapper;
4 | using CoreWindowsWrapper.Tools;
5 | using Diga.Core.Api.Win32;
6 |
7 | namespace ConsoleCaller
8 | {
9 | class TreeViewTest : NativeWindow
10 | {
11 | private NativeImageList _ImageList;
12 | private NativeButton _Button;
13 | private NativeTreeView _TreeView;
14 | private NativeTextBox txtOldValue;
15 | private NativeTextBox txtNewValue;
16 | protected override void InitControls()
17 | {
18 | this.Text = "TreeView Test";
19 | this.BackColor = ColorTool.White;
20 | this._Button = new NativeButton
21 | {
22 | Left = 0,
23 | Top = 0,
24 | Height = 30,
25 | Width = 255,
26 | Text = "Fill"
27 | };
28 |
29 | this._Button.Clicked += OnButtonClicked;
30 | this._ImageList = new NativeImageList();
31 | this._ImageList.AddIconRes(102);
32 | this._ImageList.AddIconRes(103);
33 | this._ImageList.AddIconRes(104);
34 | this._ImageList.AddIconRes(105);
35 | int count = this._ImageList.ImageCount;
36 | this._TreeView = new NativeTreeView
37 | {
38 |
39 | Anchor = AnchorType.Left | AnchorType.Right | AnchorType.Top | AnchorType.Bottom,
40 | Left = 0,
41 | Top = 40,
42 | Width = 400,
43 | Height = 400
44 |
45 | };
46 | this._TreeView.Changed += TreeView_Changed;
47 |
48 | this.txtOldValue = new NativeTextBox
49 | {
50 |
51 | Anchor = AnchorType.Top | AnchorType.Right,
52 | Location = new Point(410, 40),
53 | Size = new Size(150, 30)
54 | };
55 | this.txtOldValue.Style |= WindowStylesConst.WS_BORDER;
56 | this.txtNewValue = new NativeTextBox
57 | {
58 | Anchor = AnchorType.Top | AnchorType.Right,
59 | Location = new Point(410, 75),
60 | Size = new Size(150, 30)
61 | };
62 | this.txtNewValue.Style |= WindowStylesConst.WS_BORDER;
63 | this.Controls.Add(this._Button);
64 | this.Controls.Add(this._ImageList);
65 | this.Controls.Add(this._TreeView);
66 | this.Controls.Add(this.txtOldValue);
67 | this.Controls.Add(this.txtNewValue);
68 |
69 | }
70 |
71 | private void TreeView_Changed(object sender, TreeViewChagneEventArgs e)
72 | {
73 |
74 | this.txtOldValue.Text = $"old key({e.OldKey}):{e.OldItem.pszText}";
75 | this.txtNewValue.Text = $"new key({e.NewKey}):{e.NewItem.pszText}";
76 |
77 | }
78 |
79 | protected override void OnCreate(CreateEventArgs e)
80 | {
81 | base.OnCreate(e);
82 | NativeApp.DoEvents();
83 |
84 | this._TreeView.SetImageList(this._ImageList);
85 |
86 | //var rect = this.GetClientRect();
87 | //this._TreeView.Width = rect.Width;
88 |
89 | }
90 |
91 | protected override void OnSize(SizeEventArgs e)
92 | {
93 | //this._TreeView.Width = e.Width / 2;
94 | //this._TreeView.Height = e.Height - this._TreeView.Top - 10;
95 | }
96 | private void OnButtonClicked(object sender, EventArgs e)
97 | {
98 | this._TreeView.Clear();
99 | IntPtr root = this._TreeView.AddItemToRoot("RootItem", 0, -1, -1);
100 | IntPtr firstChild = this._TreeView.AddItem(root, "FirstChild", 1);
101 | IntPtr secondChild = this._TreeView.AddItemAfter(root, firstChild, "SecondChild", 2, -1, -1);
102 | IntPtr thirdChild = this._TreeView.AddItemAfter(root, firstChild, "ThirdChild", 3, -1, -1);
103 | IntPtr forthChild = this._TreeView.AddItemToRoot("ForthChild", 1);
104 | IntPtr fifthChild = this._TreeView.AddItem(forthChild, "FifthChild", 2);
105 | this._TreeView.Expand(root);
106 | }
107 |
108 |
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/Src/ConsleCaller/Window2.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using CoreWindowsWrapper;
3 | using Diga.NativeControls.WebBrowser;
4 |
5 | namespace ConsoleCaller
6 | {
7 | public class Window2 : NativeWindow
8 | {
9 | //private NativeWebBrowser _WebBrowser;
10 | private NativeButton _Button;
11 | private NativeButton _ShowModal;
12 | private NativeLink _Link;
13 | private NativeGroupBox _GroupBox;
14 | private int lastLeft = 1;
15 | private int LastTop = 1;
16 |
17 | public Window2(NativeWindow parent):base(parent)
18 | {
19 |
20 | }
21 | //public Window2(NativeWindow parent) : base(parent)
22 | //{
23 |
24 | //}
25 | protected override void InitControls()
26 | {
27 | this.Text = "Dies ist ein 2. Fenster";
28 | this.Name = "Window2";
29 | this.Left = 100;
30 | this.Top = 100;
31 | this.Width = 600;
32 | this.Height = 400;
33 | //this.IconId = 102;
34 | this.Click += Window2_Click;
35 | this.DoubleClick += Window2_DblClick;
36 | this.Create += Window2_Create;
37 | //this._WebBrowser = new NativeWebBrowser();
38 | //this._WebBrowser.Location = new Diga.Core.Api.Win32.Point(100,100);
39 | //this._WebBrowser.Width = 200;
40 | //this._WebBrowser.Height = 200;
41 | //this._WebBrowser.Url = "https://www.google.de";
42 |
43 | this._Button = new NativeButton();
44 | this._Button.Left = 100;
45 | this._Button.Top =100;
46 | this._Button.Width = 100;
47 | this._Button.Height = 30;
48 | this._Button.Text = "Add a Button";
49 | this._Button.Name = "nativeButton";
50 | this._Button.Clicked += Button_AddButton;
51 |
52 | this._Link = new NativeLink();
53 | this._Link.Left = 200;
54 | this._Link.Top = 100;
55 | this._Link.Width = 300;
56 | this._Link.Height = 25;
57 | this._Link.Text = "For more information, click here or here.";
58 | this._Link.LinkClicked += Link_Clicked;
59 | this._Link.Font = new Font() {Name = "Arial", Size = 12};
60 | this._ShowModal = new NativeButton
61 | {
62 | Top = 140,
63 | Left = 100,
64 | Width = 100,
65 | Height = 30,
66 | Name = "ShowModalButton",
67 | Text = "Show Modal"
68 | };
69 | this._ShowModal.Clicked += ShowModal_Click;
70 |
71 | this._GroupBox = new NativeGroupBox();
72 | this._GroupBox.Left = 100;
73 | this._GroupBox.Top = 250;
74 | this._GroupBox.Width = 300;
75 | this._GroupBox.Height = 100;
76 | this._GroupBox.Text = "TEST";
77 |
78 |
79 | //this.Controls.Add(this._WebBrowser);
80 | this.Controls.Add(this._Button);
81 | this.Controls.Add(this._Link);
82 | this.Controls.Add(this._ShowModal);
83 | this.Controls.Add(this._GroupBox);
84 |
85 | }
86 |
87 | private void ShowModal_Click(object sender, EventArgs e)
88 | {
89 | Window2 nw = new Window2(this);
90 | nw.ShowModal(this);
91 | MessageBox.Show("ShowModal ready");
92 | }
93 |
94 | private void Link_Clicked(object sender, NativeLinkClickEventArgs e)
95 | {
96 | MessageBox.Show("ID: " + e.Id + "\nUlr: " + e.Url);
97 | }
98 |
99 | private void Button_AddButton(object sender, EventArgs e)
100 | {
101 | NativeButton bn = new NativeButton();
102 | bn.Left = this.lastLeft;
103 | bn.Top = this.LastTop;
104 | bn.Height = 30;
105 | bn.Width = 100;
106 | this.lastLeft += bn.Width + 5;
107 | this.LastTop += bn.Height + 5;
108 | bn.Text = "Button" + this.lastLeft;
109 | bn.ForeColor = CoreWindowsWrapper.Tools.ColorTool.Blue;
110 | bn.BackColor = CoreWindowsWrapper.Tools.ColorTool.White;
111 | bn.Name = bn.Text;
112 | bn.Clicked += CreatedButton_Clicked;
113 | this.Controls.Add(bn);
114 | }
115 |
116 | private void CreatedButton_Clicked(object sender, EventArgs e)
117 | {
118 | NativeButton bn = sender as NativeButton;
119 | if (bn != null)
120 | {
121 | MessageBox.Show("Button Click=>" + bn.Name);
122 | }
123 |
124 | }
125 |
126 | private void Window2_Create(object sender, CreateEventArgs e)
127 | {
128 |
129 | }
130 |
131 | private void Window2_DblClick(object sender, MouseClickEventArgs e)
132 | {
133 | //MessageBox.Show("BrowserID:" + this._WebBrowser.Handle.ToInt32());
134 | this.Visible=false;
135 | this.Close();
136 | }
137 |
138 | private void Window2_Click(object sender, MouseClickEventArgs e)
139 | {
140 |
141 | }
142 | }
143 | }
--------------------------------------------------------------------------------
/Src/ConsleCaller/Window4.cs:
--------------------------------------------------------------------------------
1 | using CoreWindowsWrapper;
2 | using CoreWindowsWrapper.Win32ApiForm;
3 | using Diga.Core.Api.Win32.GDI;
4 | using System.Drawing;
5 |
6 | namespace ConsoleCaller
7 | {
8 | public class Window4 : NativeWindow
9 | {
10 | private Point _StartPoint;
11 | private Point _LastEndPoint;
12 | private Point _EndPoint;
13 | private bool _DoDraw;
14 | protected override void InitControls()
15 | {
16 | this.Text = "Drawin Surface";
17 | this.Name = "MainWindow";
18 | this.MouseMove += Window4_MoseMove;
19 | this.MouseDown += Window4_MouseDown;
20 | this.MouseUp += Window4_MouseUp;
21 |
22 |
23 | this.StatusBar = true;
24 |
25 | this.Width = 500;
26 | this.Height = 400;
27 | this.StartUpPosition = WindowsStartupPosition.CenterScreen;
28 |
29 | }
30 |
31 | private void Window4_MouseUp(object sender, MouseClickPositionEventArgs e)
32 | {
33 | if (e.Button == MouseButton.Left)
34 | {
35 |
36 | this._EndPoint = e.Point;
37 | this._DoDraw = false;
38 |
39 | }
40 | }
41 |
42 | private void Window4_MouseDown(object sender, MouseClickPositionEventArgs e)
43 | {
44 | if (e.Button == MouseButton.Left)
45 | {
46 | this._DoDraw = true;
47 | this._StartPoint = e.Point;
48 |
49 | }
50 | }
51 |
52 | private void Window4_MoseMove(object sender, MouseMoveEventArgs e)
53 | {
54 | this.Text = "location=>" + e.Point.X + ";" + e.Point.Y;
55 | this._LastEndPoint = this._EndPoint;
56 | this._EndPoint = e.Point;
57 | if(this._DoDraw) this.Invalidate();
58 | }
59 |
60 | protected override void OnPaint( PaintEventArgs e)
61 | {
62 | if(!this._DoDraw) return;
63 |
64 | Color fc = Color.Black;
65 |
66 |
67 | #pragma warning disable IDE0063 // Einfache using-Anweisung verwenden
68 | #pragma warning disable CA1416 // Plattformkompatibilität überprüfen
69 | using (Graphics g = Graphics.FromHdc(e.PaintObject.Hdc))
70 | {
71 |
72 | using (Pen p = new Pen(fc))
73 | {
74 | g.DrawLine(p, this._StartPoint.X,this._StartPoint.Y,this._EndPoint.X, this._EndPoint.Y);
75 | }
76 |
77 | }
78 | #pragma warning restore CA1416 // Plattformkompatibilität überprüfen
79 | #pragma warning restore IDE0063 // Einfache using-Anweisung verwenden
80 |
81 | }
82 | }
83 | }
--------------------------------------------------------------------------------
/Src/ConsleCaller/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Diga Shell
5 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | true/PM
46 | PerMonitorV2,PerMonitor
47 |
48 |
49 |
--------------------------------------------------------------------------------
/Src/ConsleCaller/app.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/app.res
--------------------------------------------------------------------------------
/Src/ConsleCaller/build.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | REM This script builds the sample for x64 Windows 10. If using Win7, adjust the 'dotnet publish' command.
4 | REM It assumes that both the dotnet CLI and cl.exe compiler are available on the path.
5 | REM A Visual Studio Developer Command Prompt will already have cl.exe on its path.
6 |
7 | SET SRCDIR=%~dp0
8 | SET OUTDIR1=%~dp0bin\windows
9 | set OUTDIR2=%~dp0bin\windows-arm
10 |
11 | mkdir %OUTDIR%
12 |
13 | REM Build managed component
14 | echo Building Managed Library
15 | dotnet publish --self-contained -r win10-x64 %SRCDIR%\ConsleCaller.csproj -o %OUTDIR1%
16 | rem dotnet publish --self-contained -r win-arm %SRCDIR%\ConsleCaller.csproj -o %OUTDIR2%
17 |
--------------------------------------------------------------------------------
/Src/ConsleCaller/lib/Diga.WebView2.Native.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/lib/Diga.WebView2.Native.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/lib/Diga.WebView2.Native.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/lib/Diga.WebView2.Native.lib
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/dotnet.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/dotnet.wasm
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
14 | C# output:
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/Mono.Security.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/Mono.Security.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/System.ComponentModel.Composition.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/System.ComponentModel.Composition.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/System.Core.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/System.Core.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/System.Data.DataSetExtensions.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/System.Data.DataSetExtensions.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/System.Data.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/System.Data.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/System.Drawing.Common.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/System.Drawing.Common.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/System.IO.Compression.FileSystem.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/System.IO.Compression.FileSystem.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/System.IO.Compression.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/System.IO.Compression.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/System.Memory.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/System.Memory.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/System.Net.Http.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/System.Net.Http.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/System.Numerics.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/System.Numerics.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/System.Runtime.Serialization.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/System.Runtime.Serialization.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/System.ServiceModel.Internals.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/System.ServiceModel.Internals.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/System.Transactions.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/System.Transactions.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/System.Xml.Linq.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/System.Xml.Linq.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/System.Xml.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/System.Xml.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/System.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/System.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/WebAssembly.Bindings.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/WebAssembly.Bindings.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/WebAssembly.Net.Http.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/WebAssembly.Net.Http.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/WebAssembly.Net.WebSockets.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/WebAssembly.Net.WebSockets.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/mscorlib.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/mscorlib.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/netstandard.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/netstandard.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/managed/sample.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/ConsleCaller/wwwroot/managed/sample.dll
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/mono-config.js:
--------------------------------------------------------------------------------
1 | config = {
2 | vfs_prefix: "managed",
3 | deploy_prefix: "managed",
4 | enable_debugging: 0,
5 | file_list: [ "sample.dll","mscorlib.dll","System.Net.Http.dll","System.dll","Mono.Security.dll","System.Xml.dll","System.Numerics.dll","System.Core.dll","WebAssembly.Net.WebSockets.dll","netstandard.dll","System.Data.dll","System.Transactions.dll","System.Data.DataSetExtensions.dll","System.Drawing.Common.dll","System.IO.Compression.dll","System.IO.Compression.FileSystem.dll","System.ComponentModel.Composition.dll","System.Runtime.Serialization.dll","System.ServiceModel.Internals.dll","System.Xml.Linq.dll","WebAssembly.Bindings.dll","System.Memory.dll","WebAssembly.Net.Http.dll" ],
6 | }
7 |
--------------------------------------------------------------------------------
/Src/ConsleCaller/wwwroot/runtime.js:
--------------------------------------------------------------------------------
1 |
2 | var Module = {
3 | onRuntimeInitialized: function () {
4 | MONO.mono_load_runtime_and_bcl (
5 | config.vfs_prefix,
6 | config.deploy_prefix,
7 | config.enable_debugging,
8 | config.file_list,
9 | function () {
10 | App.init ();
11 | }
12 | )
13 | },
14 | };
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/AnchorType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CoreWindowsWrapper
4 | {
5 | [Flags]
6 | public enum AnchorType
7 | {
8 | Top = 0x01,
9 | Bottom = 0x02,
10 | Left = 0x04,
11 | Right = 0x08,
12 | None = 0,
13 | }
14 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/ControlCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace CoreWindowsWrapper
5 | {
6 | public class ControlCollection : Dictionary,IDisposable
7 | {
8 | private Win32ApiForm.Win32Window _ParentWindow;
9 | private Win32ApiForm.Win32Control _ParentControl;
10 |
11 | internal ControlCollection(Win32ApiForm.Win32Control parent)
12 | {
13 | this._ParentControl = parent;
14 | }
15 | internal ControlCollection(Win32ApiForm.Win32Window parent)
16 | {
17 | this._ParentWindow = parent;
18 | }
19 | public void Add(IControl contorl)
20 | {
21 | IControl ctrl = contorl;
22 | if(ctrl.ControlId <= 0)
23 | {
24 | Win32ApiForm.Win32Control.LastControlId+=1;
25 | ctrl.ControlId = Win32ApiForm.Win32Control.LastControlId;
26 | }
27 |
28 | base.Add(ctrl.ControlId , contorl);
29 |
30 | if (this._ParentWindow != null)
31 | {
32 | if (this._ParentWindow.Handle.IsValid)
33 | {
34 | ctrl.Create(this._ParentWindow.Handle);
35 | }
36 | }
37 |
38 | if (this._ParentControl != null)
39 | {
40 | if (this._ParentControl.Handle.IsValid)
41 | {
42 | ctrl.Create(this._ParentControl.Handle);
43 | }
44 | }
45 | }
46 |
47 | public void Dispose()
48 | {
49 | this._ParentWindow = null;
50 | this._ParentControl = null;
51 |
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/CoreWindowsWrapper.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 | AnyCPU
9 |
10 |
11 |
12 | net8.0;net461;net472
13 | true
14 | false
15 | Dipl.-Ing.(FH) Guido Agnesmeyer
16 | https://github.com/ITAgnesmeyer/CoreWindowsWrapper.git
17 | dotnet-core;CoreWindowsWrapper
18 | CoreWindowsWrapper is a DLL you can use to create Core Applications showing Dialogs without using System.Windows.Forms. The Project uses the Windows - API to create Native Windows.
19 | Copyright © 2024 Dipl.-Ing.(FH) Guido Agnesmeyer
20 |
21 |
22 | https://github.com/ITAgnesmeyer/CoreWindowsWrapper
23 |
24 | BugFixes
25 |
26 | 2.0.8.20
27 | True
28 | False
29 | diga_cert.snk
30 | 2.0.8.20
31 | 2.0.8.20
32 |
33 |
34 | MIT
35 | README.md
36 | True
37 |
38 |
39 |
40 | AnyCPU
41 |
42 |
43 |
44 | AnyCPU
45 |
46 |
47 |
48 |
49 |
50 | 1701;1702;SYSLIB0032
51 |
52 |
53 |
54 | 1701;1702;SYSLIB0032
55 |
56 |
57 |
58 | 1701;1702;SYSLIB0032
59 |
60 |
61 |
62 | 1701;1702;SYSLIB0032
63 |
64 |
65 |
66 | 1701;1702;SYSLIB0032
67 |
68 |
69 |
70 | 1701;1702;SYSLIB0032
71 |
72 |
73 |
74 | 1701;1702;SYSLIB0032
75 |
76 |
77 |
78 | 1701;1702;SYSLIB0032
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 | True
97 | True
98 | Resources.resx
99 |
100 |
101 |
102 |
103 |
104 | ResXFileCodeGenerator
105 | Resources.Designer.cs
106 |
107 |
108 |
109 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/CreateEventArgs.cs:
--------------------------------------------------------------------------------
1 | using Diga.Core.Api.Win32;
2 | using System;
3 |
4 | namespace CoreWindowsWrapper
5 | {
6 | public class EventArgStyleWrapper
7 | {
8 | public uint Style { get; set; }
9 | public uint StyleEx { get; set; }
10 | public EventArgStyleWrapper(uint style, uint styleEx)
11 | {
12 | this.Style = style;
13 | this.StyleEx = styleEx;
14 | }
15 | }
16 | [Serializable]
17 | public class BeforeWindowCreateEventArgs: EventArgs
18 | {
19 |
20 |
21 | public EventArgStyleWrapper Styles { get; set; }
22 | public BeforeWindowCreateEventArgs(uint style, uint styleEx)
23 | {
24 | this.Styles = new EventArgStyleWrapper(style, styleEx);
25 | }
26 | }
27 |
28 | [Serializable]
29 | public class CreateEventArgs: EventArgs
30 | {
31 | public IntPtr Handle { get; }
32 |
33 | public CreateEventArgs(IntPtr handle)
34 | {
35 | this.Handle = handle;
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/DockType.cs:
--------------------------------------------------------------------------------
1 | namespace CoreWindowsWrapper
2 | {
3 | public enum DockType
4 | {
5 | None,
6 | Top,
7 | Bottom,
8 | Left,
9 | Right,
10 | Fill
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/Font.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Diga.Core.Api.Win32;
4 | using Diga.Core.Api.Win32.GDI;
5 |
6 | namespace CoreWindowsWrapper
7 | {
8 | public class Font
9 | {
10 | private LogFont _LogFont;
11 | private int? _Size;
12 | private bool? _Italic;
13 | private bool? _Bold;
14 |
15 | public Font()
16 | {
17 | this._LogFont = Tools.FontTool.GetDefaultLogFont();
18 | }
19 | internal Font(LogFont logFont)
20 | {
21 | this._LogFont = logFont;
22 |
23 | }
24 |
25 | internal void FormLogFont(LogFont logFon, IntPtr hWnd)
26 | {
27 | this._LogFont = logFon;
28 | this.FromLogFont(hWnd,true);
29 | }
30 | internal void FromLogFont(IntPtr hWnd, bool overwrite = false)
31 | {
32 | IntPtr hDc = User32.GetDC(hWnd);
33 | if(overwrite)
34 | {
35 | this.Name = this._LogFont.lfFaceName;
36 | this.Italic = Win32Api.ByteToBool(this._LogFont.lfItalic);
37 | this.Bold = false;
38 | if (this._LogFont.lfWeight == FontWeight.FW_BOLD)
39 | this.Bold = true;
40 | this.Size = Tools.FontTool.FontHeightToSize(this._LogFont.lfHeight, hDc);
41 |
42 | }
43 | else
44 | {
45 | if (string.IsNullOrEmpty(this.Name))
46 | this.Name = this._LogFont.lfFaceName;
47 |
48 |
49 | if(this._Italic == null)
50 | this.Italic = Win32Api.ByteToBool(this._LogFont.lfItalic);
51 | if(this._Bold == null)
52 | {
53 | this.Bold = false;
54 | if (this._LogFont.lfWeight == FontWeight.FW_BOLD)
55 | this.Bold = true;
56 |
57 | }
58 | if(this._Size == null)
59 | {
60 | this.Size = Tools.FontTool.FontHeightToSize(this._LogFont.lfHeight, hDc);
61 | }
62 |
63 | }
64 |
65 | User32.ReleaseDC(hWnd, hDc);
66 |
67 | }
68 |
69 | public string Name { get; set; }
70 |
71 | public int Size { get => _Size.GetValueOrDefault(0); set => _Size = value; }
72 |
73 | public bool Italic { get => _Italic.GetValueOrDefault(false); set => _Italic = value; }
74 |
75 | public bool Bold { get => _Bold.GetValueOrDefault(false); set => _Bold = value; }
76 |
77 | internal LogFont ToLogFont(IntPtr hWnd)
78 | {
79 | IntPtr hDc = User32.GetDC(hWnd);
80 | this._LogFont = new LogFont();
81 | this._LogFont.lfFaceName = this.Name;
82 |
83 | this._LogFont.lfItalic = Win32Api.BoolToByte(this.Italic);
84 |
85 | this._LogFont.lfWeight = FontWeight.FW_NORMAL;
86 | if(this.Bold == true)
87 | this._LogFont.lfWeight = FontWeight.FW_BOLD;
88 |
89 | this._LogFont.lfHeight = Tools.FontTool.FontSizeToHeight(this.Size, hDc);
90 |
91 | User32.ReleaseDC(hWnd, hDc);
92 | return this._LogFont;
93 | }
94 |
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/IControl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using CoreWindowsWrapper.Win32ApiForm;
4 | using Diga.Core.Api.Win32;
5 |
6 | namespace CoreWindowsWrapper
7 | {
8 | public interface IControl:IWindow
9 | {
10 | IntPtr ParentHandle { get; set; }
11 | string Name { get; set; }
12 | string Text { get; set; }
13 | int BackColor { get; set; }
14 | int ForeColor{get;set;}
15 | int Left { get; set; }
16 | int Top { get; set; }
17 | int Width { get; set; }
18 | int Height { get; set; }
19 | bool Enabled{get;set;}
20 | Point Location { get; set; }
21 | int ControlId { get; set; }
22 | bool ClientEdge{get;set;}
23 | bool Create(IntPtr parentId);
24 | Font Font{get;set;}
25 | void Destroy();
26 | bool HandleEvents(IntPtr hWndParent, IntPtr hWndControl, int controlId, uint command, IntPtr wParam,
27 | IntPtr lParam);
28 |
29 | ControlCollection Controls{get;}
30 | string TypeIdentifyer{get;set;}
31 | ControlType ControlType{get;set;}
32 |
33 | void OnParentResize();
34 |
35 | }
36 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/IMenuItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CoreWindowsWrapper
4 | {
5 | public interface IMenuItem
6 | {
7 | int Id{get;set;}
8 | IntPtr Handle{get;set;}
9 | string Name{get;set;}
10 | string Text{get;set;}
11 | IntPtr ParentMenuHandle{get;set;}
12 | void Create(IntPtr parentMenuHandle);
13 | bool HandleEvents(IntPtr hWndParent, IntPtr hWndControl, int controlId, uint command, IntPtr wParam,
14 | IntPtr lParam);
15 | void Destroy();
16 |
17 | }
18 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/IWindow.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CoreWindowsWrapper
4 | {
5 | public interface IWindow
6 | {
7 | IntPtr Handle { get; }
8 | }
9 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/IWindowClass.cs:
--------------------------------------------------------------------------------
1 |
2 | using Diga.Core.Api.Win32;
3 |
4 | namespace CoreWindowsWrapper
5 | {
6 | internal interface IWindowClass
7 | {
8 | WndclassEx WindowClass { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/KeyCode.cs:
--------------------------------------------------------------------------------
1 | using Diga.Core.Api.Win32;
2 |
3 | namespace CoreWindowsWrapper
4 | {
5 | public enum KeyCode:int
6 | {
7 | Key0=0x30,
8 | Key1=0x31,
9 | Key2=0x32,
10 | Key3=0x33,
11 | Key4=0x34,
12 | Key5=0x35 ,
13 | Key6=0x36 ,
14 | Key7=0x37,
15 | Key8=0x38,
16 | Key9=0x39,
17 | KeyA=0x41,
18 | KeyB=0x42,
19 | KeyC=0x43,
20 | KeyD=0x44,
21 | KeyE=0x45,
22 | KeyF=0x46,
23 | KeyG=0x47,
24 | KeyH=0x48,
25 | KeyI=0x49,
26 | KeyJ=0x4A,
27 | KeyK=0x4B,
28 | KeyL=0x4C,
29 | KeyM=0x4D,
30 | KeyN=0x4E,
31 | KeyO=0x4F,
32 | KeyP=0x50,
33 | KeyQ=0x51,
34 | KeyR=0x52,
35 | KeyS=0x53,
36 | KeyT=0x54,
37 | KeyU=0x55,
38 | KeyV=0x56,
39 | KeyW=0x57,
40 | KeyX=0x58,
41 | KeyY=0x59,
42 | KeyZ=0x5A,
43 | KeySpace=(int)VirtualKeys.VK_SPACE
44 |
45 | }
46 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/MenuItemCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace CoreWindowsWrapper
5 | {
6 | public class MenuItemCollection : Dictionary, IDisposable
7 | {
8 | public void Add(IMenuItem menuItem)
9 | {
10 | if (menuItem.Id <= 0)
11 | {
12 | Win32ApiForm.Win32Control.LastControlId+=1;
13 | menuItem.Id = Win32ApiForm.Win32Control.LastControlId;
14 | }
15 | base.Add(menuItem.Id, menuItem);
16 | }
17 |
18 |
19 | #region IDisposable Support
20 | private bool disposedValue = false; // Dient zur Erkennung redundanter Aufrufe.
21 |
22 | protected virtual void Dispose(bool disposing)
23 | {
24 | if (!this.disposedValue)
25 | {
26 | if (disposing)
27 | {
28 | // TODO: verwalteten Zustand (verwaltete Objekte) entsorgen.
29 |
30 | }
31 |
32 |
33 | this.disposedValue = true;
34 | }
35 | }
36 |
37 |
38 | public void Dispose()
39 | {
40 | Dispose(true);
41 | }
42 | #endregion
43 |
44 | }
45 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/MessageBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Diga.Core.Api.Win32;
4 |
5 | namespace CoreWindowsWrapper
6 | {
7 | public static class MessageBox
8 | {
9 |
10 | public static MessageBoxResult Show(IntPtr parent, string message, string caption,MessageBoxOptions options = MessageBoxOptions.OkOnly )
11 | {
12 | return (MessageBoxResult)User32.MessageBox(parent, message, caption, (uint) options);
13 | }
14 |
15 | public static MessageBoxResult Show(string message, string caption="API")
16 | {
17 | return Show(User32.GetActiveWindow(), message, caption);
18 | }
19 |
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/MessageBoxOptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CoreWindowsWrapper
4 | {
5 | [Flags]
6 | public enum MessageBoxOptions : uint
7 | {
8 | OkOnly = 0x000000,
9 | OkCancel = 0x000001,
10 | AbortRetryIgnore = 0x000002,
11 | YesNoCancel = 0x000003,
12 | YesNo = 0x000004,
13 | RetryCancel = 0x000005,
14 | CancelTryContinue = 0x000006,
15 | IconHand = 0x000010,
16 | IconQuestion = 0x000020,
17 | IconExclamation = 0x000030,
18 | IconAsterisk = 0x000040,
19 | UserIcon = 0x000080,
20 | IconWarning = IconExclamation,
21 | IconError = IconHand,
22 | IconInformation = IconAsterisk,
23 | IconStop = IconHand,
24 | DefButton1 = 0x000000,
25 | DefButton2 = 0x000100,
26 | DefButton3 = 0x000200,
27 | DefButton4 = 0x000300,
28 | ApplicationModal = 0x000000,
29 | SystemModal = 0x001000,
30 | TaskModal = 0x002000,
31 | Help = 0x004000,
32 | NoFocus = 0x008000,
33 | SetForeground = 0x010000,
34 | DefaultDesktopOnly = 0x020000,
35 | Topmost = 0x040000,
36 | Right = 0x080000,
37 | RtlReading = 0x100000
38 | }
39 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/MessageBoxResult.cs:
--------------------------------------------------------------------------------
1 | namespace CoreWindowsWrapper
2 | {
3 | ///
4 | /// Represents possible values returned by the MessageBox function.
5 | ///
6 | public enum MessageBoxResult : uint
7 | {
8 | Ok = 1,
9 | Cancel=2,
10 | Abort=3,
11 | Retry=4,
12 | Ignore=5,
13 | Yes=6,
14 | No=7,
15 | Close=8,
16 | Help=9,
17 | TryAgain=10,
18 | Continue=11,
19 | Timeout = 32000
20 | }
21 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/MouseButton.cs:
--------------------------------------------------------------------------------
1 | namespace CoreWindowsWrapper
2 | {
3 | public enum MouseButton : int
4 | {
5 |
6 | Left=0,
7 | Right=1,
8 | Middle=3
9 | }
10 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/MouseClickEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Diga.Core.Api.Win32;
4 |
5 | namespace CoreWindowsWrapper
6 | {
7 | [Serializable]
8 | public class MouseClickEventArgs : EventArgs
9 | {
10 | public MouseButton Button { get; }
11 | public IntPtr Handel { get; }
12 |
13 |
14 |
15 | public MouseClickEventArgs(MouseButton button, IntPtr handel)
16 | {
17 | this.Button = button;
18 | this.Handel = handel;
19 | }
20 | }
21 |
22 | [Serializable]
23 | public class MouseClickPositionEventArgs : MouseClickEventArgs
24 | {
25 | public Point Point{get;}
26 | public MouseKey MouseButton{get;}
27 | public MouseClickPositionEventArgs(MouseButton button, IntPtr handel, Point point, MouseKey mouseButton) : base(button, handel)
28 | {
29 | this.Point = point;
30 | this.MouseButton = mouseButton;
31 | }
32 | }
33 |
34 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/MouseMoveEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Diga.Core.Api.Win32;
4 |
5 | namespace CoreWindowsWrapper.Win32ApiForm
6 | {
7 | public class MouseMoveEventArgs : EventArgs
8 | {
9 | public MouseMoveEventArgs(Point point, MouseKey mouseButton)
10 | {
11 | this.Point = point;
12 | this.MouseButton = mouseButton;
13 | }
14 |
15 | public Point Point{get;}
16 | public MouseKey MouseButton{get;}
17 |
18 | }
19 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeAxControlBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using CoreWindowsWrapper.Win32ApiForm;
3 |
4 | namespace CoreWindowsWrapper
5 | {
6 |
7 | public class NativeAxControlBase: NativeControlBase
8 | {
9 |
10 |
11 | //public IUnknown Unknown { get; private set; }
12 | //public NativeAxControlBase()
13 | //{
14 | // this.Initialize();
15 | //}
16 | protected override void Initialize()
17 | {
18 |
19 | this.Control = new Win32AxControl();
20 |
21 |
22 | }
23 |
24 | public override bool Create(IntPtr parentId)
25 | {
26 | bool retVal = base.Create(parentId);
27 | //IWebBrowser2 webBroswer;
28 | //GUID CLSID_WebBrowser = new GUID();
29 | //IntPtr strPtr = Marshal.StringToHGlobalUni("{8856F961-340A-11D0-A96B-00C04FD705A2}");
30 | //NativeMethods.IIDFromString(strPtr,ref CLSID_WebBrowser);
31 | //Marshal.FreeHGlobal(strPtr);
32 | //GUID IID_IUnknown = new GUID();
33 | //strPtr = Marshal.StringToHGlobalUni("{00000000-0000-0000-C000-000000000046}");
34 | //IntPtr initVal = new IntPtr(0);
35 | //NativeMethods.IIDFromString(strPtr,ref IID_IUnknown);
36 | //Marshal.FreeHGlobal(strPtr);
37 |
38 | //NativeMethods.CoInitialize(initVal);
39 | //Guid cGuid = new Guid("{8856F961-340A-11D0-A96B-00C04FD705A2}");
40 | //Type test = Type.GetTypeFromCLSID(cGuid);
41 | //object testObj = Activator.CreateInstance(test);
42 |
43 | //IWebBrowser2 wb = (IWebBrowser2) testObj;
44 | //webBroswer = wb;
45 | ////object obj = NativeMethods.CoCreateInstance(ref CLSID_WebBrowser, null, 1 , ref IID_IWebBrowser2);
46 | //IUnknownVtbl vtbl = new IUnknownVtbl();
47 |
48 | //StrktIUnknown unk = new StrktIUnknown();
49 |
50 | //IntPtr vtIntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vtbl));
51 | //unk.lpVtbl = vtIntPtr;
52 |
53 | //IntPtr pnt = Marshal.AllocHGlobal(Marshal.SizeOf(unk));
54 |
55 | //IntPtr outer = IntPtr.Zero;
56 | //int val = NativeMethods.CoCreateInstance(ref CLSID_WebBrowser,ref outer, (uint)(1 | 2 | 4 | 16), ref IID_IUnknown,
57 | // ref pnt);
58 |
59 | //webBroswer = Marshal.PtrToStructure(pnt);
60 | //IntPtr nPtr = new IntPtr(0);
61 | //int ret = NativeMethods.CoInitialize(0);
62 |
63 | //NativeMethods.AtlAxAttachControl(webBroswer, this.Handle, IntPtr.Zero);
64 | //IntPtr hDll = NativeMethods.LoadLibrary("atl.dll");
65 | //NativeMethods.PAttachControl func = NativeMethods.GetProcAddress(hDll, "AtlAxAttachControl");
66 | //object obj = webBroswer;
67 | //func.Invoke(obj, this.Handle, IntPtr.Zero);
68 | //webBroswer.GoHome();
69 | //object nullObj = null;
70 | //webBroswer.Navigate("www.google.de",ref nullObj,ref nullObj,ref nullObj,ref nullObj);
71 |
72 |
73 | //Marshal.FreeHGlobal(pnt);
74 | //Marshal.FreeHGlobal(vtIntPtr);
75 | return retVal;
76 |
77 | }
78 | }
79 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeBitmap.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using Diga.Core.Api.Win32;
4 |
5 | namespace CoreWindowsWrapper
6 | {
7 | public class NativeBitmap:NativeLabel
8 | {
9 | protected override void Initialize()
10 | {
11 | base.Initialize();
12 | this.ControlType = Win32ApiForm.ControlType.Label;
13 | this.TypeIdentifier = "static";
14 | this.Style = WindowStylesConst.WS_VISIBLE | WindowStylesConst.WS_CHILD | StaticControlStyles.SS_BITMAP | StaticControlStyles.SS_NOTIFY;
15 | }
16 |
17 | public string BitMap{get;set;}
18 |
19 | public void Refresh()
20 | {
21 | if(string.IsNullOrEmpty(this.BitMap)) return;
22 | if(!File.Exists(this.BitMap)) return;
23 | IntPtr hBmp = Tools.ImageTool.SafeLoadBitmapFromFile(this.BitMap);
24 | User32.SendMessage(this.Handle, StaticControlMessages.STM_SETIMAGE, ImageTypeConst.IMAGE_BITMAP, hBmp);
25 |
26 | }
27 |
28 | }
29 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeButton.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using Diga.Core.Api.Win32;
4 |
5 | namespace CoreWindowsWrapper
6 | {
7 | public class NativeButton : NativeControlBase
8 | {
9 | public override event EventHandler Clicked;
10 | public override event EventHandler DblClicked;
11 |
12 |
13 | protected override void Initialize()
14 | {
15 | base.Initialize();
16 | this.ControlType = Win32ApiForm.ControlType.Button;
17 | this.TypeIdentifier = "button";
18 | this.Style = this.Style | ButtonStyles.BS_PUSHBUTTON | ButtonStyles.BS_FLAT | ButtonStyles.BS_NOTIFY;
19 |
20 |
21 | }
22 |
23 | protected override bool ControlProc(IntPtr hWndParent, IntPtr hWndControl, int controlId, uint command, IntPtr wParam, IntPtr lParam)
24 | {
25 | bool handeld = false;
26 |
27 | switch (command)
28 | {
29 | case ButtonMessages.BN_SETFOCUS:
30 | Debug.Print("ButtonControl:BN_SETFOCUS");
31 | break;
32 | case ButtonMessages.BN_KILLFOCUS:
33 | Debug.Print("ButtonControl:BN_KILLFOCUS");
34 | break;
35 | case ButtonMessages.BN_CLICKED:
36 | OnClicked();
37 | handeld = true;
38 | break;
39 | case ButtonMessages.BN_DBLCLK:
40 | OnDblClicked();
41 | handeld = true;
42 | break;
43 | }
44 |
45 | return handeld;
46 | }
47 |
48 |
49 | protected override void OnClicked()
50 | {
51 | //Clicked?.Invoke(this, EventArgs.Empty);
52 | SafeInvoke(this.Clicked, EventArgs.Empty);
53 | }
54 |
55 | protected override void OnDblClicked()
56 | {
57 | //DblClicked?.Invoke(this,EventArgs.Empty);
58 | SafeInvoke(this.DblClicked, EventArgs.Empty);
59 | }
60 | }
61 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeCheckBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Diga.Core.Api.Win32;
3 |
4 | namespace CoreWindowsWrapper
5 | {
6 | public class NativeCheckBox:NativeButton
7 | {
8 | private bool _Checked;
9 | protected override void Initialize()
10 | {
11 | base.Initialize();
12 | this.ControlType = Win32ApiForm.ControlType.CheckBox;
13 | this.Style = this.Style |ButtonStyles.BS_CHECKBOX | ButtonStyles.BS_NOTIFY;
14 |
15 | }
16 |
17 | protected override void AfterCreate()
18 | {
19 | base.AfterCreate();
20 | this.Checked = this._Checked;
21 | }
22 |
23 | protected override bool ControlProc(IntPtr hWndParent, IntPtr hWndControl, int controlId, uint command, IntPtr wParam, IntPtr lParam)
24 | {
25 | bool handled = false;
26 | switch (command)
27 | {
28 | case 0:
29 | uint check = User32.IsDlgButtonChecked(hWndParent, controlId);
30 | if(check == 1)
31 | User32.CheckDlgButton(hWndParent, controlId,0);
32 | else
33 | User32.CheckDlgButton(hWndParent,controlId,1);
34 | handled = true;
35 | break;
36 | default:
37 | handled = base.ControlProc(hWndParent, hWndControl, controlId, command, wParam, lParam);
38 | break;
39 | }
40 |
41 | return handled;
42 |
43 | }
44 |
45 | public bool Checked
46 | {
47 | get
48 | {
49 | if(this.ParentHandle != IntPtr.Zero)
50 | {
51 | uint check = User32.IsDlgButtonChecked(this.ParentHandle, this.ControlId);
52 | if(check==1)
53 | this._Checked = true;
54 | else
55 | this._Checked = false;
56 | }
57 |
58 | return this._Checked;
59 |
60 | }
61 |
62 | set
63 | {
64 | this._Checked = value;
65 | if(this.ParentHandle != IntPtr.Zero)
66 | {
67 | uint check = 0;
68 | if(this._Checked) check = 1;
69 | User32.CheckDlgButton(this.ParentHandle,this.ControlId, check);
70 | }
71 | }
72 | }
73 | }
74 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeChildWindow.cs:
--------------------------------------------------------------------------------
1 | namespace CoreWindowsWrapper
2 | {
3 | public class NativeChildWindow : NativeWindow
4 | {
5 | public NativeChildWindow() : base()
6 | {
7 | this.IsMainWindow = false;
8 | }
9 | public NativeChildWindow(NativeWindow parent) : base(parent)
10 | {
11 | this.IsMainWindow = false;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeComboBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using Diga.Core.Api.Win32;
4 |
5 | namespace CoreWindowsWrapper
6 | {
7 |
8 | public class NativeComboBox : NativeControlBase
9 | {
10 | public event EventHandler SelChange;
11 | protected override void Initialize()
12 | {
13 | base.Initialize();
14 | this.ControlType = Win32ApiForm.ControlType.ComboBox;
15 | this.TypeIdentifier = "combobox";
16 |
17 | this.Style = ComboBoxStyles.CBS_DROPDOWN | ComboBoxStyles.CBS_HASSTRINGS |WindowStylesConst.WS_CHILD | WindowStylesConst.WS_OVERLAPPED | WindowStylesConst.WS_VISIBLE | WindowStylesConst.WS_TABSTOP;
18 | }
19 | //protected override void AfterCreate()
20 | //{
21 | // base.AfterCreate();
22 | // NativeTheaming.SetThemaing(this.Handle);
23 | //}
24 | protected override bool ControlProc(IntPtr hWndParent, IntPtr hWndControl, int controlId, uint command, IntPtr wParam, IntPtr lParam)
25 | {
26 |
27 | bool handled = false;
28 |
29 | switch (command)
30 | {
31 | case ComboBoxMessages.CBN_SELCHANGE:
32 | int selIndex = this.SelectedIndex;
33 | NativeComboBoxSelChangeEventArgs evItem = new NativeComboBoxSelChangeEventArgs(selIndex);
34 | OnSelChange(evItem);
35 | handled = true;
36 | break;
37 | }
38 |
39 |
40 | return handled;
41 | }
42 |
43 | public void Add(string addString)
44 | {
45 | User32.SendMessage(this.Handle, ComboBoxCommands.CB_ADDSTRING, 0, addString);
46 | }
47 |
48 | public int SelectedIndex
49 | {
50 | get
51 | {
52 | int selected = User32.SendMessage(this.Handle, ComboBoxCommands.CB_GETCURSEL, 0, 0).ToInt32();
53 | return selected;
54 | }
55 | set
56 | {
57 | User32.SendMessage(this.Handle, ComboBoxCommands.CB_SETCURSEL, value, (int)0);
58 | }
59 | }
60 |
61 | public int ItemsCount()
62 | {
63 | return User32.SendMessage(this.Handle, ComboBoxCommands.CB_GETCOUNT, 0, 0).ToInt32();
64 | }
65 |
66 | public string ItemText(int index)
67 | {
68 | StringBuilder sb = new StringBuilder();
69 | User32.SendMessage(this.Handle, ComboBoxCommands.CB_GETLBTEXT, index, sb);
70 | return sb.ToString();
71 | }
72 |
73 | protected virtual void OnSelChange(NativeComboBoxSelChangeEventArgs e)
74 | {
75 | SafeInvoke(this.SelChange, e);
76 | }
77 | }
78 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeComboBoxSelChangeEventArgs.cs:
--------------------------------------------------------------------------------
1 | using Diga.Core.Api.Win32;
2 | using System;
3 |
4 | namespace CoreWindowsWrapper
5 | {
6 | public class NativeComboBoxSelChangeEventArgs : EventArgs
7 | {
8 | public int Index { get; }
9 |
10 | public NativeComboBoxSelChangeEventArgs(int index)
11 | {
12 | this.Index = index;
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeContainerControl.cs:
--------------------------------------------------------------------------------
1 | using Diga.Core.Api.Win32;
2 | using System;
3 | using System.Collections.Generic;
4 |
5 | namespace CoreWindowsWrapper
6 | {
7 |
8 | public class NativeContainerControl : NativeNoCreateControlBase
9 | {
10 | protected override void Initialize()
11 | {
12 | base.Initialize();
13 |
14 | }
15 |
16 | public override bool Create(IntPtr parentHandle)
17 | {
18 |
19 | return base.Create(parentHandle);
20 |
21 | //foreach (KeyValuePair control in this.Controls)
22 | //{
23 | // control.Value
24 | //}
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeDateTimePicker.cs:
--------------------------------------------------------------------------------
1 | using Diga.Core.Api.Win32;
2 | using System;
3 |
4 | namespace CoreWindowsWrapper
5 | {
6 | public class NativeDateTimePicker : NativeControlBase
7 | {
8 | private const uint DTN_FIRST2 = 0xfffffd0f;
9 | private const uint DTN_DATETIMECHANGE = (DTN_FIRST2 - 6);
10 | public event EventHandler SetFocus;
11 | public event EventHandler KillFocus;
12 | public event EventHandler Change;
13 | protected override void Initialize()
14 | {
15 | base.Initialize();
16 | this.TypeIdentifier = "SysDateTimePick32";
17 | //this.Style |= 0x000C | 0x0009;
18 | }
19 |
20 | protected override bool ControlProc(IntPtr hWndParent, IntPtr hWndControl, int controlId, uint command, IntPtr wParam, IntPtr lParam)
21 | {
22 | bool handled = false;
23 | switch (command)
24 | {
25 | case NotifyMessageConst.NM_SETFOCUS:
26 | OnSetFocus();
27 | handled = true;
28 | break;
29 | case NotifyMessageConst.NM_KILLFOCUS:
30 | OnKillFocus();
31 | handled = true;
32 | break;
33 | case DTN_DATETIMECHANGE:
34 | OnChange();
35 | handled = true;
36 | break;
37 |
38 | }
39 |
40 | return handled;
41 | }
42 |
43 | public DateTime Value
44 | {
45 | get
46 | {
47 | int retVal = DateTimePickerMessages.DateTime_GetSystemtime(this.Handle, out SystemTime time);
48 | if(retVal == 0)
49 | {
50 | return time;
51 | }
52 | else
53 | {
54 | return DateTime.MinValue;
55 | }
56 | }
57 | set
58 | {
59 | DateTimePickerMessages.DateTime_SetSystemtime(this.Handle, value);
60 | }
61 | }
62 | protected virtual void OnChange()
63 | {
64 | SafeInvoke(this.Change , EventArgs.Empty);
65 | }
66 | protected virtual void OnKillFocus()
67 | {
68 | SafeInvoke(this.KillFocus, EventArgs.Empty);
69 | }
70 | protected virtual void OnSetFocus()
71 | {
72 | SafeInvoke(this.SetFocus, EventArgs.Empty);
73 | }
74 | }
75 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeGroupBox.cs:
--------------------------------------------------------------------------------
1 | using Diga.Core.Api.Win32;
2 |
3 | namespace CoreWindowsWrapper
4 | {
5 | public class NativeGroupBox : NativeControlBase
6 | {
7 | protected override void Initialize()
8 | {
9 | base.Initialize();
10 | this.ControlType = Win32ApiForm.ControlType.GroupBox;
11 | this.TypeIdentifier = "button";
12 | this.Style = this.Style | ButtonStyles.BS_GROUPBOX;
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeImageList.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Diga.Core.Api.Win32;
3 | namespace CoreWindowsWrapper
4 | {
5 | public class NativeImageList : NativeNoCreateControlBase
6 | {
7 | public new IntPtr Handle { get; private set; }
8 | public override bool Create(IntPtr parentHandle)
9 | {
10 | return base.Create(parentHandle);
11 |
12 | }
13 | protected override void Initialize()
14 | {
15 | base.Initialize();
16 | this.ControlType = Win32ApiForm.ControlType.ImageList;
17 | this.Handle = ComCtl32.ImageList_Create(16, 16, ImageListConst.ILC_MASK, 1, 0);
18 | }
19 | public int ImageCount
20 | {
21 | get
22 | {
23 | return ComCtl32.ImageList_GetImageCount(this.Handle);
24 | }
25 | set
26 | {
27 | ComCtl32.ImageList_SetImageCount(this.Handle, (uint)value);
28 | }
29 | }
30 | public int AddIcon(IntPtr hIcon)
31 | {
32 | return ComCtl32.ImageList_AddIcon(this.Handle, hIcon);
33 | }
34 | public int AddIconRes(int resId)
35 | {
36 | IntPtr ico = ResourceLoader.Loader.LoadIcon(resId);
37 | return ComCtl32.ImageList_AddIcon(this.Handle, ico);
38 | }
39 | public IntPtr GetIcon(int id, uint flag = ImageListConst.ILD_NORMAL)
40 | {
41 | return ComCtl32.ImageList_GetIcon(this.Handle, id, flag);
42 | }
43 |
44 | public new int BackColor
45 | {
46 | get
47 | {
48 | return (int)ComCtl32.ImageList_GetBkColor(this.Handle) ;
49 | }
50 | set
51 | {
52 |
53 |
54 | ComCtl32.ImageList_SetBkColor(this.Handle,(uint)(IntPtr)value);
55 | }
56 | }
57 |
58 | public int Replace(int index, IntPtr newIcon)
59 | {
60 | return ComCtl32.ImageList_ReplaceIcon(this.Handle, index, newIcon);
61 |
62 | }
63 |
64 | public Size IconSize
65 | {
66 | get
67 | {
68 | ComCtl32.ImageList_GetIconSize(this.Handle , out int x , out int y);
69 | return new Size(x , y);
70 | }
71 | set
72 | {
73 | ComCtl32.ImageList_SetIconSize(this.Handle, value.cx , value.cy);
74 | }
75 | }
76 | public Size GetIconSize(int index)
77 | {
78 | ComCtl32.ImageList_GetIconSize(this.Handle, out int x , out int y);
79 | return new Size(x, y);
80 | }
81 |
82 | public bool Remove(int index)
83 | {
84 | return ComCtl32.ImageList_Remove(this.Handle, index);
85 | }
86 |
87 | public override void Destroy()
88 | {
89 | base.Destroy();
90 | if (this.Handle != IntPtr.Zero)
91 | {
92 | ComCtl32.ImageList_Destroy(this.Handle);
93 | }
94 |
95 | }
96 |
97 | }
98 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeIpAddressEdit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Diagnostics;
4 | using System.Runtime.InteropServices;
5 | using Diga.Core.Api.Win32;
6 | using Diga.Core.Api.Win32.Tools;
7 |
8 | namespace CoreWindowsWrapper
9 | {
10 | public class NativeIpAddressEdit : NativeControlBase
11 | {
12 | private const uint IPM_CLEARADDRESS = (WindowsMessages.WM_USER + 100);
13 | private const uint IPM_SETADDRESS = (WindowsMessages.WM_USER + 101);
14 | private const uint IPM_GETADDRESS = (WindowsMessages.WM_USER + 102);
15 | private const uint IPM_SETRANGE = (WindowsMessages.WM_USER + 103);
16 | private const uint IPM_SETFOCUS = (WindowsMessages.WM_USER + 104);
17 | private const uint IPM_ISBLANK = (WindowsMessages.WM_USER + 105);
18 | protected override void Initialize()
19 | {
20 | base.Initialize();
21 | this.TypeIdentifier = "SysIPAddress32";
22 | ((IControl) this).ClientEdge = true;
23 | }
24 |
25 | private IntPtr MakeIpAddress(byte b1, byte b2, byte b3, byte b4)
26 | {
27 | uint a = (uint) b1 << 24;
28 | uint b = (uint) b2 << 16;
29 | uint c = (uint) b3 << 8;
30 | uint d = b4;
31 | uint e = a + b + c + d;
32 | return (IntPtr) e;
33 |
34 | }
35 |
36 | private IntPtr MakeRange(byte low, byte high)
37 | {
38 | uint a =(uint) high << 8 ;
39 | uint b = low;
40 | uint c = a + b;
41 | return (IntPtr) c;
42 | }
43 |
44 | private byte GetIp1(uint input)
45 | {
46 | uint a = input >> 24& 0xff;
47 | return (byte)a;
48 | }
49 |
50 | private byte GetIp2(uint input)
51 | {
52 | uint b = input >> 16& 0xff;
53 | return (byte)b;
54 | }
55 |
56 | private byte GetIp3(uint input)
57 | {
58 | uint c = input >> 8& 0xff;
59 | return (byte)c;
60 | }
61 |
62 | private byte GetIp4(uint input)
63 | {
64 | uint d = input & 0xff;
65 | return (byte) d;
66 | }
67 |
68 | public void GetAddress(out byte b1, out byte b2, out byte b3, out byte b4)
69 | {
70 | b1 = 0;
71 | b2 = 0;
72 | b3 = 0;
73 | b4 = 0;
74 | IntPtr ptr = Marshal.AllocHGlobal(sizeof(uint));
75 | var r = User32.SendMessage(this.Handle, IPM_GETADDRESS, IntPtr.Zero, ptr);
76 | ByteReader br = new ByteReader(ptr);
77 | uint val = br.GetNextDWordAsUint();
78 | Marshal.FreeHGlobal(ptr);
79 |
80 | b1 = GetIp1(val);
81 | b2 = GetIp2(val);
82 | b3 = GetIp3(val);
83 | b4 = GetIp4(val);
84 |
85 | }
86 | public void SetAddress(byte b1, byte b2, byte b3, byte b4)
87 | {
88 | IntPtr lParam = MakeIpAddress(b1, b2, b3, b4);
89 | User32.SendMessage(this.Handle, IPM_SETADDRESS, IntPtr.Zero, lParam);
90 |
91 | }
92 |
93 | public void SetFocus()
94 | {
95 |
96 | }
97 | public bool SetRange(int fieldIndex, byte low, byte high)
98 | {
99 | IntPtr lParam = MakeRange(low, high);
100 | var retVal = User32.SendMessage(this.Handle, (int) IPM_SETRANGE, fieldIndex, lParam);
101 | if (retVal.ToInt32() == 0)
102 | {
103 | Win32Exception ex = new Win32Exception(Marshal.GetLastWin32Error());
104 | Debug.Print((ex.Message));
105 | return false;
106 | }
107 |
108 | return true;
109 | }
110 | }
111 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeKeyEventArgs.cs:
--------------------------------------------------------------------------------
1 | using Diga.Core.Api.Win32;
2 | using System;
3 | using System.Runtime.InteropServices;
4 |
5 | namespace CoreWindowsWrapper
6 | {
7 | public class NativeKeyEventArgs : EventArgs
8 | {
9 | private const int KF_EXTENDED = 0x0100;
10 | private const int KF_DLGMODE = 0x0800;
11 | private const int KF_MENUMODE = 0x1000;
12 | private const int KF_ALTDOWN = 0x2000;
13 | private const int KF_REPEAT = 0x4000;
14 | private const int KF_UP = 0x8000;
15 | private const uint MAPVK_VK_TO_VSC = 0;
16 | private const uint MAPVK_VSC_TO_VK = 1;
17 | private const uint MAPVK_VK_TO_CHAR = 2;
18 | private const uint MAPVK_VSC_TO_VK_EX = 3;
19 | private const uint MAPVK_VK_TO_VSC_EX = 4;
20 | [DllImport("user32.dll", EntryPoint="MapVirtualKeyW")]
21 | public static extern uint MapVirtualKeyW(uint uCode, uint uMapType) ;
22 |
23 | public uint Key { get; }
24 | public int VirtalKey { get; }
25 | public int ScanCode { get; }
26 | public bool ScanCodeE0 { get; }
27 | public bool IsUp { get; }
28 | public bool IsRepeat { get; }
29 | public int RepeatCount { get; }
30 | public bool IsAlt { get; }
31 | public bool IsDlgMode { get; }
32 | public bool IsMenuMode { get; }
33 | public bool Handled { get; set; }
34 | public IntPtr ResturnCode { get; set; } = IntPtr.Zero;
35 | internal NativeKeyEventArgs(IntPtr wParam, IntPtr lParam)
36 | {
37 | this.Handled = false;
38 | var wParamHiLow = Win32Api.MakeHiLo(wParam);
39 |
40 | var vkKey = wParamHiLow.iLow;
41 | this.VirtalKey = vkKey;
42 | this.Key = Win32Api.GetIntPtrUInt(wParam);
43 | var lParamHiLow = Win32Api.MakeHiLo(lParam);
44 |
45 | var hiWord = (ushort)lParamHiLow.iHigh;
46 | var loWord = (ushort)lParamHiLow.iLow;
47 |
48 | byte scanCode = Win32Api.LoByte((ushort)hiWord);
49 | ApiBool scanCodeE0 = (hiWord & KF_EXTENDED) == KF_EXTENDED;
50 | ApiBool upFlag = (hiWord & KF_UP) == KF_UP;
51 | ApiBool repeatFlag = (hiWord & KF_REPEAT) == KF_REPEAT;
52 | ushort repeatCount = (ushort)loWord;
53 | ApiBool altDownFalg = (hiWord & KF_ALTDOWN) == KF_ALTDOWN;
54 | ApiBool dlgModeFalg = (hiWord & KF_DLGMODE) == KF_DLGMODE;
55 | ApiBool menuModeFlag = (hiWord & KF_MENUMODE) == KF_MENUMODE;
56 | switch ((uint)vkKey)
57 | {
58 | case VirtualKeys.VK_SHIFT:
59 | case VirtualKeys.VK_CONTROL:
60 | case VirtualKeys.VK_MENU:
61 | this.VirtalKey = Win32Api.LoWord(MapVirtualKeyW(scanCode, MAPVK_VSC_TO_VK_EX));
62 | break;
63 | }
64 | this.ScanCode = scanCode;
65 | this.ScanCodeE0 = scanCodeE0;
66 | this.IsUp = upFlag;
67 | this.IsRepeat = repeatFlag;
68 | this.RepeatCount = repeatCount;
69 | this.IsAlt = altDownFalg;
70 | this.IsDlgMode = dlgModeFalg;
71 | this.IsMenuMode = menuModeFlag;
72 |
73 |
74 |
75 | }
76 | }
77 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeLabel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Diga.Core.Api.Win32;
3 |
4 | namespace CoreWindowsWrapper
5 | {
6 | public class NativeLabel : NativeControlBase
7 | {
8 |
9 |
10 | protected override void Initialize()
11 | {
12 | base.Initialize();
13 | this.ControlType = Win32ApiForm.ControlType.Label;
14 | this.TypeIdentifier = "static";
15 | this.Style = WindowStylesConst.WS_VISIBLE | WindowStylesConst.WS_CHILD | StaticControlStyles.SS_NOTIFY;
16 | this.BackColor = Tools.ColorTool.White;
17 | this.ForeColor = Tools.ColorTool.Black;
18 |
19 | }
20 |
21 | public override string Text
22 | {
23 | get => User32.GetWindowTextRaw(this.Handle);
24 | set
25 | {
26 | base.Text = value;
27 | User32.SetWindowTextsRaw(this.Handle, value);
28 |
29 | }
30 | }
31 |
32 | protected override bool ControlProc(IntPtr hWndParent, IntPtr hWndControl, int controlId, uint command, IntPtr wParam, IntPtr lParam)
33 | {
34 | bool handled = false;
35 | switch (command)
36 | {
37 | case StaticControlMessages.STN_DBLCLK:
38 |
39 | OnDblClicked();
40 | handled = true;
41 | break;
42 | case StaticControlMessages.STN_CLICKED:
43 | OnClicked();
44 | handled = true;
45 | break;
46 |
47 |
48 | }
49 |
50 | return handled;
51 | }
52 |
53 |
54 | }
55 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeLink.cs:
--------------------------------------------------------------------------------
1 | using Diga.Core.Api.Win32;
2 | using System;
3 | using System.Runtime.InteropServices;
4 |
5 | namespace CoreWindowsWrapper
6 | {
7 | public class NativeLink : NativeControlBase
8 | {
9 |
10 | public event EventHandler LinkClicked;
11 | protected override void Initialize()
12 | {
13 | base.Initialize();
14 | this.ControlType = Win32ApiForm.ControlType.Link;
15 | this.TypeIdentifier = "SysLink";
16 | this.CommonControlType = CommonControls.ICC_LINK_CLASS;
17 |
18 |
19 | }
20 |
21 | protected override bool ControlProc(IntPtr hWndParent, IntPtr hWndControl, int controlId, uint command, IntPtr wParam, IntPtr lParam)
22 | {
23 | bool handled = false;
24 | switch (command)
25 | {
26 | case NotifyMessageConst.NM_CLICK:
27 | NmlInk link = Marshal.PtrToStructure(lParam);
28 | if (link != null)
29 | {
30 | if (link.item != null)
31 | {
32 | string id = link.item.szID;
33 | string linkUrl = link.item.szUrl;
34 | string linUlr = linkUrl;
35 | OnLinkClicked(new NativeLinkClickEventArgs(id, linUlr));
36 | }
37 | }
38 | handled = true;
39 | break;
40 |
41 | }
42 |
43 | return handled;
44 | }
45 |
46 | protected virtual void OnLinkClicked(NativeLinkClickEventArgs e)
47 | {
48 | SafeInvoke(this.LinkClicked, e);
49 |
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeLinkClickEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CoreWindowsWrapper
4 | {
5 | public class NativeLinkClickEventArgs : EventArgs
6 | {
7 | public string Id { get;set; }
8 | public string Url{get;set;}
9 |
10 | public NativeLinkClickEventArgs(string id , string url)
11 | {
12 | this.Id = id;
13 | this.Url = url;
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeMenu.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Text;
5 | using Diga.Core.Api.Win32;
6 |
7 | namespace CoreWindowsWrapper
8 | {
9 | public class NativeMenu : IMenuItem
10 | {
11 | internal int Id { get => ((IMenuItem)this).Id; set => ((IMenuItem)this).Id = value; }
12 | public IntPtr Handle { get; set; }
13 | public string Name { get; set; }
14 | public string Text { get; set; }
15 | internal IntPtr ParentMenuHandle { get => ((IMenuItem)this).ParentMenuHandle; set => ((IMenuItem)this).ParentMenuHandle = value; }
16 | int IMenuItem.Id { get; set; }
17 | IntPtr IMenuItem.ParentMenuHandle { get; set; }
18 | public MenuItemCollection Items { get; internal set; } = new MenuItemCollection();
19 |
20 | public NativeMenu()
21 | {
22 | Win32ApiForm.Win32Control.LastControlId = Win32ApiForm.Win32Control.LastControlId + 1;
23 | this.Id = Win32ApiForm.Win32Control.LastControlId;
24 | this.Text = "";
25 | this.Name = "";
26 | }
27 |
28 | public NativeMenu(string name, string text) : this()
29 | {
30 | this.Text = text;
31 | this.Name = name;
32 | }
33 |
34 | public NativeMenu(string text) : this(text, text)
35 | { }
36 |
37 | public void Create()
38 | {
39 | Create(IntPtr.Zero);
40 | }
41 | public virtual void Create(IntPtr parentMenuHandle)
42 | {
43 | this.ParentMenuHandle = parentMenuHandle;
44 | this.Handle = User32.CreateMenu();
45 | if (this.ParentMenuHandle == IntPtr.Zero)
46 | {
47 | this.ParentMenuHandle = User32.CreateMenu();
48 | }
49 |
50 |
51 | User32.AppendMenu(this.ParentMenuHandle, MenuStyles.MF_STRING | MenuStyles.MF_POPUP, (uint)this.Handle, this.Text);
52 | foreach (IMenuItem itemsValue in this.Items.Values)
53 | {
54 | if (itemsValue is NativeMenu)
55 | {
56 | itemsValue.Create(this.ParentMenuHandle);
57 | }
58 | else
59 | {
60 | itemsValue.Create(this.Handle);
61 | }
62 |
63 |
64 |
65 | }
66 | NativeTheaming.SetThemaing(this.Handle);
67 | }
68 | protected virtual bool ControlProc(IntPtr hWndParent, IntPtr hWndControl, int controlId, uint command,
69 | IntPtr wParam, IntPtr lParam)
70 | {
71 | return false;
72 | }
73 | public bool HandleEvents(IntPtr hWndParent, IntPtr hWndControl, int controlId, uint command, IntPtr wParam, IntPtr lParam)
74 | {
75 | return ControlProc(hWndParent, hWndControl, controlId, command, wParam, lParam);
76 | }
77 |
78 |
79 | public virtual void Destroy()
80 | {
81 | //
82 | bool retVAl = User32.DestroyMenu(this.Handle);
83 | if (retVAl == false)
84 | {
85 | Debug.Print("Menu destroy=> false");
86 | }
87 | else
88 | {
89 | Debug.Print("Menu destroy=>OK");
90 | }
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeMenuItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Diga.Core.Api.Win32;
3 |
4 | namespace CoreWindowsWrapper
5 | {
6 | public class NativeMenuItem : IMenuItem
7 | {
8 |
9 | public event EventHandler Click;
10 | internal int Id { get => ((IMenuItem)this).Id; set => ((IMenuItem)this).Id = value; }
11 | public IntPtr Handle { get; set; }
12 | public string Name { get; set; }
13 | public string Text { get; set; }
14 | public bool IsSeparator{get;set;}
15 | internal IntPtr ParentMenuHandle { get => ((IMenuItem)this).ParentMenuHandle; set => ((IMenuItem)this).ParentMenuHandle = value; }
16 | int IMenuItem.Id { get; set; }
17 | IntPtr IMenuItem.ParentMenuHandle { get; set; }
18 | public MenuItemCollection Items { get; internal set; } = new MenuItemCollection();
19 |
20 | public NativeMenuItem()
21 | {
22 | Win32ApiForm.Win32Control.LastControlId = Win32ApiForm.Win32Control.LastControlId + 1;
23 | this.Id = Win32ApiForm.Win32Control.LastControlId;
24 | this.Text = "";
25 | this.Name = "";
26 | }
27 |
28 |
29 | public NativeMenuItem(string name, string text ):this()
30 | {
31 | this.Name = name;
32 | this.Text = text;
33 | }
34 |
35 | public NativeMenuItem(string text) : this(text, text)
36 | {
37 |
38 | }
39 | public virtual void Create(IntPtr parentMenuHandle)
40 | {
41 | uint flag = MenuStyles.MF_STRING;
42 | if (this.IsSeparator)
43 | flag = MenuStyles.MF_SEPARATOR;
44 | this.ParentMenuHandle = parentMenuHandle;
45 | if (this.ParentMenuHandle == IntPtr.Zero)
46 | {
47 | this.Handle = User32.CreateMenu();
48 |
49 | User32.AppendMenu(this.Handle, flag, (uint) this.Id, this.Text);
50 | foreach (IMenuItem subItemns in this.Items.Values)
51 | {
52 | subItemns.Create(this.Handle);
53 | }
54 |
55 | }
56 | else
57 | {
58 | User32.AppendMenu(this.ParentMenuHandle,flag, (uint) this.Id, this.Text);
59 | foreach (IMenuItem subItems in this.Items.Values)
60 | {
61 | subItems.Create(this.ParentMenuHandle);
62 | }
63 |
64 | }
65 |
66 |
67 | }
68 |
69 | protected virtual bool ControlProc(IntPtr hWndParent, IntPtr hWndControl, int controlId, uint command,
70 | IntPtr wParam, IntPtr lParam)
71 | {
72 |
73 | OnClick(new MouseClickEventArgs(MouseButton.Left, hWndControl));
74 |
75 | return true;
76 | }
77 | public bool HandleEvents(IntPtr hWndParent, IntPtr hWndControl, int controlId, uint command, IntPtr wParam, IntPtr lParam)
78 | {
79 | return ControlProc(hWndParent, hWndControl, controlId, command, wParam, lParam);
80 | }
81 |
82 |
83 | public virtual void Destroy()
84 | {
85 |
86 | }
87 | protected void SafeInvoke(EventHandler eventHandler, T ars) where T:EventArgs
88 | {
89 | try
90 | {
91 | eventHandler?.Invoke(this, ars);
92 | }
93 | catch (Exception e)
94 | {
95 | MessageBox.Show("Event Error:" + e.Message);
96 | }
97 | }
98 |
99 | protected virtual void OnClick(MouseClickEventArgs e)
100 | {
101 | SafeInvoke(Click, e);
102 |
103 |
104 | }
105 | }
106 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeMultiLineTextBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Diga.Core.Api.Win32;
3 |
4 | namespace CoreWindowsWrapper
5 | {
6 | public class NativeMultiLineTextBox : NativeTextBox
7 | {
8 | protected override void Initialize()
9 | {
10 | base.Initialize();
11 | this.ControlType = Win32ApiForm.ControlType.Edit;
12 | this.Style = this.Style | EditBoxStyles.ES_MULTILINE | WindowStylesConst.WS_HSCROLL | WindowStylesConst.WS_VSCROLL | WindowStylesConst.WS_VISIBLE;
13 | this.BackColor = Tools.ColorTool.White;
14 | this.ForeColor = Tools.ColorTool.Black;
15 | this.Font = new Font() { Name = "Arial", Size = 10 };
16 | }
17 |
18 | public override bool Create(IntPtr parentId)
19 | {
20 | bool retVal= base.Create(parentId);
21 | User32.SendMessage(this.Handle, EditBoxMessages.EM_SETLIMITTEXT, 0, int.MaxValue);
22 | return retVal;
23 |
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeNoCreateControlBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using CoreWindowsWrapper.Win32ApiForm;
3 |
4 | namespace CoreWindowsWrapper
5 | {
6 | public class NativeNoCreateControlBase:NativeControlBase
7 | {
8 | protected override void Initialize()
9 | {
10 | this.Control = new Win32NoCreateControl();
11 | }
12 |
13 | public override bool Create(IntPtr parentHandle)
14 | {
15 | this.ParentHandle = parentHandle;
16 | return true;
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativePanel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Diga.Core.Api.Win32;
3 |
4 | namespace CoreWindowsWrapper
5 | {
6 | public class NativePanel : NativeWindow
7 | {
8 | public new DockType DockType
9 | {
10 | get
11 | {
12 | return base.DockType;
13 | }
14 | set
15 | {
16 | base.DockType = value;
17 | }
18 | }
19 | protected override void OnBeforeCreate(BeforeWindowCreateEventArgs e)
20 | {
21 | this.IsPanel = true;
22 | e.Styles.Style = WindowStylesConst.WS_VISIBLE | WindowStylesConst.WS_CHILD | WindowStylesConst.WS_TABSTOP;
23 | e.Styles.StyleEx = WindowStylesConst.WS_EX_CONTROLPARENT;
24 | }
25 |
26 | public void DoDock()
27 | {
28 | if (InDock) return;
29 | if (this.ParentHandle == IntPtr.Zero)
30 | return;
31 | if (this.DockType == DockType.None)
32 | return;
33 | InDock = true;
34 | int restTop = 0;
35 | int restBottom = 0;
36 | int restLeft = 0;
37 | int restRight = 0;
38 | if (NativeWindow.TryGetWindow(this.ParentHandle, out NativeWindow nw))
39 | {
40 | if (nw.IsPanel)
41 | {
42 |
43 |
44 | foreach (var item in nw.Controls)
45 | {
46 | if(item.Value is NativePanel panel)
47 | {
48 | if (panel.Handle == this.Handle)
49 | {
50 | break;
51 | }
52 |
53 | if (panel.DockType != DockType.None)
54 | {
55 | switch (panel.DockType)
56 | {
57 | case DockType.Top:
58 | restTop += panel.Height;
59 | break;
60 | case DockType.Left:
61 | restLeft += panel.Width;
62 | break;
63 | case DockType.Right:
64 | restRight += panel.Width;
65 | break;
66 | case DockType.Bottom:
67 | restBottom += panel.Height;
68 | break;
69 |
70 | }
71 | }
72 | }
73 |
74 | }
75 | }
76 | }
77 | //foreach (var item in this.Controls)
78 | //{
79 | // if (item.Value is NativePanel panel)
80 | // {
81 | // if (panel.Height == 0 || panel.Width == 0)
82 | // {
83 | // break;
84 | // }
85 |
86 | // if (panel.DockType != DockType.None)
87 | // {
88 | // switch (panel.DockType)
89 | // {
90 | // case DockType.Top:
91 | // restTop += panel.Height;
92 | // break;
93 | // case DockType.Left:
94 | // restLeft += panel.Width;
95 | // break;
96 | // case DockType.Right:
97 | // restRight += panel.Width;
98 | // break;
99 | // case DockType.Bottom:
100 | // restBottom += panel.Height;
101 | // break;
102 | // }
103 | // }
104 |
105 |
106 | // }
107 | //}
108 | User32.GetClientRect(this.ParentHandle, out Rect rect);
109 | switch (this.DockType)
110 | {
111 | case DockType.Top:
112 | this.Top = restTop;
113 | this.Left = restLeft;
114 | this.Width = rect.Width - restLeft - restRight;
115 | break;
116 | case DockType.Bottom:
117 | this.Left = restLeft;
118 | this.Width = rect.Width - restLeft - restRight;
119 | this.Top = rect.Height - this.Height - restBottom;
120 | break;
121 | case DockType.Left:
122 | this.Top = restTop;
123 | this.Left = restLeft;
124 | this.Height = rect.Height - restTop - restBottom;
125 | break;
126 | case DockType.Right:
127 | this.Left = rect.Width - this.Width - restLeft - restRight;
128 | this.Top = restTop;
129 | this.Height = rect.Height;
130 | break;
131 | case DockType.Fill:
132 | {
133 | int left = restLeft;
134 | int top = restTop;
135 | int height = rect.Height -restTop - restBottom;
136 | int width = rect.Width -restLeft - restRight;
137 |
138 | this.Left = left;
139 | this.Top = top;
140 | this.Height = height;
141 | this.Width = width;
142 |
143 | }
144 | break;
145 | }
146 | InDock = false;
147 | }
148 | private bool InDock = false;
149 | protected override void OnCreate(CreateEventArgs e)
150 | {
151 |
152 | base.OnCreate(e);
153 | DoDock();
154 |
155 | }
156 |
157 | public override void OnParentResize()
158 | {
159 | DoDock();
160 | }
161 | }
162 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeProgress.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Diga.Core.Api.Win32;
3 |
4 | namespace CoreWindowsWrapper
5 | {
6 | public class NativeProgress : NativeControlBase
7 | {
8 | private int _Value;
9 | private int _MaxValue;
10 |
11 | protected override void Initialize()
12 | {
13 | base.Initialize();
14 | this.ControlType = Win32ApiForm.ControlType.Progress;
15 | this.TypeIdentifier = "msctls_progress32";
16 | this.CommonControlType = CommonControls.ICC_PROGRESS_CLASS;
17 | this.Style = this.Style | ProgressBarStyles.PBS_SMOOTH;
18 |
19 | }
20 |
21 | public int MaxValue
22 | {
23 | get
24 | {
25 | if (this.Handle == IntPtr.Zero)
26 | {
27 | return this._MaxValue;
28 | }
29 | else
30 | {
31 | int lP = Win32Api.LoWord(1);
32 | User32.SendMessage(this.Handle, (int) ProgressBarMessages.PBM_GETRANGE,lP, out var hiLow);
33 |
34 |
35 |
36 | this._MaxValue = Win32Api.LoWord((int)hiLow.iHigh);
37 | return this._MaxValue;
38 | }
39 | }
40 | set
41 | {
42 | this._MaxValue = value;
43 | HighLow hiLow = new HighLow {iHigh =this.MaxValue, iLow = 0};
44 | User32.SendMessage(this.Handle, (int) ProgressBarMessages.PBM_SETRANGE, 0, hiLow);
45 |
46 | }
47 | }
48 | public int Value
49 | {
50 | get
51 | {
52 | if (this.Handle == IntPtr.Zero)
53 | {
54 | return this._Value;
55 | }
56 | else
57 | {
58 |
59 | IntPtr v = User32.SendMessage(this.Handle, (int) ProgressBarMessages.PBM_GETPOS, 0,
60 | IntPtr.Zero);
61 | this._Value = (int) v;
62 | return this._Value;
63 | }
64 | }
65 | set
66 | {
67 | this._Value = value;
68 | User32.SendMessage(this.Handle, (int) ProgressBarMessages.PBM_SETPOS, value, IntPtr.Zero);
69 |
70 | }
71 | }
72 | }
73 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeTextBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.CodeDom;
3 | using System.Diagnostics;
4 | using Diga.Core.Api.Win32;
5 |
6 | namespace CoreWindowsWrapper
7 | {
8 | public class NativeTextBox : NativeControlBase
9 | {
10 | private const uint ECM_FIRST = 0x1500;
11 | private const uint EM_SETEXTENDEDSTYLE = ECM_FIRST + 10;
12 | private const uint ES_EX_ALLOWEOL_CR = 0x0001;
13 | private const uint ES_EX_ALLOWEOL_LF = 0x0002;
14 | private const uint ES_EX_ALLOWEOL_ALL = (ES_EX_ALLOWEOL_CR | ES_EX_ALLOWEOL_LF);
15 | private const uint ES_EX_CONVERT_EOL_ON_PASTE = 0x0004;
16 | private const uint ES_EX_ZOOMABLE = 0x0010;
17 | public event EventHandler Change;
18 | public event EventHandler SetFocus;
19 | public event EventHandler KillFocus;
20 |
21 | protected override void Initialize()
22 | {
23 | base.Initialize();
24 | this.ControlType = Win32ApiForm.ControlType.Edit;
25 | this.TypeIdentifier = "Edit";
26 | this.Style |= EditBoxStyles.ES_AUTOHSCROLL | EditBoxStyles.ES_WANTRETURN | WindowStylesConst.WS_BORDER ;
27 |
28 | this.BackColor = Tools.ColorTool.White;
29 | this.ForeColor = Tools.ColorTool.Black;
30 |
31 | }
32 | protected override void AfterCreate()
33 | {
34 | base.AfterCreate();
35 |
36 | //NativeTheaming.SetThemaing(this.Handle);
37 |
38 | }
39 | public override string Text
40 | {
41 | get => User32.GetWindowTextRaw(this.Handle);
42 | set
43 | {
44 | base.Text = value;
45 | User32.SetWindowTextsRaw(this.Handle, value);
46 |
47 |
48 |
49 | }
50 | }
51 |
52 | public bool IsReadOnly => (this.GetWindowStyle() & EditBoxStyles.ES_READONLY) == EditBoxStyles.ES_READONLY;
53 |
54 | public bool ReadOnly {
55 | get
56 | {
57 | return this.IsReadOnly;
58 | }
59 | set
60 | {
61 | if(value == true )
62 | {
63 | User32.SendMessage(this.Handle, EditBoxMessages.EM_SETREADONLY, 1, 0);
64 | }
65 | else
66 | {
67 | User32.SendMessage(this.Handle, EditBoxMessages.EM_SETREADONLY, 0, 0);
68 | }
69 |
70 | }
71 | }
72 |
73 | protected override bool ControlProc(IntPtr hWndParent, IntPtr hWndControl, int controlId, uint command, IntPtr wParam, IntPtr lParam)
74 | {
75 | bool handled = false;
76 | Debug.Print($"NativeTextBox:0x{command.ToString("x4")}");
77 | switch (command)
78 | {
79 |
80 | case EditBoxMessages.EN_SETFOCUS:
81 | OnSetFocus();
82 | handled = true;
83 | break;
84 | case EditBoxMessages.EN_KILLFOCUS:
85 | OnKillFocus();
86 | handled = true;
87 | break;
88 |
89 | case EditBoxMessages.EN_CHANGE:
90 | OnChange();
91 | handled = true;
92 | break;
93 |
94 |
95 | }
96 |
97 | return handled;
98 |
99 | }
100 | protected override void OnKeyDown(IntPtr hWnd, NativeKeyEventArgs keyEventArgs)
101 | {
102 | if(keyEventArgs.Key == VirtualKeys.VK_TAB)
103 | {
104 | keyEventArgs.Handled = true;
105 | keyEventArgs.ResturnCode = (IntPtr)0x0002;
106 | User32.PostMessage(this.ParentHandle, WindowsMessages.WM_KEYDOWN, (IntPtr)keyEventArgs.Key,(IntPtr)0);
107 | return;
108 | }
109 | base.OnKeyDown(hWnd, keyEventArgs);
110 | }
111 | protected virtual void OnKillFocus()
112 | {
113 | SafeInvoke(this.KillFocus , EventArgs.Empty);
114 | }
115 | protected virtual void OnSetFocus()
116 | {
117 | SafeInvoke(this.SetFocus , EventArgs.Empty);
118 | }
119 | protected virtual void OnChange()
120 | {
121 | //Change?.Invoke(this, EventArgs.Empty);
122 | SafeInvoke(this.Change, EventArgs.Empty);
123 | }
124 | }
125 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeTheaming.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Runtime.InteropServices;
4 | using Diga.Core.Api.Win32;
5 | using Diga.Core.Api.Win32.Com;
6 | using Diga.Core.Api.Win32.Dwm;
7 | namespace CoreWindowsWrapper
8 | {
9 | public enum TheamingBackDropType:int
10 | {
11 | Auto,
12 | None,
13 | MainWindow,
14 | TransientWindow,
15 | TabbedWindow
16 |
17 |
18 | }
19 | public static class NativeTheaming
20 | {
21 | /// Return Type: boolean
22 | ///hWnd: HWND->HWND__*
23 | ///allow: boolean
24 | [UnmanagedFunctionPointer(CallingConvention.StdCall)]
25 | [return: MarshalAs(UnmanagedType.Bool)]
26 | public delegate bool fnAllowDarkModeForWindow(IntPtr hWnd, [MarshalAs(UnmanagedType.I1)] bool allow);
27 |
28 | /// Return Type: PreferredAppMode
29 | ///appMode: PreferredAppMode
30 | [UnmanagedFunctionPointer(CallingConvention.StdCall)]
31 | public delegate int fnSetPreferredAppMode(int appMode);
32 |
33 | /// Return Type: boolean
34 | [UnmanagedFunctionPointer(CallingConvention.StdCall)]
35 | public delegate bool fnShouldAppsUseDarkMode();
36 | public static void InitTheaming()
37 | {
38 | IntPtr hUxTheme = Kernel32.LoadLibraryEx("uxtheme.dll", IntPtr.Zero, LoadLibraryExFlags.LOAD_LIBRARY_SEARCH_SYSTEM32);
39 | if (hUxTheme == IntPtr.Zero)
40 | return;
41 |
42 | IntPtr hProcAddr = Kernel32.GetProcAddress(hUxTheme, Win32Api.MakeInterSource(135));
43 | if (hProcAddr != IntPtr.Zero)
44 | {
45 |
46 |
47 | fnSetPreferredAppMode del = Marshal.GetDelegateForFunctionPointer(hProcAddr);
48 | if (del != null)
49 | del(1);
50 | }
51 | Kernel32.FreeLibrary(hUxTheme);
52 | }
53 |
54 | public static void SetWindowBackDrop(IntPtr hWnd, TheamingBackDropType backDropType)
55 | {
56 | using (var p = new ApiStructHandleRef((int)backDropType))
57 | {
58 |
59 | int r = DwmApi.DwmSetWindowAttribute(hWnd, (uint)38, p, (uint)Marshal.SizeOf());
60 | if (r != 0)
61 | {
62 | var ex = Marshal.GetExceptionForHR(r);
63 | if (ex != null)
64 | {
65 | Debug.Print(ex.Message);
66 | }
67 | }
68 | //int v = p.GetStruct();
69 |
70 | }
71 |
72 | }
73 | public static bool SetTheme(IntPtr hWnd, string themeName, string subThemeName = null)
74 | {
75 | HRESULT hr = UxTheme.SetWindowTheme(hWnd, themeName, subThemeName);
76 | if(hr != 0)
77 | {
78 | var ex = Marshal.GetExceptionForHR(hr);
79 | if (ex != null)
80 | {
81 | Debug.Print(ex.Message);
82 | }
83 | return false;
84 | }
85 | return true;
86 | }
87 | public static void SetThemaing(IntPtr hWnd)
88 | {
89 | IntPtr hUxTheme = Kernel32.LoadLibraryEx("uxtheme.dll", IntPtr.Zero, LoadLibraryExFlags.LOAD_LIBRARY_SEARCH_SYSTEM32);
90 | if (hUxTheme == IntPtr.Zero)
91 | return;
92 |
93 | IntPtr hProcAddr = Kernel32.GetProcAddress(hUxTheme, Win32Api.MakeInterSource(133));
94 | if (hProcAddr != IntPtr.Zero)
95 | {
96 | fnAllowDarkModeForWindow del = Marshal.GetDelegateForFunctionPointer(hProcAddr);
97 | if (del != null)
98 | {
99 | UxTheme.SetWindowTheme(hWnd, "Explorer", null);
100 | del(hWnd, true);
101 | User32.SendMessage(hWnd, WindowsMessages.WM_THEMECHANGED, 0, 0);
102 | }
103 | }
104 | Kernel32.FreeLibrary(hUxTheme);
105 | }
106 | }
107 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeTimer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Diga.Core.Api.Win32;
3 | using Diga.Core.Api.Win32.GDI;
4 | namespace CoreWindowsWrapper
5 | {
6 | public class NativeTimer : NativeNoCreateControlBase
7 | {
8 | public int Interval { get; set; }
9 | public event EventHandler Tick;
10 | protected override void Initialize()
11 | {
12 | base.Initialize();
13 | this.ControlType = Win32ApiForm.ControlType.Timer;
14 |
15 | }
16 |
17 | public void StartTimer()
18 | {
19 | //First check if there is a parent Window
20 | if (this.ParentHandle == IntPtr.Zero)
21 | throw new InvalidOperationException("You cannot start Timer before main Window created!");
22 | //timer Proc is disabled
23 | //Uses Windows Message insted!
24 | //TimerProc proc = OnTimerProc;
25 | UIntPtr id = (UIntPtr)this.ControlId;
26 | uint intVal = System.Convert.ToUInt32(this.Interval);
27 | if (this.Interval > 0)
28 | {
29 | User32.SetTimer(this.ParentHandle, id, intVal, null);
30 | }
31 |
32 | }
33 |
34 | private void OnTimerProc(IntPtr param0, uint param1, IntPtr param2, uint param3)
35 | {
36 | OnTick();
37 | }
38 |
39 | protected virtual void OnTick()
40 | {
41 | //this.Tick?.Invoke(this,new EventArgs());
42 | SafeInvoke(this.Tick, EventArgs.Empty);
43 | }
44 | protected override bool ControlProc(IntPtr hWndParent, IntPtr hWndControl, int controlId, uint command, IntPtr wParam, IntPtr lParam)
45 | {
46 | switch(command)
47 | {
48 | case WindowsMessages.WM_TIMER:
49 | OnTick();
50 | return true;
51 | }
52 | return base.ControlProc(hWndParent, hWndControl, controlId, command, wParam, lParam);
53 | }
54 | public void StopTimer()
55 | {
56 |
57 | UIntPtr id = (UIntPtr)this.ControlId;
58 | User32.KillTimer(this.ParentHandle, id);
59 | }
60 |
61 | public override void Destroy()
62 | {
63 | base.Destroy();
64 | StopTimer();
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/NativeUserControl.cs:
--------------------------------------------------------------------------------
1 | using Diga.Core.Api.Win32;
2 |
3 | namespace CoreWindowsWrapper
4 | {
5 | public class NativeUserControl : NativeWindow
6 | {
7 | protected override void OnBeforeCreate(BeforeWindowCreateEventArgs e)
8 | {
9 |
10 | e.Styles.Style = WindowStylesConst.WS_VISIBLE | WindowStylesConst.WS_CHILD | WindowStylesConst.WS_TABSTOP;
11 | e.Styles.StyleEx = WindowStylesConst.WS_EX_CONTROLPARENT;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/OpenFileDialog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Runtime.InteropServices;
4 | using System.Text;
5 | using Diga.Core.Api.Win32;
6 | namespace CoreWindowsWrapper
7 | {
8 | public class OpenFileDialog
9 | {
10 | private OfNw _OfNw;
11 |
12 | public OpenFileDialog()
13 | {
14 | this._OfNw = new OfNw {hInstance = Process.GetCurrentProcess().Handle};
15 | this._OfNw.lStructSize = (uint) Marshal.SizeOf(this._OfNw);
16 | this._OfNw.lpstrFilter = "All Files\0*.*\0";
17 | this._OfNw.lpstrFile = new string(new char[257]);
18 | this._OfNw.nMaxFile = (uint) this._OfNw.lpstrFile.Length;
19 | this._OfNw.lpstrFileTitle = new string(new char[65]);
20 | this._OfNw.nMaxFileTitle = (uint) this._OfNw.lpstrFileTitle.Length;
21 | this._OfNw.lpstrInitialDir = "C:\\";
22 | this._OfNw.lpstrTitle = "Open File...";
23 | this._OfNw.lpstrDefExt = "*";
24 |
25 | }
26 |
27 | public bool Show(IControl parent = null)
28 | {
29 | if (parent != null)
30 | this._OfNw.hwndOwner = parent.Handle;
31 | return ComDlg32.GetOpenFileName(ref this._OfNw);
32 |
33 | }
34 |
35 | public int DefaultFilterIndex
36 | {
37 | get => (int)this._OfNw.nFilterIndex;
38 | set => this._OfNw.nFilterIndex = (uint)value;
39 | }
40 | public string File
41 | {
42 | get => this._OfNw.lpstrFile;
43 | }
44 |
45 | public string InitialDir
46 | {
47 | get => this._OfNw.lpstrInitialDir;
48 | set => this._OfNw.lpstrInitialDir = value;
49 | }
50 |
51 | public string DefaultExtension
52 | {
53 | get => this._OfNw.lpstrDefExt;
54 | set => this._OfNw.lpstrDefExt = value;
55 | }
56 | public string Title
57 | {
58 | get => this._OfNw.lpstrTitle;
59 | set => this._OfNw.lpstrTitle = value;
60 | }
61 |
62 | public string Filter
63 | {
64 | get => this._OfNw.lpstrFilter;
65 | set => this._OfNw.lpstrFilter = value;
66 | }
67 |
68 |
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/OpenFolderDialog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.Text;
4 | using Diga.Core.Api.Win32;
5 | namespace CoreWindowsWrapper
6 | {
7 | public class OpenFolderDialog
8 | {
9 | private IntPtr _ParentHandle;
10 | private string _InitFolder;
11 | public string Caption { get; set; }
12 | public string SelectedPath { get; set; }
13 | public string InitialPath { get => this._InitFolder; set => this._InitFolder = value; }
14 | public OpenFolderDialog()
15 | {
16 | this._ParentHandle = IntPtr.Zero;
17 | this.Caption = "Selec a Folder";
18 |
19 | }
20 | private int OnBffCallByck(IntPtr hwnd, uint msg, IntPtr lp, IntPtr wp)
21 | {
22 | switch (msg)
23 | {
24 | case BrowseForFolderConst.BFFM_INITIALIZED:
25 | User32.SendMessage(hwnd, (int)BrowseForFolderConst.BFFM_SETSELECTIONW, 1, _InitFolder);
26 | break;
27 | case BrowseForFolderConst.BFFM_SELCHANGED:
28 | StringBuilder sb = new StringBuilder(256);
29 | if (Shell32.SHGetPathFromIDList(lp, sb))
30 | {
31 | User32.SendMessage(hwnd, (int)BrowseForFolderConst.BFFM_SETSTATUSTEXTW, 0, sb);
32 | }
33 | break;
34 | }
35 | return 0;
36 | }
37 |
38 |
39 | public bool Show(IControl control = null)
40 | {
41 | if (control != null)
42 | this._ParentHandle = control.Handle;
43 |
44 |
45 | BrowseInfo bf = new BrowseInfo();
46 | bf.hwndOwner = this._ParentHandle;
47 | bf.pidlRoot = IntPtr.Zero;
48 | bf.lpszTitle = this.Caption;
49 | bf.ulFlags = BrowseForFolderConst.BIF_NEWDIALOGSTYLE | BrowseForFolderConst.BIF_SHAREABLE;
50 | bf.lpfn = new BrowseCallBackProc(OnBffCallByck);
51 | bf.lParam = IntPtr.Zero;
52 | bf.iImage = 0;
53 | IntPtr pidl = IntPtr.Zero;
54 | try
55 | {
56 | StringBuilder sb = new StringBuilder(256);
57 | pidl = Shell32.SHBrowseForFolder(ref bf);
58 | if (pidl == IntPtr.Zero)
59 | return false;
60 |
61 | bool retVal = Shell32.SHGetPathFromIDList(pidl, sb);
62 | if(retVal)
63 | {
64 | this.SelectedPath = sb.ToString();
65 | return true;
66 | }
67 | return false;
68 | }
69 | catch (Exception ex)
70 | {
71 |
72 | MessageBox.Show(this._ParentHandle, "Cannot show Select Folder dialog!", "Error!" + ex.Message, MessageBoxOptions.OkOnly | MessageBoxOptions.IconError);
73 | return false;
74 | }
75 | finally
76 | {
77 | if (pidl != IntPtr.Zero)
78 | Marshal.FreeCoTaskMem(pidl);
79 |
80 | }
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/PaintEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CoreWindowsWrapper
4 | {
5 | [Serializable]
6 | public class PaintEventArgs : EventArgs
7 | {
8 | public PaintObject PaintObject{get;}
9 |
10 | public PaintEventArgs(PaintObject po)
11 | {
12 | this.PaintObject = po;
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/PaintObject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Diga.Core.Api.Win32;
3 |
4 | namespace CoreWindowsWrapper
5 | {
6 | public class PaintObject
7 | {
8 | private PaintStruct _PaintStruct;
9 |
10 | internal PaintObject(PaintStruct ps)
11 | {
12 | this._PaintStruct = ps;
13 |
14 | }
15 |
16 | public IntPtr Hdc => this._PaintStruct.hdc;
17 |
18 | public bool Erase
19 | {
20 | get => this._PaintStruct.fErase;
21 | set => this._PaintStruct.fErase = value;
22 | }
23 |
24 | public Rect RcPaint => this._PaintStruct.GetRcPaint();
25 | }
26 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion:4.0.30319.42000
5 | //
6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
7 | // der Code erneut generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace CoreWindowsWrapper.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
17 | ///
18 | // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
19 | // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
20 | // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
21 | // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CoreWindowsWrapper.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
51 | /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/README.md:
--------------------------------------------------------------------------------
1 | # CoreWindowsWrapper
2 | ### Native Windows Wrapper for .NET-Core and .Framework
3 |
4 | CoreWindowsWrapper is a DLL you can use to create Core Applications showing Dialogs without using System.Windows.Forms.
5 | The Project uses the Windows - API to create Native Windows. I personally use this DLL to create Copy-Deploy-Setups.
6 |
7 | The component does not use COM. Unlike WPF or Windows Forms, it is possible to compile AOT Native.
8 |
9 |
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/SaveFileDialog.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Runtime.InteropServices;
3 | using Diga.Core.Api.Win32;
4 |
5 | namespace CoreWindowsWrapper
6 | {
7 | public class SaveFileDialog
8 | {
9 | private OfNw _OFNW;
10 |
11 | public SaveFileDialog()
12 | {
13 | this._OFNW = new OfNw {hInstance = Process.GetCurrentProcess().Handle};
14 | this._OFNW.lStructSize = (uint) Marshal.SizeOf(this._OFNW);
15 | this._OFNW.lpstrFilter = "All Files\0*.*\0";
16 | this._OFNW.lpstrFile = new string(new char[257]);
17 | this._OFNW.nMaxFile = (uint) this._OFNW.lpstrFile.Length;
18 | this._OFNW.lpstrFileTitle = new string(new char[65]);
19 | this._OFNW.nMaxFileTitle = (uint) this._OFNW.lpstrFileTitle.Length;
20 | this._OFNW.lpstrInitialDir = "C:\\";
21 | this._OFNW.lpstrTitle = "Open File...";
22 | this._OFNW.lpstrDefExt = "*";
23 | }
24 |
25 | public bool Show(IControl parent = null)
26 | {
27 | if (parent != null)
28 | this._OFNW.hwndOwner = parent.Handle;
29 | return ComDlg32.GetSaveFileName(ref this._OFNW);
30 | }
31 |
32 | public int DefaultFilterIndex
33 | {
34 | get => (int)this._OFNW.nFilterIndex;
35 | set => this._OFNW.nFilterIndex = (uint)value;
36 | }
37 | public string File
38 | {
39 | get => this._OFNW.lpstrFile;
40 | }
41 |
42 | public string InitialDir
43 | {
44 | get => this._OFNW.lpstrInitialDir;
45 | set => this._OFNW.lpstrInitialDir = value;
46 | }
47 |
48 | public string DefaultExtension
49 | {
50 | get => this._OFNW.lpstrDefExt;
51 | set => this._OFNW.lpstrDefExt = value;
52 | }
53 | public string Title
54 | {
55 | get => this._OFNW.lpstrTitle;
56 | set => this._OFNW.lpstrTitle = value;
57 | }
58 |
59 | public string Filter
60 | {
61 | get => this._OFNW.lpstrFilter;
62 | set => this._OFNW.lpstrFilter = value;
63 | }
64 |
65 |
66 | }
67 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/SizeEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CoreWindowsWrapper
4 | {
5 | [Serializable]
6 | public class SizeEventArgs : EventArgs
7 | {
8 | public int X{get;set;}
9 | public int Y { get;set; }
10 | public int Width{get;set;}
11 | public int Height{get;set;}
12 |
13 | public SizeEventArgs(int x , int y , int width, int height)
14 | {
15 | this.X = x;
16 | this.Y = y;
17 | this.Width = width;
18 | this.Height = height;
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/TaskQueue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | namespace CoreWindowsWrapper
5 | {
6 | internal class TaskQueue
7 | {
8 | private Task previous = Task.FromResult(false);
9 | private object key = new object();
10 |
11 | public Task Enqueue(Func> taskGenerator)
12 | {
13 | lock (this.key)
14 | {
15 | var next = this.previous.ContinueWith(t => taskGenerator()).Unwrap();
16 | this.previous = next;
17 | return next;
18 | }
19 | }
20 | public Task Enqueue(Func taskGenerator)
21 | {
22 | lock (this.key)
23 | {
24 | var next = this.previous.ContinueWith(t => taskGenerator()).Unwrap();
25 | this.previous = next;
26 | return next;
27 | }
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/Tools/ColorTool.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Diga.Core.Api.Win32;
3 | using Diga.Core.Api.Win32.GDI;
4 |
5 | // ReSharper disable CheckNamespace
6 |
7 | namespace CoreWindowsWrapper.Tools
8 | {
9 | public static class ColorTool
10 | {
11 | public static int White => Rgb(255, 255, 255);
12 | public static int Black => Rgb(0, 0, 0);
13 | public static int Read => Rgb(255, 0, 0);
14 | public static int Green => Rgb(0, 255, 0);
15 | public static int Blue => Rgb(0, 0, 255);
16 | public static int Yellow => Rgb(255, 255, 0);
17 | public static int LightGray => Rgb(224, 224, 224);
18 | public static int Gray => Rgb(128, 128, 128);
19 | public static int ControlBackground => 0xF0F0F0;
20 |
21 | public static int Rgb(int red, int green, int blue)
22 | {
23 | if ((red & -2147483648) != 0)
24 | {
25 | throw new ArgumentException("invalid Read Value");
26 | }
27 |
28 | if ((green & -2147483648) != 0)
29 | {
30 | throw new ArgumentException("Invalid Green Value");
31 | }
32 |
33 | if ((blue & -2147483648) != 0)
34 | {
35 | throw new ArgumentException("Invalid Blue Value");
36 | }
37 |
38 | if (red > 255)
39 | {
40 | red = 255;
41 | }
42 |
43 | if (green > 255)
44 | {
45 | green = 255;
46 | }
47 |
48 | if (blue > 255)
49 | {
50 | blue = 255;
51 | }
52 |
53 | return Gdi32.RGB(red, green, blue);
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/Tools/FontTool.cs:
--------------------------------------------------------------------------------
1 | using Diga.Core.Api.Win32;
2 | using System;
3 | using Diga.Core.Api.Win32.GDI;
4 |
5 | // ReSharper disable CheckNamespace
6 |
7 | namespace CoreWindowsWrapper.Tools
8 | {
9 | public static class FontTool
10 | {
11 | internal static int FontSizeToHeight(int size, IntPtr hDc)
12 | {
13 | int devCap = Gdi32.GetDeviceCaps(hDc, LogPixels.LOGPIXELSY);
14 | return -Win32Api.MulDiv(size, devCap, 72);
15 | }
16 |
17 | internal static int FontHeightToSize(int height, IntPtr hDc)
18 | {
19 | int devCap = Gdi32.GetDeviceCaps(hDc, LogPixels.LOGPIXELSY);
20 | return -Win32Api.MulDivReverse(height, devCap, 72);
21 | }
22 |
23 | internal static LogFont GetDefaultLogFont()
24 | {
25 | User32.GetDefaultLogFont(out var lf);
26 | return lf;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/Tools/ImageTool.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Diagnostics;
4 | using System.Runtime.InteropServices;
5 | using Diga.Core.Api.Win32;
6 |
7 | namespace CoreWindowsWrapper.Tools
8 | {
9 | internal class ImageTool
10 | {
11 |
12 | [DllImport("user32.dll", EntryPoint="LoadIcon" , CharSet = CharSet.Auto)]
13 | public static extern IntPtr LoadIcon([In] IntPtr hInstance, [In] IntPtr id) ;
14 |
15 |
16 | public static IntPtr SafeLoadIconFromFile(string filePath)
17 | {
18 | IntPtr hIcon = User32.LoadImage(IntPtr.Zero, filePath, ImageTypeConst.IMAGE_ICON, 0, 0,
19 | LoadResourceConst.LR_LOADFROMFILE | LoadResourceConst.LR_DEFAULTSIZE | LoadResourceConst.LR_SHARED);
20 |
21 | return hIcon;
22 | }
23 |
24 |
25 | public static IntPtr SafeLoadBitmapFromFile(string filePath)
26 | {
27 | IntPtr hBmp = User32.LoadImage(IntPtr.Zero, filePath, ImageTypeConst.IMAGE_BITMAP, 0, 0,
28 | LoadResourceConst.LR_LOADFROMFILE | LoadResourceConst.LR_DEFAULTSIZE | LoadResourceConst.LR_SHARED);
29 |
30 | return hBmp;
31 | }
32 |
33 | public static IntPtr LoadAppIcon()
34 | {
35 | //return ResourceLoader.Loader.LoadIcon(32512);
36 | IntPtr hIcon = LoadIcon(IntPtr.Zero, Win32Api.MakeInterSource((int)StdIcons.IDI_APPLICATION));
37 | return hIcon;
38 | }
39 |
40 |
41 |
42 | public static IntPtr LoadHandIcon()
43 | {
44 | return LoadIcon(IntPtr.Zero, Win32Api.MakeInterSource((int)StdIcons.IDI_HAND));
45 | }
46 |
47 | public static IntPtr LoadQuestionIcon()
48 | {
49 | return LoadIcon(IntPtr.Zero, Win32Api.MakeInterSource((int)StdIcons.IDI_QUESTION));
50 | }
51 |
52 | public static IntPtr LoadExclamationIcon()
53 | {
54 | return LoadIcon(IntPtr.Zero, Win32Api.MakeInterSource((int)StdIcons.IDI_EXCLAMATION));
55 | }
56 | public static IntPtr LoadAsteriskIcon()
57 | {
58 | return LoadIcon(IntPtr.Zero, Win32Api.MakeInterSource((int)StdIcons.IDI_ASTERISK));
59 | }
60 |
61 | public static IntPtr LoadWinLogoIcon()
62 | {
63 | return LoadIcon(IntPtr.Zero, Win32Api.MakeInterSource((int)StdIcons.IDI_WINLOGO));
64 | }
65 |
66 | public static IntPtr LoadShieldIcon()
67 | {
68 | IntPtr hIcon = LoadIcon(IntPtr.Zero, Win32Api.MakeInterSource((int)StdIcons.IDI_SHIELD));
69 | return hIcon;
70 | }
71 | public static IntPtr LoadWarningIcon()
72 | {
73 | return LoadIcon(IntPtr.Zero, Win32Api.MakeInterSource((int)StdIcons.IDI_WARNING));
74 | }
75 |
76 | public static IntPtr LoadErrorIcon()
77 | {
78 | return LoadIcon(IntPtr.Zero, Win32Api.MakeInterSource((int)StdIcons.IDI_ERROR));
79 | }
80 | public static IntPtr LoadInformationIcon()
81 | {
82 | return LoadIcon(IntPtr.Zero, Win32Api.MakeInterSource((int)StdIcons.IDI_INFORMATION));
83 | }
84 | public static IntPtr SafeLoadIconFromResource(int resId)
85 | {
86 | return SafeLoadIconFromResource(Kernel32.GetModuleHandle(null), resId);
87 | }
88 | public static IntPtr SafeLoadIconFromResource(IntPtr instance,int resId)
89 | {
90 | IntPtr hIcon = User32.LoadImage(instance, Win32Api.MakeInterSource(resId), ImageTypeConst.IMAGE_ICON,
91 | User32.GetSystemMetrics(SystemMetric.SM_CXSMICON),
92 | User32.GetSystemMetrics(SystemMetric.SM_CYSMICON), 0);
93 |
94 | if (hIcon == IntPtr.Zero)
95 | {
96 | Win32Exception ex = new Win32Exception(Marshal.GetLastWin32Error());
97 | Debug.Print(ex.Message);
98 | }
99 |
100 | return hIcon;
101 | }
102 |
103 | public static IntPtr SafeLoadBitmapFromResource(int resId)
104 | {
105 | return SafeLoadBitmapFromResource(Kernel32.GetModuleHandle(null), resId);
106 | }
107 | public static IntPtr SafeLoadBitmapFromResource(IntPtr instance, int resId)
108 | {
109 | IntPtr hBmp = User32.LoadImage(instance, Win32Api.MakeInterSource(resId), ImageTypeConst.IMAGE_BITMAP, 0, 0,
110 | LoadResourceConst.LR_DEFAULTSIZE | LoadResourceConst.LR_SHARED);
111 | return hBmp;
112 | }
113 |
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/Win32ApiForm/ControlType.cs:
--------------------------------------------------------------------------------
1 | namespace CoreWindowsWrapper.Win32ApiForm
2 | {
3 | public enum ControlType
4 | {
5 | DefaultControl = 0,
6 | Label,
7 | Edit,
8 | Timer,
9 | Link,
10 | ListBox,
11 | ListView,
12 | ImageList,
13 | TreeView,
14 | GroupBox,
15 | ComboBox,
16 | Button,
17 | Bitmap,
18 | CheckBox,
19 | Progress,
20 | Window,
21 | Panel
22 | }
23 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/Win32ApiForm/Win32AxControl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Diga.Core.Api.Win32;
3 |
4 | namespace CoreWindowsWrapper.Win32ApiForm
5 | {
6 | internal class Win32AxControl : Win32Control
7 | {
8 | internal override bool Create(IntPtr parentHandle)
9 | {
10 | //if(this.ControlId == 0)
11 | //{
12 | // LastControlId +=1;
13 | // this.ControlId = LastControlId;
14 | //}
15 | if (this.CommonControlType != CommonControls.ICC_UNDEFINED)
16 | {
17 | InitCommonControlsEx ccInit = new InitCommonControlsEx(this.CommonControlType);
18 | ComCtl32.InitCommonControlsEx(ref ccInit);
19 | }
20 |
21 | this.ParentHandle = parentHandle;
22 | this.Handle = User32.CreateWindowEx(0,
23 | "static", this.Text,
24 | this.Style, this.Left,
25 | this.Top,
26 | this.Width, this.Height, this.ParentHandle,
27 | (IntPtr) this.ControlId, IntPtr.Zero, IntPtr.Zero);
28 |
29 |
30 | return true;
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/Win32ApiForm/Win32Dialog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Diga.Core.Api.Win32;
3 | // ReSharper disable CheckNamespace
4 |
5 | namespace CoreWindowsWrapper.Win32ApiForm
6 | {
7 | internal class Win32Dialog : IDisposable
8 | {
9 | public static ApiHandleRef InstanceHandle { get; set; } = IntPtr.Zero;
10 | public ApiHandleRef Handle { get; private set; } = IntPtr.Zero;
11 | public ApiHandleRef ParentHandle { get; set; } = IntPtr.Zero;
12 |
13 | public void Dispose()
14 | {
15 |
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/Win32ApiForm/Win32NoCreateControl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CoreWindowsWrapper.Win32ApiForm
4 | {
5 | internal class Win32NoCreateControl : Win32Control
6 | {
7 | internal override bool Create(IntPtr parentHandle)
8 | {
9 | //if(this.ControlId == 0)
10 | //{
11 | // LastControlId += 1;
12 | // this.ControlId = LastControlId;
13 | //}
14 | return true;
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/WindowState.cs:
--------------------------------------------------------------------------------
1 | using Diga.Core.Api.Win32;
2 |
3 | namespace CoreWindowsWrapper
4 | {
5 | public enum WindowState : int
6 | {
7 | Normal= 1,
8 | Minimized = ShowWindowCommands.Minimize,
9 | Maximized = 3
10 | }
11 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/WindowsStartupPosition.cs:
--------------------------------------------------------------------------------
1 | namespace CoreWindowsWrapper
2 | {
3 | public enum WindowsStartupPosition
4 | {
5 | Normal,
6 | CenterScreen,
7 | Maximized,
8 | Minimized
9 | }
10 | }
--------------------------------------------------------------------------------
/Src/CoreWindowsWrapper/diga_cert.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/CoreWindowsWrapper/diga_cert.snk
--------------------------------------------------------------------------------
/Src/DIGAAppSetup/DIGAAppSetup.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net8.0
6 | Firmen_Emblem.ico
7 | DIGAAppSetup.Program
8 | app.manifest
9 | true
10 | true
11 | DigaCert.snk
12 | false
13 |
14 |
15 |
16 | false
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | PreserveNewest
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Src/DIGAAppSetup/DigaCert.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/DIGAAppSetup/DigaCert.snk
--------------------------------------------------------------------------------
/Src/DIGAAppSetup/Firmen_Emblem.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/DIGAAppSetup/Firmen_Emblem.ico
--------------------------------------------------------------------------------
/Src/DIGAAppSetup/MainForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using CoreWindowsWrapper;
4 |
5 |
6 | namespace DIGAAppSetup
7 | {
8 | public partial class MainForm : NativeWindow
9 | {
10 | public MainForm()
11 | {
12 | InitializeComponent();
13 | }
14 |
15 |
16 |
17 | private void MainFrom_Create(object sender, CreateEventArgs e)
18 | {
19 | this._MainProgress.Value = 50;
20 | }
21 |
22 | private void OkButton_Clicked(object sender, EventArgs e)
23 | {
24 | this.Close();
25 | }
26 |
27 | private void CancelButton_Clicked(object sender, EventArgs e)
28 | {
29 | try
30 | {
31 | string json = Diga.Core.Json.DigaJson.Serialize(this);
32 | File.WriteAllText("Test.json",json);
33 |
34 | MessageBox.Show(this.Handle, "Exported", "Export",
35 | MessageBoxOptions.OkOnly | MessageBoxOptions.IconInformation);
36 |
37 | }
38 | catch (Exception exception)
39 | {
40 | MessageBox.Show(this.Handle, "Serializer Error:" + exception.ToString(), "Export Error",
41 | MessageBoxOptions.OkOnly | MessageBoxOptions.IconError);
42 |
43 | }
44 |
45 |
46 |
47 | }
48 | }
49 |
50 |
51 | public partial class MainForm
52 | {
53 | private NativeButton _OkButton;
54 | private NativeButton _CancelButton;
55 | private NativeLabel _LabelCaption;
56 | private NativeLabel _LabelDescription;
57 | private NativeProgress _MainProgress;
58 | private NativeProgress _SecondProgress;
59 |
60 | protected void InitializeComponent()
61 | {
62 | this._OkButton = new NativeButton();
63 | this._CancelButton = new NativeButton();
64 | this._LabelCaption = new NativeLabel();
65 | this._LabelDescription = new NativeLabel();
66 | this._MainProgress = new NativeProgress();
67 | this._SecondProgress = new NativeProgress();
68 | //this.Left = 100;
69 | //this.Top = 100;
70 |
71 | this.Width = 542;
72 | this.Height = 300;
73 | this.BackColor = CoreWindowsWrapper.Tools.ColorTool.White;
74 | this.Name = "MainForm";
75 | this.Text = "Welcome to the Setup";
76 | this.IconFile = "app.ico";
77 | this.StartUpPosition = WindowsStartupPosition.CenterScreen;
78 | this.Create += MainFrom_Create;
79 | //_LabelCaption
80 | this._LabelCaption.Left = 12;
81 | this._LabelCaption.Top = 9;
82 | this._LabelCaption.Width = 498;
83 | this._LabelCaption.Height = 49;
84 | this._LabelCaption.Text = "Welcome to the Setup &s";
85 | this._LabelCaption.Name = "LabelCaption";
86 | this._LabelCaption.ForeColor = CoreWindowsWrapper.Tools.ColorTool.Blue;
87 | this._LabelCaption.Font = new Font(){Name = "Arial",Size=15,Bold = true};
88 |
89 | this._LabelDescription.Left = 12;
90 | this._LabelDescription.Top = 58;
91 | this._LabelDescription.Width = 498;
92 | this._LabelDescription.Height = 78;
93 | this._LabelDescription.Text = "Do you want to start the Installation?";
94 | this._LabelDescription.Name = "LabelDescription";
95 | this._LabelDescription.Font = new Font(){Name = "Arial", Size=12, Italic= true};
96 |
97 |
98 | this._MainProgress.Left = 12;
99 | this._MainProgress.Top = 161;
100 | this._MainProgress.Width = 498;
101 | this._MainProgress.Height = 14;
102 |
103 | this._MainProgress.Name = "MainProgress";
104 |
105 | this._SecondProgress.Left = 12;
106 | this._SecondProgress.Top = 191;
107 | this._SecondProgress.Width = 498;
108 | this._SecondProgress.Height = 14;
109 | this._SecondProgress.Name = "SecondProgress";
110 |
111 | this._CancelButton.Left = 320;
112 | this._CancelButton.Top = 220;
113 | this._CancelButton.Width = 92;
114 | this._CancelButton.Height = 29;
115 | this._CancelButton.Text = "Cancel";
116 | this._CancelButton.Name = "CancelButton";
117 | this._CancelButton.ForeColor = CoreWindowsWrapper.Tools.ColorTool.Yellow;
118 | this._CancelButton.Font = new Font(){Size=11,Bold=true};
119 |
120 | this._CancelButton.Clicked += CancelButton_Clicked;
121 | this._OkButton.Left = 418;
122 | this._OkButton.Top = 220;
123 | this._OkButton.Width = 92;
124 | this._OkButton.Height = 29;
125 | this._OkButton.Text = "OK";
126 | this._OkButton.Name = "OkButton";
127 | this._OkButton.Clicked += OkButton_Clicked;
128 |
129 | this.Controls.Add(this._LabelCaption);
130 | this.Controls.Add(this._LabelDescription);
131 | this.Controls.Add(this._MainProgress);
132 | this.Controls.Add(this._SecondProgress);
133 | this.Controls.Add(this._CancelButton);
134 |
135 | this.Controls.Add(this._OkButton);
136 | }
137 |
138 | protected override void OnBeforeCreate(BeforeWindowCreateEventArgs e)
139 | {
140 | e.Styles.Style = Diga.Core.Api.Win32.WindowStylesConst.WS_DLGFRAME |
141 | Diga.Core.Api.Win32.WindowStylesConst.WS_SYSMENU;
142 | }
143 | }
144 | }
145 |
--------------------------------------------------------------------------------
/Src/DIGAAppSetup/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using CoreWindowsWrapper;
3 |
4 | namespace DIGAAppSetup
5 | {
6 | class Program
7 | {
8 | [STAThread]
9 | static void Main(string[] args)
10 | {
11 | MainForm nw = new MainForm();
12 | NativeApp.Run(nw);
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Src/DIGAAppSetup/app.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ITAgnesmeyer/CoreWindowsWrapper/357c414643cfd49326030bdc1e4589807b0dd658/Src/DIGAAppSetup/app.ico
--------------------------------------------------------------------------------
/Src/DIGAAppSetup/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
52 |
59 |
60 |
61 |
62 |
63 |
64 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/Src/Diga.NativeControls.WebBrowser.Core/Diga.NativeControls.WebBrowser.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | Diga.NativeControls.WebBrowser
6 | Diga.NativeControls.WebBrowser
7 | Dipl.-Ing.(FH) Guido Agnesmeyer
8 | Diga.NativeControls.WebBrowser.Core
9 | Copyright © 2020 Dipl.-Ing.(FH) Guido Agnesmeyer
10 | MIT
11 | net-core; WebView2, CoreWindowsWrapper
12 | WebBrowserControl build with WebView2 and CoreWindowsWrapper
13 | true
14 | Diga.NativeControls.WebBrowser
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Src/Diga.NativeControls.WebBrowser/Diga.NativeControls.WebBrowser.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net472
4 | Library
5 | false
6 | Diga.NativeControls.WebBrowser
7 | Diga.NativeControls.WebBrowser
8 | Copyright © 2020
9 | 1.0.0.0
10 | 1.0.0.0
11 |
12 |
13 |
14 | NativeWebBrowser.cs
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Src/Diga.NativeControls.WebBrowser/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | [assembly: AssemblyTrademark("")]
5 | [assembly: AssemblyCulture("")]
6 |
7 | // Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
8 | // für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
9 | // COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
10 | [assembly: ComVisible(false)]
11 |
12 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
13 | [assembly: Guid("5a726955-c418-4dd9-898a-336be2630bfd")]
14 |
--------------------------------------------------------------------------------
/Src/Diga.NativeControls.WebBrowser/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Src/Diga.NativeControls.WebBrowser/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Src/WinFormsTest/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Src/WinFormsTest/MainForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace WinFormsTest
2 | {
3 | partial class MainForm
4 | {
5 | ///
6 | /// Erforderliche Designervariable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Verwendete Ressourcen bereinigen.
12 | ///
13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | this._NativeWindow?.Dispose();
19 | components.Dispose();
20 | }
21 | base.Dispose(disposing);
22 | }
23 |
24 | #region Vom Windows Form-Designer generierter Code
25 |
26 | ///
27 | /// Erforderliche Methode für die Designerunterstützung.
28 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
29 | ///
30 | private void InitializeComponent()
31 | {
32 | this.panel1 = new System.Windows.Forms.Panel();
33 | this.panel2 = new System.Windows.Forms.Panel();
34 | this.SuspendLayout();
35 | //
36 | // panel1
37 | //
38 | this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
39 | this.panel1.Location = new System.Drawing.Point(0, 0);
40 | this.panel1.Name = "panel1";
41 | this.panel1.Size = new System.Drawing.Size(949, 41);
42 | this.panel1.TabIndex = 0;
43 | //
44 | // panel2
45 | //
46 | this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
47 | this.panel2.Location = new System.Drawing.Point(0, 41);
48 | this.panel2.Name = "panel2";
49 | this.panel2.Size = new System.Drawing.Size(949, 409);
50 | this.panel2.TabIndex = 1;
51 | //
52 | // MainForm
53 | //
54 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
55 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
56 | this.ClientSize = new System.Drawing.Size(949, 450);
57 | this.Controls.Add(this.panel2);
58 | this.Controls.Add(this.panel1);
59 | this.Name = "MainForm";
60 | this.Text = "Form1";
61 | this.Load += new System.EventHandler(this.MainForm_Load);
62 | this.ResumeLayout(false);
63 |
64 | }
65 |
66 | #endregion
67 |
68 | private System.Windows.Forms.Panel panel1;
69 | private System.Windows.Forms.Panel panel2;
70 | }
71 | }
72 |
73 |
--------------------------------------------------------------------------------
/Src/WinFormsTest/MainForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Src/WinFormsTest/Program.cs:
--------------------------------------------------------------------------------
1 | using WinFormsTest;
2 | using System;
3 | using System.Windows.Forms;
4 |
5 | namespace WinFormsTest
6 | {
7 | static class Program
8 | {
9 | ///
10 | /// Der Haupteinstiegspunkt für die Anwendung.
11 | ///
12 | [STAThread]
13 | static void Main()
14 | {
15 |
16 | Application.EnableVisualStyles();
17 | Application.SetCompatibleTextRenderingDefault(false);
18 | Application.Run(new MainForm());
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Src/WinFormsTest/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion:4.0.30319.42000
5 | //
6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
7 | // der Code erneut generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace WinFormsTest.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
17 | ///
18 | // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
19 | // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
20 | // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
21 | // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WinFormsTest.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
51 | /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Src/WinFormsTest/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Src/WinFormsTest/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion:4.0.30319.42000
5 | //
6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
7 | // der Code erneut generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace WinFormsTest.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Src/WinFormsTest/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Src/WinFormsTest/WinFormsTest.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net8.0-windows
4 | WinExe
5 | false
6 | true
7 | true
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-architect
--------------------------------------------------------------------------------