├── .deepsource.toml
├── .gitignore
├── AltUI.sln
├── AltUI
├── AltUI.csproj
├── Collections
│ ├── ObservableList.cs
│ └── ObservableListModified.cs
├── ColorPicker
│ ├── AdobeColorTablePaletteSerializer.cs
│ ├── AdobePhotoShopColorSwatchSerializer.cs
│ ├── AdobePhotoshopColorSwatchColorSpace.cs
│ ├── AdobePhotoshopColorSwatchFileVersion.cs
│ ├── ColorBarStyle.cs
│ ├── ColorCellBorderStyle.cs
│ ├── ColorCollection.cs
│ ├── ColorCollectionEventArgs.cs
│ ├── ColorCollectionSortOrder.cs
│ ├── ColorComboBox.cs
│ ├── ColorComparer.cs
│ ├── ColorEditingMode.cs
│ ├── ColorEditor.Designer.cs
│ ├── ColorEditor.cs
│ ├── ColorEditor.resx
│ ├── ColorEditorManager.cs
│ ├── ColorGrid.cs
│ ├── ColorGridSelectedCellStyle.cs
│ ├── ColorHitTestInfo.cs
│ ├── ColorPalette.cs
│ ├── ColorPalettes.cs
│ ├── ColorPickerDialog.Designer.cs
│ ├── ColorPickerDialog.cs
│ ├── ColorPickerDialog.resx
│ ├── ColorSlider.cs
│ ├── ColorSliderNubStyle.cs
│ ├── ColorSource.cs
│ ├── ColorWheel.cs
│ ├── EditColorCancelEventArgs.cs
│ ├── GimpPaletteSerializer.cs
│ ├── HslColor.cs
│ ├── HueColorSlider.cs
│ ├── IColorEditor.cs
│ ├── IPaletteSerializer.cs
│ ├── InterleavedBitmapPaletteSerializer.cs
│ ├── JascPaletteSerializer.cs
│ ├── LightnessColorSlider.cs
│ ├── LowLevelKeyboardProc.cs
│ ├── LowLevelMouseProc.cs
│ ├── NativeMethods.cs
│ ├── NavigationOrigin.cs
│ ├── PaintHelper.cs
│ ├── PaintNetPaletteSerializer.cs
│ ├── PaletteSerializer.cs
│ ├── RawPaletteSerializer.cs
│ ├── ResourceManager.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── RgbaChannel.cs
│ ├── RgbaColorSlider.cs
│ ├── SaturationColorSlider.cs
│ ├── ScreenColorPicker.cs
│ └── ScreenColorPickerHooks.cs
├── Config
│ ├── Colors.cs
│ ├── Consts.cs
│ ├── DarkTheme.cs
│ ├── ITheme.cs
│ ├── LightTheme.cs
│ ├── Sizes.cs
│ └── ThemeProvider.cs
├── Controls
│ ├── DarkButton.cs
│ ├── DarkButtonStyle.cs
│ ├── DarkCheckBox.cs
│ ├── DarkComboBox.cs
│ ├── DarkContentAlignment.cs
│ ├── DarkContextMenu.cs
│ ├── DarkControlState.cs
│ ├── DarkDropdownItem.cs
│ ├── DarkDropdownList.cs
│ ├── DarkGroupBox.cs
│ ├── DarkLabel.cs
│ ├── DarkListBox.cs
│ ├── DarkListItem.cs
│ ├── DarkListView.cs
│ ├── DarkMenuStrip.cs
│ ├── DarkNumericUpDown.cs
│ ├── DarkProgressBar.cs
│ ├── DarkRadioButton.cs
│ ├── DarkRichTextBox.cs
│ ├── DarkScrollBar.cs
│ ├── DarkScrollBase.cs
│ ├── DarkScrollOrientation.cs
│ ├── DarkScrollView.cs
│ ├── DarkSectionPanel.cs
│ ├── DarkSeparator.cs
│ ├── DarkStatusStrip.cs
│ ├── DarkTabControl.cs
│ ├── DarkTextBox.cs
│ ├── DarkTitle.cs
│ ├── DarkToolStrip.cs
│ ├── DarkToolTip.cs
│ ├── DarkTreeNode.cs
│ ├── DarkTreeView.cs
│ └── ScrollValueEventArgs.cs
├── Docking
│ ├── DarkDockArea.cs
│ ├── DarkDockContent.cs
│ ├── DarkDockGroup.cs
│ ├── DarkDockPanel.cs
│ ├── DarkDockRegion.cs
│ ├── DarkDockSplitter.cs
│ ├── DarkDockTab.cs
│ ├── DarkDockTabArea.cs
│ ├── DarkDocument.cs
│ ├── DarkSplitterType.cs
│ ├── DarkToolWindow.cs
│ ├── DarkToolWindow.resx
│ ├── DockContentEventArgs.cs
│ ├── DockDropArea.cs
│ ├── DockDropCollection.cs
│ ├── DockGroupState.cs
│ ├── DockInsertType.cs
│ ├── DockPanelState.cs
│ └── DockRegionState.cs
├── Extensions
│ ├── BitmapExtensions.cs
│ └── IEnumerableExtensions.cs
├── Forms
│ ├── DarkDialog.Designer.cs
│ ├── DarkDialog.cs
│ ├── DarkDialog.resx
│ ├── DarkDialogButton.cs
│ ├── DarkForm.cs
│ ├── DarkForm.resx
│ ├── DarkInputBox.Designer.cs
│ ├── DarkInputBox.cs
│ ├── DarkInputBox.resx
│ ├── DarkMessageBox.Designer.cs
│ ├── DarkMessageBox.cs
│ ├── DarkMessageBox.resx
│ ├── DarkMessageBoxIcon.cs
│ └── DarkTranslucentForm.cs
├── Icons
│ ├── DockIcons.Designer.cs
│ ├── DockIcons.resx
│ ├── DropdownIcons.Designer.cs
│ ├── DropdownIcons.resx
│ ├── MenuIcons.Designer.cs
│ ├── MenuIcons.resx
│ ├── MessageBoxIcons.Designer.cs
│ ├── MessageBoxIcons.resx
│ ├── ScrollIcons.Designer.cs
│ ├── ScrollIcons.resx
│ ├── TreeViewIcons.Designer.cs
│ └── TreeViewIcons.resx
├── Properties
│ └── AssemblyInfo.cs
├── Renderers
│ ├── DarkMenuRenderer.cs
│ └── DarkToolStripRenderer.cs
├── Resources
│ ├── active-inactive-close.png
│ ├── arrow.png
│ ├── cellbackground.png
│ ├── close-selected.png
│ ├── close.png
│ ├── error.png
│ ├── eyedropper.cur
│ ├── eyedropper.png
│ ├── grip.png
│ ├── inactive-close-selected.png
│ ├── inactive-close.png
│ ├── info.png
│ ├── lcellbackground.png
│ ├── lerror.png
│ ├── linfo.png
│ ├── lwarning.png
│ ├── node_closed_empty.png
│ ├── node_closed_full.png
│ ├── node_open.png
│ ├── node_open_empty.png
│ ├── palette-load.png
│ ├── palette-save.png
│ ├── scrollbar_arrow.png
│ ├── scrollbar_arrow_clicked.png
│ ├── scrollbar_arrow_hot.png
│ ├── scrollbar_arrow_small_clicked.png
│ ├── scrollbar_arrow_small_hot.png
│ ├── scrollbar_arrow_small_standard.png
│ ├── scrollbar_arrow_standard.png
│ ├── scrollbar_disabled.png
│ ├── small_arrow.png
│ ├── tick.png
│ ├── tw_active_close.png
│ ├── tw_active_close_selected.png
│ ├── tw_close.png
│ ├── tw_close_selected.png
│ └── warning.png
└── Win32
│ ├── ControlScrollFilter.cs
│ ├── DockContentDragFilter.cs
│ ├── DockResizeFilter.cs
│ ├── Native.cs
│ └── WindowsMessages.cs
├── Example
├── Example.csproj
├── Forms
│ ├── Dialogs
│ │ ├── DialogAbout.Designer.cs
│ │ ├── DialogAbout.cs
│ │ ├── DialogAbout.resx
│ │ ├── DialogControls.Designer.cs
│ │ ├── DialogControls.cs
│ │ └── DialogControls.resx
│ ├── Docking
│ │ ├── DockConsole.Designer.cs
│ │ ├── DockConsole.cs
│ │ ├── DockConsole.resx
│ │ ├── DockDocument.Designer.cs
│ │ ├── DockDocument.cs
│ │ ├── DockDocument.resx
│ │ ├── DockHistory.Designer.cs
│ │ ├── DockHistory.cs
│ │ ├── DockHistory.resx
│ │ ├── DockLayers.Designer.cs
│ │ ├── DockLayers.cs
│ │ ├── DockLayers.resx
│ │ ├── DockProject.Designer.cs
│ │ ├── DockProject.cs
│ │ ├── DockProject.resx
│ │ ├── DockProperties.Designer.cs
│ │ ├── DockProperties.cs
│ │ └── DockProperties.resx
│ ├── MainForm.Designer.cs
│ ├── MainForm.cs
│ └── MainForm.resx
├── Helpers
│ └── SerializerHelper.cs
├── Icons.Designer.cs
├── Icons.resx
├── Newtonsoft.Json.dll
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resources
│ ├── Close_16xLG.png
│ ├── Collection_16xLG.png
│ ├── Console.png
│ ├── Files_7954.png
│ ├── NewFile_6276.png
│ ├── RefactoringLog_12810.png
│ ├── StatusAnnotations_Information_16xLG_color.png
│ ├── StatusAnnotations_Information_16xMD_color.png
│ ├── application_16x.png
│ ├── document_16xLG.png
│ ├── folder_16x.png
│ ├── folder_Closed_16xLG.png
│ └── properties_16xLG.png
└── app.config
├── LICENSE
├── README.md
├── icon-64.png
├── package.nuspec
├── title.png
└── todo.txt
/.deepsource.toml:
--------------------------------------------------------------------------------
1 | version = 1
2 |
3 | [[analyzers]]
4 | name = "csharp"
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 | .idea
10 |
11 | # User-specific files (MonoDevelop/Xamarin Studio)
12 | *.userprefs
13 |
14 | # Build results
15 | [Dd]ebug/
16 | [Dd]ebugPublic/
17 | [Rr]elease/
18 | [Rr]eleases/
19 | x64/
20 | x86/
21 | build/
22 | bld/
23 | [Bb]in/
24 | [Oo]bj/
25 |
26 | # Visual Studo 2015 cache/options directory
27 | .vs/
28 |
29 | # MSTest test Results
30 | [Tt]est[Rr]esult*/
31 | [Bb]uild[Ll]og.*
32 |
33 | # NUNIT
34 | *.VisualState.xml
35 | TestResult.xml
36 |
37 | # Build Results of an ATL Project
38 | [Dd]ebugPS/
39 | [Rr]eleasePS/
40 | dlldata.c
41 |
42 | *_i.c
43 | *_p.c
44 | *_i.h
45 | *.ilk
46 | *.meta
47 | *.obj
48 | *.pch
49 | *.pdb
50 | *.pgc
51 | *.pgd
52 | *.rsp
53 | *.sbr
54 | *.tlb
55 | *.tli
56 | *.tlh
57 | *.tmp
58 | *.tmp_proj
59 | *.log
60 | *.vspscc
61 | *.vssscc
62 | .builds
63 | *.pidb
64 | *.svclog
65 | *.scc
66 |
67 | # Chutzpah Test files
68 | _Chutzpah*
69 |
70 | # Visual C++ cache files
71 | ipch/
72 | *.aps
73 | *.ncb
74 | *.opensdf
75 | *.sdf
76 | *.cachefile
77 |
78 | # Visual Studio profiler
79 | *.psess
80 | *.vsp
81 | *.vspx
82 |
83 | # TFS 2012 Local Workspace
84 | $tf/
85 |
86 | # Guidance Automation Toolkit
87 | *.gpState
88 |
89 | # ReSharper is a .NET coding add-in
90 | _ReSharper*/
91 | *.[Rr]e[Ss]harper
92 | *.DotSettings.user
93 |
94 | # JustCode is a .NET coding addin-in
95 | .JustCode
96 |
97 | # TeamCity is a build add-in
98 | _TeamCity*
99 |
100 | # DotCover is a Code Coverage Tool
101 | *.dotCover
102 |
103 | # NCrunch
104 | _NCrunch_*
105 | .*crunch*.local.xml
106 |
107 | # MightyMoose
108 | *.mm.*
109 | AutoTest.Net/
110 |
111 | # Web workbench (sass)
112 | .sass-cache/
113 |
114 | # Installshield output folder
115 | [Ee]xpress/
116 |
117 | # DocProject is a documentation generator add-in
118 | DocProject/buildhelp/
119 | DocProject/Help/*.HxT
120 | DocProject/Help/*.HxC
121 | DocProject/Help/*.hhc
122 | DocProject/Help/*.hhk
123 | DocProject/Help/*.hhp
124 | DocProject/Help/Html2
125 | DocProject/Help/html
126 |
127 | # Click-Once directory
128 | publish/
129 |
130 | # Publish Web Output
131 | *.[Pp]ublish.xml
132 | *.azurePubxml
133 | # TODO: Comment the next line if you want to checkin your web deploy settings
134 | # but database connection strings (with potential passwords) will be unencrypted
135 | *.pubxml
136 | *.publishproj
137 |
138 | # NuGet Packages
139 | *.nupkg
140 | # The packages folder can be ignored because of Package Restore
141 | **/packages/*
142 | # except build/, which is used as an MSBuild target.
143 | !**/packages/build/
144 | # Uncomment if necessary however generally it will be regenerated when needed
145 | #!**/packages/repositories.config
146 |
147 | # Windows Azure Build Output
148 | csx/
149 | *.build.csdef
150 |
151 | # Windows Store app package directory
152 | AppPackages/
153 |
154 | # Others
155 | *.[Cc]ache
156 | ClientBin/
157 | [Ss]tyle[Cc]op.*
158 | ~$*
159 | *~
160 | *.dbmdl
161 | *.dbproj.schemaview
162 | *.pfx
163 | *.publishsettings
164 | node_modules/
165 | bower_components/
166 |
167 | # RIA/Silverlight projects
168 | Generated_Code/
169 |
170 | # Backup & report files from converting an old project file
171 | # to a newer Visual Studio version. Backup files are not needed,
172 | # because we have git ;-)
173 | _UpgradeReport_Files/
174 | Backup*/
175 | UpgradeLog*.XML
176 | UpgradeLog*.htm
177 |
178 | # SQL Server files
179 | *.mdf
180 | *.ldf
181 |
182 | # Business Intelligence projects
183 | *.rdl.data
184 | *.bim.layout
185 | *.bim_*.settings
186 |
187 | # Microsoft Fakes
188 | FakesAssemblies/
189 |
190 | # Node.js Tools for Visual Studio
191 | .ntvs_analysis.dat
192 |
193 | # Visual Studio 6 build log
194 | *.plg
195 |
196 | # Visual Studio 6 workspace options file
197 | *.opt
198 |
--------------------------------------------------------------------------------
/AltUI.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.1.32210.238
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AltUI", "AltUI\AltUI.csproj", "{F19472F5-8C44-4C51-A8A0-B9DE5F555255}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example", "Example\Example.csproj", "{FA334815-6D78-4E9A-9F4D-6C8A58222A57}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {F19472F5-8C44-4C51-A8A0-B9DE5F555255}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {F19472F5-8C44-4C51-A8A0-B9DE5F555255}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {F19472F5-8C44-4C51-A8A0-B9DE5F555255}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {F19472F5-8C44-4C51-A8A0-B9DE5F555255}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {FA334815-6D78-4E9A-9F4D-6C8A58222A57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {FA334815-6D78-4E9A-9F4D-6C8A58222A57}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {FA334815-6D78-4E9A-9F4D-6C8A58222A57}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {FA334815-6D78-4E9A-9F4D-6C8A58222A57}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {92E385F3-0D84-4075-B0CF-A2DA3788BB14}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/AltUI/AltUI.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net6.0-windows
4 | Library
5 |
6 |
7 |
8 |
9 | false
10 | true
11 | true
12 | Debug;Release;Main;Main-Debug
13 |
14 |
15 | 1701;1702;CA1416
16 |
17 |
18 | 1701;1702;CA1416
19 |
20 |
21 | 1701;1702;CA1416
22 |
23 |
24 | 1701;1702;CA1416
25 |
26 |
27 |
28 | True
29 | True
30 | Resources.resx
31 |
32 |
33 | Component
34 |
35 |
36 | Component
37 |
38 |
39 | Component
40 |
41 |
42 | Component
43 |
44 |
45 | Component
46 |
47 |
48 | Component
49 |
50 |
51 | Component
52 |
53 |
54 | Component
55 |
56 |
57 | Component
58 |
59 |
60 | Component
61 |
62 |
63 | Component
64 |
65 |
66 | Component
67 |
68 |
69 | Component
70 |
71 |
72 | Component
73 |
74 |
75 | Component
76 |
77 |
78 | Component
79 |
80 |
81 | Component
82 |
83 |
84 | Component
85 |
86 |
87 | Component
88 |
89 |
90 | Component
91 |
92 |
93 | Component
94 |
95 |
96 | Component
97 |
98 |
99 | Component
100 |
101 |
102 | Component
103 |
104 |
105 | UserControl
106 |
107 |
108 | Component
109 |
110 |
111 | UserControl
112 |
113 |
114 | Component
115 |
116 |
117 | UserControl
118 |
119 |
120 | UserControl
121 |
122 |
123 |
124 |
125 | ResXFileCodeGenerator
126 | Resources.Designer.cs
127 | AltUI.ColorPicker
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
--------------------------------------------------------------------------------
/AltUI/Collections/ObservableList.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | namespace AltUI.Collections
6 | {
7 | public class ObservableList : List, IDisposable
8 | {
9 | #region Field Region
10 |
11 | private bool _disposed;
12 |
13 | #endregion
14 |
15 | #region Event Region
16 |
17 | public event EventHandler> ItemsAdded;
18 | public event EventHandler> ItemsRemoved;
19 |
20 | #endregion
21 |
22 | #region Destructor Region
23 |
24 | ~ObservableList()
25 | {
26 | Dispose(false);
27 | }
28 |
29 | #endregion
30 |
31 | #region Dispose Region
32 |
33 | public void Dispose()
34 | {
35 | Dispose(true);
36 | GC.SuppressFinalize(this);
37 | }
38 |
39 | protected virtual void Dispose(bool disposing)
40 | {
41 | if (!_disposed)
42 | {
43 | if (ItemsAdded != null)
44 | ItemsAdded = null;
45 |
46 | if (ItemsRemoved != null)
47 | ItemsRemoved = null;
48 |
49 | _disposed = true;
50 | }
51 | }
52 |
53 | #endregion
54 |
55 | #region Method Region
56 |
57 | public new void Add(T item)
58 | {
59 | base.Add(item);
60 |
61 | if (ItemsAdded != null)
62 | ItemsAdded(this, new ObservableListModified(new List { item }));
63 | }
64 |
65 | public new void AddRange(IEnumerable collection)
66 | {
67 | var list = collection.ToList();
68 |
69 | base.AddRange(list);
70 |
71 | if (ItemsAdded != null)
72 | ItemsAdded(this, new ObservableListModified(list));
73 | }
74 |
75 | public new void Remove(T item)
76 | {
77 | base.Remove(item);
78 |
79 | if (ItemsRemoved != null)
80 | ItemsRemoved(this, new ObservableListModified(new List { item }));
81 | }
82 |
83 | public new void Clear()
84 | {
85 | var removed = new ObservableListModified(this.ToList());
86 | base.Clear();
87 |
88 | if (removed.Items.Count() > 0 && ItemsRemoved != null)
89 | ItemsRemoved(this, removed);
90 | }
91 |
92 | #endregion
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/AltUI/Collections/ObservableListModified.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace AltUI.Collections
5 | {
6 | public class ObservableListModified : EventArgs
7 | {
8 | public IEnumerable Items { get; private set; }
9 |
10 | public ObservableListModified(IEnumerable items)
11 | {
12 | Items = items;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/AdobePhotoshopColorSwatchColorSpace.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace AltUI.ColorPicker
4 | {
5 | // Cyotek Color Picker controls library
6 | // Copyright © 2013-2017 Cyotek Ltd.
7 | // http://cyotek.com/blog/tag/colorpicker
8 |
9 | // Licensed under the MIT License. See license.txt for the full text.
10 |
11 | // If you use this code in your applications, donations or attribution are welcome
12 |
13 | ///
14 | /// Specifies the color space of an Adobe Photoshop color swatch file
15 | ///
16 | [Obsolete("This class will be removed in a future update to the library.")]
17 | public enum AdobePhotoshopColorSwatchColorSpace
18 | {
19 | ///
20 | /// RGB
21 | ///
22 | Rgb = 0,
23 |
24 | ///
25 | /// HSB
26 | ///
27 | Hsb = 1,
28 |
29 | ///
30 | /// CMYK
31 | ///
32 | Cmyk = 2,
33 |
34 | ///
35 | /// Lab
36 | ///
37 | Lab = 7,
38 |
39 | ///
40 | /// Grayscale
41 | ///
42 | Grayscale = 8
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/AdobePhotoshopColorSwatchFileVersion.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace AltUI.ColorPicker
4 | {
5 | // Cyotek Color Picker controls library
6 | // Copyright © 2013-2017 Cyotek Ltd.
7 | // http://cyotek.com/blog/tag/colorpicker
8 |
9 | // Licensed under the MIT License. See license.txt for the full text.
10 |
11 | // If you use this code in your applications, donations or attribution are welcome
12 |
13 | ///
14 | /// Specifies the version of a Abode Photoshop color swatch file
15 | ///
16 | [Obsolete("This class will be removed in a future update to the library.")]
17 | public enum AdobePhotoshopColorSwatchFileVersion
18 | {
19 | ///
20 | /// Version 1
21 | ///
22 | Version1 = 1,
23 |
24 | ///
25 | /// Version 2
26 | ///
27 | Version2
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/ColorBarStyle.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.ColorPicker
2 | {
3 | // Cyotek Color Picker controls library
4 | // Copyright © 2013-2017 Cyotek Ltd.
5 | // http://cyotek.com/blog/tag/colorpicker
6 |
7 | // Licensed under the MIT License. See license.txt for the full text.
8 |
9 | // If you use this code in your applications, donations or attribution are welcome
10 |
11 | ///
12 | /// Specifies the style of a color bar
13 | ///
14 | public enum ColorBarStyle
15 | {
16 | ///
17 | /// A gradient from one color to another.
18 | ///
19 | TwoColor,
20 |
21 | ///
22 | /// A gradient between three colors.
23 | ///
24 | ThreeColor,
25 |
26 | ///
27 | /// A gadient between a user defined number of colors.
28 | ///
29 | Custom
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/ColorCellBorderStyle.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.ColorPicker
2 | {
3 | // Cyotek Color Picker controls library
4 | // Copyright © 2013-2017 Cyotek Ltd.
5 | // http://cyotek.com/blog/tag/colorpicker
6 |
7 | // Licensed under the MIT License. See license.txt for the full text.
8 |
9 | // If you use this code in your applications, donations or attribution are welcome
10 |
11 | ///
12 | /// Specifies the style of a color cell border.
13 | ///
14 | public enum ColorCellBorderStyle
15 | {
16 | ///
17 | /// No border.
18 | ///
19 | None,
20 |
21 | ///
22 | /// A single line border.
23 | ///
24 | FixedSingle,
25 |
26 | ///
27 | /// A contrasting double border with a soft inner outline using the color of the cell.
28 | ///
29 | DoubleSoft
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/ColorCollectionEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 |
4 | namespace AltUI.ColorPicker
5 | {
6 | // Cyotek Color Picker controls library
7 | // Copyright © 2013-2017 Cyotek Ltd.
8 | // http://cyotek.com/blog/tag/colorpicker
9 |
10 | // Licensed under the MIT License. See license.txt for the full text.
11 |
12 | // If you use this code in your applications, donations or attribution are welcome
13 |
14 | /// Provides data for the event of a instance.
15 | public class ColorCollectionEventArgs : EventArgs
16 | {
17 | #region Constructors
18 |
19 | ///
20 | /// Initializes a new instance of the class for the specified color.
21 | ///
22 | /// The color index that the event is responding to.
23 | /// The %Color% that the event is responding to.
24 | public ColorCollectionEventArgs(int index, Color color)
25 | {
26 | Index = index;
27 | Color = color;
28 | }
29 |
30 | ///
31 | /// Initializes a new instance of the class.
32 | ///
33 | protected ColorCollectionEventArgs()
34 | { }
35 |
36 | #endregion
37 |
38 | #region Properties
39 |
40 | ///
41 | /// Gets the color that raised the event.
42 | ///
43 | /// The color that raised the event.
44 | public Color Color { get; protected set; }
45 |
46 | ///
47 | /// Gets the color index that raised the event.
48 | ///
49 | /// The color index that raised the event.
50 | public int Index { get; protected set; }
51 |
52 | #endregion
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/ColorCollectionSortOrder.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.ColorPicker
2 | {
3 | // Cyotek Color Picker controls library
4 | // Copyright © 2013-2017 Cyotek Ltd.
5 | // http://cyotek.com/blog/tag/colorpicker
6 |
7 | // Licensed under the MIT License. See license.txt for the full text.
8 |
9 | // If you use this code in your applications, donations or attribution are welcome
10 |
11 | ///
12 | /// Specifies the sort order of colors
13 | ///
14 | public enum ColorCollectionSortOrder
15 | {
16 | ///
17 | /// Ordered by hue.
18 | ///
19 | Hue,
20 |
21 | ///
22 | /// Ordered by brightness.
23 | ///
24 | Brightness,
25 |
26 | ///
27 | /// Ordered by value
28 | ///
29 | Value
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/ColorComparer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 |
4 | namespace AltUI.ColorPicker
5 | {
6 | // Cyotek Color Picker controls library
7 | // Copyright © 2013-2017 Cyotek Ltd.
8 | // http://cyotek.com/blog/tag/colorpicker
9 |
10 | // Licensed under the MIT License. See license.txt for the full text.
11 |
12 | // If you use this code in your applications, donations or attribution are welcome
13 |
14 | ///
15 | /// Provides access to color comparison operations.
16 | ///
17 | public static class ColorComparer
18 | {
19 | #region Constants
20 |
21 | private const double BlueLuminance = 0.072187;
22 |
23 | private const double GreenLuminance = 0.715158;
24 |
25 | private const double RedLuminance = 0.212655;
26 |
27 | #endregion
28 |
29 | #region Static Methods
30 |
31 | ///
32 | /// Compares two colors by brightness and returns an indication of their relative sort order.
33 | ///
34 | /// A color to compare to y.
35 | /// A color to compare to x.
36 | public static int Brightness(Color x, Color y)
37 | {
38 | int v1;
39 | int v2;
40 | int result;
41 |
42 | v1 = GetBrightness(x);
43 | v2 = GetBrightness(y);
44 |
45 | if (v1 < v2)
46 | {
47 | result = -1;
48 | }
49 | else if (v1 > v2)
50 | {
51 | result = 1;
52 | }
53 | else
54 | {
55 | result = 0;
56 | }
57 |
58 | return result;
59 | }
60 |
61 | ///
62 | /// Compares two colors by hue and returns an indication of their relative sort order.
63 | ///
64 | /// A color to compare to y.
65 | /// A color to compare to x.
66 | public static int Hue(Color x, Color y)
67 | {
68 | float v1;
69 | float v2;
70 | int result;
71 |
72 | v1 = x.GetHue();
73 | v2 = y.GetHue();
74 |
75 | if (v1 < v2)
76 | {
77 | result = -1;
78 | }
79 | else if (v1 > v2)
80 | {
81 | result = 1;
82 | }
83 | else
84 | {
85 | result = 0;
86 | }
87 |
88 | return result;
89 | }
90 |
91 | ///
92 | /// Compares two colors by value and returns an indication of their relative sort order.
93 | ///
94 | /// A color to compare to y.
95 | /// A color to compare to x.
96 | public static int Value(Color x, Color y)
97 | {
98 | int v1;
99 | int v2;
100 | int result;
101 |
102 | v1 = x.R << 16 | x.G << 8 | x.B;
103 | v2 = y.R << 16 | y.G << 8 | y.B;
104 |
105 | if (v1 > v2)
106 | {
107 | result = -1;
108 | }
109 | else if (v1 < v2)
110 | {
111 | result = 1;
112 | }
113 | else
114 | {
115 | result = 0;
116 | }
117 |
118 | return result;
119 | }
120 |
121 | private static int GetBrightness(Color color)
122 | {
123 | //http://stackoverflow.com/a/13558570/148962
124 |
125 | // GRAY VALUE ("brightness")
126 |
127 | return GetGamma(RedLuminance * GetInverseGamma(color.R) + GreenLuminance * GetInverseGamma(color.G) + BlueLuminance * GetInverseGamma(color.B));
128 | }
129 |
130 | private static int GetGamma(double v)
131 | {
132 | // sRGB "gamma" function (approx 2.2)
133 |
134 | if (v <= 0.0031308)
135 | {
136 | v *= 12.92;
137 | }
138 | else
139 | {
140 | v = 1.055 * Math.Pow(v, 1.0 / 2.4) - 0.055;
141 | }
142 |
143 | return (int)(v * 255 + .5);
144 | }
145 |
146 | private static double GetInverseGamma(int ic)
147 | {
148 | double result;
149 |
150 | // Inverse of sRGB "gamma" function. (approx 2.2)
151 |
152 | var c = ic / 255.0;
153 | if (c <= 0.04045)
154 | {
155 | result = c / 12.92;
156 | }
157 | else
158 | {
159 | result = Math.Pow((c + 0.055) / 1.055, 2.4);
160 | }
161 |
162 | return result;
163 | }
164 |
165 | #endregion
166 | }
167 | }
168 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/ColorEditingMode.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.ColorPicker
2 | {
3 | // Cyotek Color Picker controls library
4 | // Copyright © 2013-2017 Cyotek Ltd.
5 | // http://cyotek.com/blog/tag/colorpicker
6 |
7 | // Licensed under the MIT License. See license.txt for the full text.
8 |
9 | // If you use this code in your applications, donations or attribution are welcome
10 |
11 | ///
12 | /// Specifies the edit mode of a .
13 | ///
14 | public enum ColorEditingMode
15 | {
16 | ///
17 | /// None. No editing is allowed.
18 | ///
19 | None,
20 |
21 | ///
22 | /// Only custom colors can be edited.
23 | ///
24 | CustomOnly,
25 |
26 | ///
27 | /// Custom or standard colors can be edited.
28 | ///
29 | Both
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/ColorGridSelectedCellStyle.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.ColorPicker
2 | {
3 | // Cyotek Color Picker controls library
4 | // Copyright © 2013-2017 Cyotek Ltd.
5 | // http://cyotek.com/blog/tag/colorpicker
6 |
7 | // Licensed under the MIT License. See license.txt for the full text.
8 |
9 | // If you use this code in your applications, donations or attribution are welcome
10 |
11 | ///
12 | /// Determines how the selected cell in a control is rendered.
13 | ///
14 | public enum ColorGridSelectedCellStyle
15 | {
16 | ///
17 | /// The selected cell is drawn no differently to any other cell.
18 | ///
19 | None,
20 |
21 | ///
22 | /// The selected cell displays a basic outline and focus rectangle.
23 | ///
24 | Standard,
25 |
26 | ///
27 | /// The selected cell is displayed larger than other cells
28 | ///
29 | Zoomed
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/ColorHitTestInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 |
3 | namespace AltUI.ColorPicker
4 | {
5 | // Cyotek Color Picker controls library
6 | // Copyright © 2013-2017 Cyotek Ltd.
7 | // http://cyotek.com/blog/tag/colorpicker
8 |
9 | // Licensed under the MIT License. See license.txt for the full text.
10 |
11 | // If you use this code in your applications, donations or attribution are welcome
12 |
13 | public class ColorHitTestInfo
14 | {
15 | #region Properties
16 |
17 | public Color Color { get; set; }
18 |
19 | public int Index { get; set; }
20 |
21 | public ColorSource Source { get; set; }
22 |
23 | #endregion
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/ColorPalette.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.ColorPicker
2 | {
3 | // Cyotek Color Picker controls library
4 | // Copyright © 2013-2017 Cyotek Ltd.
5 | // http://cyotek.com/blog/tag/colorpicker
6 |
7 | // Licensed under the MIT License. See license.txt for the full text.
8 |
9 | // If you use this code in your applications, donations or attribution are welcome
10 |
11 | public enum ColorPalette
12 | {
13 | None,
14 |
15 | Named,
16 |
17 | Office2010,
18 |
19 | Paint,
20 |
21 | Standard,
22 |
23 | WebSafe,
24 |
25 | Standard256
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/ColorPickerDialog.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
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 |
46 |
47 |
48 |
49 | text/microsoft-resx
50 |
51 |
52 | 2.0
53 |
54 |
55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
56 |
57 |
58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
59 |
60 |
61 | 17, 17
62 |
63 |
64 | 107, 17
65 |
66 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/ColorSliderNubStyle.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.ColorPicker
2 | {
3 | // Cyotek Color Picker controls library
4 | // Copyright © 2013-2017 Cyotek Ltd.
5 | // http://cyotek.com/blog/tag/colorpicker
6 |
7 | // Licensed under the MIT License. See license.txt for the full text.
8 |
9 | // If you use this code in your applications, donations or attribution are welcome
10 |
11 | public enum ColorSliderNubStyle
12 | {
13 | None,
14 |
15 | TopLeft,
16 |
17 | BottomRight
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/ColorSource.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.ColorPicker
2 | {
3 | // Cyotek Color Picker controls library
4 | // Copyright © 2013-2017 Cyotek Ltd.
5 | // http://cyotek.com/blog/tag/colorpicker
6 |
7 | // Licensed under the MIT License. See license.txt for the full text.
8 |
9 | // If you use this code in your applications, donations or attribution are welcome
10 |
11 | public enum ColorSource
12 | {
13 | None,
14 |
15 | Standard,
16 |
17 | Custom
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/EditColorCancelEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Drawing;
3 |
4 | namespace AltUI.ColorPicker
5 | {
6 | public class EditColorCancelEventArgs : CancelEventArgs
7 | {
8 | #region Constructors
9 |
10 | public EditColorCancelEventArgs(Color color, int colorIndex)
11 | {
12 | Color = color;
13 | ColorIndex = colorIndex;
14 | }
15 |
16 | protected EditColorCancelEventArgs()
17 | { }
18 |
19 | #endregion
20 |
21 | #region Properties
22 |
23 | public Color Color { get; protected set; }
24 |
25 | public int ColorIndex { get; protected set; }
26 |
27 | #endregion
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/HueColorSlider.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Drawing;
3 | using System.Linq;
4 |
5 | namespace AltUI.ColorPicker
6 | {
7 | // Cyotek Color Picker controls library
8 | // Copyright © 2013-2017 Cyotek Ltd.
9 | // http://cyotek.com/blog/tag/colorpicker
10 |
11 | // Licensed under the MIT License. See license.txt for the full text.
12 |
13 | // If you use this code in your applications, donations or attribution are welcome
14 |
15 | public class HueColorSlider : ColorSlider
16 | {
17 | #region Constructors
18 |
19 | public HueColorSlider()
20 | {
21 | BarStyle = ColorBarStyle.Custom;
22 | Maximum = 359;
23 | CustomColors = new ColorCollection(Enumerable.Range(0, 359).Select(h => HslColor.HslToRgb(h, 1, 0.5)));
24 | }
25 |
26 | #endregion
27 |
28 | #region Properties
29 |
30 | [Browsable(false)]
31 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
32 | public override ColorBarStyle BarStyle
33 | {
34 | get => base.BarStyle;
35 | set => base.BarStyle = value;
36 | }
37 |
38 | [Browsable(false)]
39 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
40 | public override Color Color1
41 | {
42 | get => base.Color1;
43 | set => base.Color1 = value;
44 | }
45 |
46 | [Browsable(false)]
47 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
48 | public override Color Color2
49 | {
50 | get => base.Color2;
51 | set => base.Color2 = value;
52 | }
53 |
54 | [Browsable(false)]
55 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
56 | public override Color Color3
57 | {
58 | get => base.Color3;
59 | set => base.Color3 = value;
60 | }
61 |
62 | [Browsable(false)]
63 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
64 | public override float Maximum
65 | {
66 | get => base.Maximum;
67 | set => base.Maximum = value;
68 | }
69 |
70 | [Browsable(false)]
71 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
72 | public override float Minimum
73 | {
74 | get => base.Minimum;
75 | set => base.Minimum = value;
76 | }
77 |
78 | public override float Value
79 | {
80 | get => base.Value;
81 | set => base.Value = (int)value;
82 | }
83 |
84 | #endregion
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/IColorEditor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 |
4 | namespace AltUI.ColorPicker
5 | {
6 | // Cyotek Color Picker controls library
7 | // Copyright © 2013-2017 Cyotek Ltd.
8 | // http://cyotek.com/blog/tag/colorpicker
9 |
10 | // Licensed under the MIT License. See license.txt for the full text.
11 |
12 | // If you use this code in your applications, donations or attribution are welcome
13 |
14 | ///
15 | /// Provides functionality required by color editors that are bindable
16 | ///
17 | [Obsolete("This interface will be removed in a future update.")]
18 | public interface IColorEditor
19 | {
20 | #region Events
21 |
22 | ///
23 | /// Occurs when the property is changed.
24 | ///
25 | event EventHandler ColorChanged;
26 |
27 | #endregion
28 |
29 | #region Properties
30 |
31 | ///
32 | /// Gets or sets the component color.
33 | ///
34 | /// The component color.
35 | Color Color { get; set; }
36 |
37 | #endregion
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/IPaletteSerializer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace AltUI.ColorPicker
5 | {
6 | // Cyotek Color Picker controls library
7 | // Copyright © 2013-2017 Cyotek Ltd.
8 | // http://cyotek.com/blog/tag/colorpicker
9 |
10 | // Licensed under the MIT License. See license.txt for the full text.
11 |
12 | // If you use this code in your applications, donations or attribution are welcome
13 |
14 | ///
15 | /// Serializes and deserializes color palettes into and from other documents.
16 | ///
17 | [Obsolete("This class will be removed in a future update to the library.")]
18 | public interface IPaletteSerializer
19 | {
20 | #region Properties
21 |
22 | ///
23 | /// Gets a value indicating whether this serializer can be used to read palettes.
24 | ///
25 | /// true if palettes can be read using this serializer; otherwise, false.
26 | bool CanRead { get; }
27 |
28 | ///
29 | /// Gets a value indicating whether this serializer can be used to write palettes.
30 | ///
31 | /// true if palettes can be written using this serializer; otherwise, false.
32 | bool CanWrite { get; }
33 |
34 | ///
35 | /// Gets the default extension for files generated with this palette format.
36 | ///
37 | /// The default extension for files generated with this palette format.
38 | string DefaultExtension { get; }
39 |
40 | ///
41 | /// Gets the maximum number of colors supported by this format.
42 | ///
43 | ///
44 | /// The maximum value number of colors supported by this format.
45 | ///
46 | int Maximum { get; }
47 |
48 | ///
49 | /// Gets the minimum numbers of colors supported by this format.
50 | ///
51 | ///
52 | /// The minimum number of colors supported by this format.
53 | ///
54 | int Minimum { get; }
55 |
56 | ///
57 | /// Gets a descriptive name of the palette format
58 | ///
59 | /// The descriptive name of the palette format.
60 | string Name { get; }
61 |
62 | #endregion
63 |
64 | #region Methods
65 |
66 | ///
67 | /// Determines whether this instance can read palette data from the specified stream.
68 | ///
69 | /// The stream.
70 | /// true if this instance can read palette data from the specified stream; otherwise, false.
71 | bool CanReadFrom(Stream stream);
72 |
73 | ///
74 | /// Deserializes the contained by the specified .
75 | ///
76 | /// The that contains the palette to deserialize.
77 | /// The being deserialized.
78 | ColorCollection Deserialize(Stream stream);
79 |
80 | ///
81 | /// Serializes the specified and writes the palette to a file using the specified .
82 | ///
83 | /// The used to write the palette.
84 | /// The to serialize.
85 | void Serialize(Stream stream, ColorCollection palette);
86 |
87 | #endregion
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/JascPaletteSerializer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace AltUI.ColorPicker
7 | {
8 | // Cyotek Color Picker controls library
9 | // Copyright © 2013-2017 Cyotek Ltd.
10 | // http://cyotek.com/blog/tag/colorpicker
11 |
12 | // Licensed under the MIT License. See license.txt for the full text.
13 |
14 | // If you use this code in your applications, donations or attribution are welcome
15 |
16 | ///
17 | /// Serializes and deserializes color palettes into and from the Jasc palette format.
18 | ///
19 | [Obsolete("This class will be removed in a future update to the library.")]
20 | public class JascPaletteSerializer : PaletteSerializer
21 | {
22 | #region Properties
23 |
24 | ///
25 | /// Gets the default extension for files generated with this palette format.
26 | ///
27 | /// The default extension for files generated with this palette format.
28 | public override string DefaultExtension
29 | {
30 | get => "pal";
31 | }
32 |
33 | ///
34 | /// Gets a descriptive name of the palette format
35 | ///
36 | /// The descriptive name of the palette format.
37 | public override string Name
38 | {
39 | get => "JASC Palette";
40 | }
41 |
42 | #endregion
43 |
44 | #region Methods
45 |
46 | ///
47 | /// Determines whether this instance can read palette from data the specified stream.
48 | ///
49 | /// The stream.
50 | /// true if this instance can read palette data from the specified stream; otherwise, false.
51 | public override bool CanReadFrom(Stream stream)
52 | {
53 | bool result;
54 |
55 | if (stream == null)
56 | {
57 | throw new ArgumentNullException(nameof(stream));
58 | }
59 |
60 | try
61 | {
62 | using StreamReader reader = new(stream);
63 | string header;
64 | string version;
65 |
66 | // check signature
67 | header = reader.ReadLine();
68 | version = reader.ReadLine();
69 |
70 | result = header == "JASC-PAL" && version == "0100";
71 | }
72 | catch
73 | {
74 | result = false;
75 | }
76 |
77 | return result;
78 | }
79 |
80 | ///
81 | /// Deserializes the contained by the specified .
82 | ///
83 | /// The that contains the palette to deserialize.
84 | /// The being deserialized.
85 | public override ColorCollection Deserialize(Stream stream)
86 | {
87 | ColorCollection results;
88 |
89 | if (stream == null)
90 | {
91 | throw new ArgumentNullException(nameof(stream));
92 | }
93 |
94 | results = new ColorCollection();
95 |
96 | using StreamReader reader = new(stream);
97 | string header;
98 | string version;
99 | int colorCount;
100 |
101 | // check signature
102 | header = reader.ReadLine();
103 | version = reader.ReadLine();
104 |
105 | if (header != "JASC-PAL" || version != "0100")
106 | {
107 | throw new InvalidDataException("Invalid palette file");
108 | }
109 |
110 | colorCount = Convert.ToInt32(reader.ReadLine());
111 | for (var i = 0; i < colorCount; i++)
112 | {
113 | int r;
114 | int g;
115 | int b;
116 | string data;
117 | string[] parts;
118 |
119 | data = reader.ReadLine();
120 | parts = !string.IsNullOrEmpty(data) ? data.Split(new[]
121 | {
122 | ' ',
123 | '\t'
124 | }, StringSplitOptions.RemoveEmptyEntries) : Array.Empty();
125 |
126 | if (!int.TryParse(parts[0], out r) || !int.TryParse(parts[1], out g) || !int.TryParse(parts[2], out b))
127 | {
128 | throw new InvalidDataException(string.Format("Invalid palette contents found with data '{0}'", data));
129 | }
130 |
131 | results.Add(Color.FromArgb(r, g, b));
132 | }
133 |
134 | return results;
135 | }
136 |
137 | ///
138 | /// Serializes the specified and writes the palette to a file using the specified .
139 | ///
140 | /// The used to write the palette.
141 | /// The to serialize.
142 | public override void Serialize(Stream stream, ColorCollection palette)
143 | {
144 | if (stream == null)
145 | {
146 | throw new ArgumentNullException(nameof(stream));
147 | }
148 |
149 | if (palette == null)
150 | {
151 | throw new ArgumentNullException(nameof(palette));
152 | }
153 |
154 | using StreamWriter writer = new(stream, Encoding.UTF8);
155 | writer.WriteLine("JASC-PAL");
156 | writer.WriteLine("0100");
157 | writer.WriteLine(palette.Count);
158 | foreach (var color in palette)
159 | {
160 | writer.Write("{0} ", color.R);
161 | writer.Write("{0} ", color.G);
162 | writer.Write("{0} ", color.B);
163 | writer.WriteLine();
164 | }
165 | }
166 |
167 | #endregion
168 | }
169 | }
170 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/LowLevelKeyboardProc.cs:
--------------------------------------------------------------------------------
1 | // Cyotek Color Picker Controls Library
2 | // http://cyotek.com/blog/tag/colorpicker
3 |
4 | // Copyright © 2021 Cyotek Ltd.
5 |
6 | // This work is licensed under the MIT License.
7 | // See LICENSE.TXT for the full text
8 |
9 | // Found this code useful?
10 | // https://www.cyotek.com/contribute
11 |
12 | using System;
13 |
14 | namespace AltUI.ColorPicker
15 | {
16 | internal delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam);
17 | }
18 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/LowLevelMouseProc.cs:
--------------------------------------------------------------------------------
1 | // Cyotek Color Picker Controls Library
2 | // http://cyotek.com/blog/tag/colorpicker
3 |
4 | // Copyright © 2021 Cyotek Ltd.
5 |
6 | // This work is licensed under the MIT License.
7 | // See LICENSE.TXT for the full text
8 |
9 | // Found this code useful?
10 | // https://www.cyotek.com/contribute
11 |
12 | using System;
13 |
14 | namespace AltUI.ColorPicker
15 | {
16 | internal delegate IntPtr LowLevelMouseProc(int nCode, IntPtr wParam, IntPtr lParam);
17 | }
18 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/NativeMethods.cs:
--------------------------------------------------------------------------------
1 | // Cyotek Color Picker Controls Library
2 | // http://cyotek.com/blog/tag/colorpicker
3 |
4 | // Copyright (c) 2013-2021 Cyotek Ltd.
5 |
6 | // This work is licensed under the MIT License.
7 | // See LICENSE.TXT for the full text
8 |
9 | // Found this code useful?
10 | // https://www.cyotek.com/contribute
11 |
12 | using System;
13 | using System.Drawing;
14 | using System.Runtime.InteropServices;
15 |
16 | namespace AltUI.ColorPicker
17 | {
18 | internal static class NativeMethods
19 | {
20 | #region Public Fields
21 |
22 | ///
23 | /// Logical pixels inch in X
24 | ///
25 | public const int LOGPIXELSX = 88;
26 |
27 | ///
28 | /// Logical pixels inch in Y
29 | ///
30 | public const int LOGPIXELSY = 90;
31 |
32 | public const int R2_NOT = 6;
33 |
34 | public const int WH_KEYBOARD_LL = 13;
35 |
36 | public const int WH_MOUSE_LL = 14;
37 |
38 | public const int WM_KEYDOWN = 0x0100;
39 |
40 | public const int WM_LBUTTONDOWN = 0x0201;
41 |
42 | public const int WM_MOUSEMOVE = 0x0200;
43 |
44 | public const int WM_NCLBUTTONDOWN = 0x00A1;
45 |
46 | #endregion Public Fields
47 |
48 | #region Private Fields
49 |
50 | private const string _gdi32DllName = "gdi32.dll";
51 |
52 | private const string _user32DllName = "user32.dll";
53 |
54 | #endregion Private Fields
55 |
56 | #region Public Methods
57 |
58 | [DllImport(_user32DllName, CharSet = CharSet.Auto, SetLastError = true)]
59 | public static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam);
60 |
61 | [DllImport(_user32DllName)]
62 | public static extern bool DrawFocusRect(IntPtr hDC, [In] ref RECT lprc);
63 |
64 | public static void DrawFocusRectangle(Graphics g, Rectangle rectangle)
65 | {
66 | DrawFocusRectangle(g, rectangle.Left, rectangle.Top, rectangle.Width, rectangle.Height);
67 | }
68 |
69 | public static void DrawFocusRectangle(Graphics g, int x, int y, int w, int h)
70 | {
71 | RECT rect;
72 |
73 | rect = new RECT(x, y, x + w, y + h);
74 |
75 | // The Win32 API DrawFocusRect draws using an inverted brush and so works on black,
76 | // whereas ControlPaint.DrawFocusRect decidedly does not
77 | DrawFocusRect(g.GetHdc(), ref rect);
78 | g.ReleaseHdc();
79 | }
80 |
81 | [DllImport(_user32DllName, EntryPoint = "GetDC", CallingConvention = CallingConvention.StdCall)]
82 | public static extern IntPtr GetDC(IntPtr hWnd);
83 |
84 | public static Point GetDesktopDpi()
85 | {
86 | IntPtr hWnd;
87 | IntPtr hDC;
88 | int dpix;
89 | int dpiy;
90 |
91 | hWnd = GetDesktopWindow();
92 | hDC = GetDC(hWnd);
93 |
94 | try
95 | {
96 | dpix = GetDeviceCaps(hDC, LOGPIXELSX);
97 | dpiy = GetDeviceCaps(hDC, LOGPIXELSY);
98 | }
99 | finally
100 | {
101 | ReleaseDC(hWnd, hDC);
102 | }
103 |
104 | return new Point(dpix, dpiy);
105 | }
106 |
107 | [DllImport(_user32DllName)]
108 | public static extern IntPtr GetDesktopWindow();
109 |
110 | [DllImport(_gdi32DllName)]
111 | public static extern int GetDeviceCaps(IntPtr hdc, int nIndex);
112 |
113 | [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
114 | public static extern IntPtr GetModuleHandle(string lpModuleName);
115 |
116 | [DllImport(_gdi32DllName, EntryPoint = "LineTo", CallingConvention = CallingConvention.StdCall)]
117 | public static extern bool LineTo(IntPtr hdc, int x, int y);
118 |
119 | [DllImport(_gdi32DllName, EntryPoint = "MoveToEx", CallingConvention = CallingConvention.StdCall)]
120 | public static extern bool MoveToEx(IntPtr hdc, int x, int y, IntPtr lpPoint);
121 |
122 | [DllImport(_user32DllName, EntryPoint = "ReleaseDC", CallingConvention = CallingConvention.StdCall)]
123 | public static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDC);
124 |
125 | [DllImport(_gdi32DllName, EntryPoint = "SetROP2", CallingConvention = CallingConvention.StdCall)]
126 | public static extern int SetROP2(IntPtr hdc, int fnDrawMode);
127 |
128 | [DllImport(_user32DllName, CharSet = CharSet.Auto, SetLastError = true)]
129 | public static extern IntPtr SetWindowsHookEx(int idHook, LowLevelKeyboardProc lpfn, IntPtr hMod, uint dwThreadId);
130 |
131 | [DllImport(_user32DllName, CharSet = CharSet.Auto, SetLastError = true)]
132 | public static extern IntPtr SetWindowsHookEx(int idHook, LowLevelMouseProc lpfn, IntPtr hMod, uint dwThreadId);
133 |
134 | [DllImport(_user32DllName, CharSet = CharSet.Auto, SetLastError = true)]
135 | [return: MarshalAs(UnmanagedType.Bool)]
136 | public static extern bool UnhookWindowsHookEx(IntPtr hhk);
137 |
138 | #endregion Public Methods
139 |
140 | #region Public Structs
141 |
142 | [StructLayout(LayoutKind.Sequential)]
143 | public struct RECT
144 | {
145 | public int left;
146 |
147 | public int top;
148 |
149 | public int right;
150 |
151 | public int bottom;
152 |
153 | public RECT(int left, int top, int right, int bottom)
154 | {
155 | this.left = left;
156 | this.top = top;
157 | this.right = right;
158 | this.bottom = bottom;
159 | }
160 | }
161 |
162 | #endregion Public Structs
163 | }
164 | }
165 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/NavigationOrigin.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.ColorPicker
2 | {
3 | // Cyotek Color Picker controls library
4 | // Copyright © 2013-2017 Cyotek Ltd.
5 | // http://cyotek.com/blog/tag/colorpicker
6 |
7 | // Licensed under the MIT License. See license.txt for the full text.
8 |
9 | // If you use this code in your applications, donations or attribution are welcome
10 |
11 | ///
12 | /// Specifies the origin of a navigation operation
13 | ///
14 | public enum NavigationOrigin
15 | {
16 | ///
17 | /// Specifies the beginning
18 | ///
19 | Begin,
20 |
21 | ///
22 | /// Specifies the current position
23 | ///
24 | Current,
25 |
26 | ///
27 | /// Specifies the end
28 | ///
29 | End
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/PaintHelper.cs:
--------------------------------------------------------------------------------
1 | // Cyotek Color Picker Controls Library
2 | // http://cyotek.com/blog/tag/colorpicker
3 |
4 | // Copyright © 2021 Cyotek Ltd.
5 |
6 | // This work is licensed under the MIT License.
7 | // See LICENSE.TXT for the full text
8 |
9 | // Found this code useful?
10 | // https://www.cyotek.com/contribute
11 |
12 | using System;
13 | using System.Drawing;
14 |
15 | namespace AltUI.ColorPicker
16 | {
17 | internal static class PaintHelper
18 | {
19 | #region Public Methods
20 |
21 | public static void DrawInvertedLine(Graphics g, Point start, Point end)
22 | {
23 | DrawInvertedLine(g, start.X, start.Y, end.X, end.Y);
24 | }
25 |
26 | public static void DrawInvertedLine(Graphics g, int x1, int y1, int x2, int y2)
27 | {
28 | IntPtr hdc;
29 |
30 | hdc = g.GetHdc();
31 | NativeMethods.SetROP2(hdc, NativeMethods.R2_NOT);
32 | NativeMethods.MoveToEx(hdc, x1, y1, IntPtr.Zero);
33 | NativeMethods.LineTo(hdc, x2, y2);
34 | g.ReleaseHdc(hdc);
35 | }
36 |
37 | public static void DrawInvertedRect(Graphics g, int x, int y, int w, int h)
38 | {
39 | IntPtr hdc;
40 |
41 | hdc = g.GetHdc();
42 | NativeMethods.SetROP2(hdc, NativeMethods.R2_NOT);
43 | NativeMethods.MoveToEx(hdc, x, y, IntPtr.Zero);
44 | NativeMethods.LineTo(hdc, x + w - 1, y);
45 | NativeMethods.LineTo(hdc, x + w - 1, y + h - 1);
46 | NativeMethods.LineTo(hdc, x, y + h - 1);
47 | NativeMethods.LineTo(hdc, x, y);
48 | g.ReleaseHdc(hdc);
49 | }
50 |
51 | #endregion Public Methods
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/RawPaletteSerializer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.IO;
4 |
5 | namespace AltUI.ColorPicker
6 | {
7 | // Cyotek Color Picker controls library
8 | // Copyright © 2013-2017 Cyotek Ltd.
9 | // http://cyotek.com/blog/tag/colorpicker
10 |
11 | // Licensed under the MIT License. See license.txt for the full text.
12 |
13 | // If you use this code in your applications, donations or attribution are welcome
14 |
15 | ///
16 | /// Serializes and deserializes 8bit color palettes from raw byte data.
17 | ///
18 | [Obsolete("This class will be removed in a future update to the library.")]
19 | public class RawPaletteSerializer : PaletteSerializer
20 | {
21 | #region Properties
22 |
23 | ///
24 | /// Gets the default extension for files generated with this palette format.
25 | ///
26 | /// The default extension for files generated with this palette format.
27 | public override string DefaultExtension
28 | {
29 | get => "pal";
30 | }
31 |
32 | ///
33 | /// Gets the maximum number of colors supported by this format.
34 | ///
35 | ///
36 | /// The maximum value number of colors supported by this format.
37 | ///
38 | public override int Maximum
39 | {
40 | get => 256;
41 | }
42 |
43 | ///
44 | /// Gets the minimum numbers of colors supported by this format.
45 | ///
46 | ///
47 | /// The minimum number of colors supported by this format.
48 | ///
49 | public override int Minimum
50 | {
51 | get => 256;
52 | }
53 |
54 | ///
55 | /// Gets a descriptive name of the palette format
56 | ///
57 | /// The descriptive name of the palette format.
58 | public override string Name
59 | {
60 | get => "Raw Palette";
61 | }
62 |
63 | #endregion
64 |
65 | #region Methods
66 |
67 | ///
68 | /// Determines whether this instance can read palette from data the specified stream.
69 | ///
70 | /// The stream.
71 | /// true if this instance can read palette data from the specified stream; otherwise, false.
72 | public override bool CanReadFrom(Stream stream)
73 | {
74 | bool result;
75 |
76 | if (stream == null)
77 | {
78 | throw new ArgumentNullException(nameof(stream));
79 | }
80 |
81 | try
82 | {
83 | result = stream.Length % 3 == 0;
84 | }
85 | catch
86 | {
87 | result = false;
88 | }
89 |
90 | return result;
91 | }
92 |
93 | ///
94 | /// Deserializes the contained by the specified .
95 | ///
96 | /// The that contains the palette to deserialize.
97 | /// The being deserialized.
98 | public override ColorCollection Deserialize(Stream stream)
99 | {
100 | ColorCollection results;
101 |
102 | if (stream == null)
103 | {
104 | throw new ArgumentNullException(nameof(stream));
105 | }
106 |
107 | results = new ColorCollection();
108 |
109 | for (var i = 0; i < stream.Length / 3; i++)
110 | {
111 | int r;
112 | int g;
113 | int b;
114 |
115 | r = stream.ReadByte();
116 | g = stream.ReadByte();
117 | b = stream.ReadByte();
118 |
119 | results.Add(Color.FromArgb(r, g, b));
120 | }
121 |
122 | return results;
123 | }
124 |
125 | ///
126 | /// Serializes the specified and writes the palette to a file using the specified .
127 | ///
128 | /// The used to write the palette.
129 | /// The to serialize.
130 | public override void Serialize(Stream stream, ColorCollection palette)
131 | {
132 | if (stream == null)
133 | {
134 | throw new ArgumentNullException(nameof(stream));
135 | }
136 |
137 | if (palette == null)
138 | {
139 | throw new ArgumentNullException(nameof(palette));
140 | }
141 |
142 | foreach (var color in palette)
143 | {
144 | stream.WriteByte(color.R);
145 | stream.WriteByte(color.G);
146 | stream.WriteByte(color.B);
147 | }
148 |
149 | stream.Flush();
150 | }
151 |
152 | #endregion
153 | }
154 | }
155 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/ResourceManager.cs:
--------------------------------------------------------------------------------
1 | // Cyotek Color Picker controls library
2 | // http://cyotek.com/blog/tag/colorpicker
3 |
4 | // Copyright © 2021 Cyotek Ltd.
5 |
6 | // This work is licensed under the MIT License.
7 | // See LICENSE.TXT for the full text
8 |
9 | // Found this code useful?
10 | // https://www.cyotek.com/contribute
11 |
12 | using System;
13 | using System.Drawing;
14 | using System.IO;
15 | using System.Reflection;
16 | using System.Windows.Forms;
17 | using AltUI.Config;
18 |
19 | namespace AltUI.ColorPicker
20 | {
21 | internal static class ResourceManager
22 | {
23 | #region Public Properties
24 |
25 | public static Image CellBackground => ThemeProvider.LightMode ? Resources.cellbackground : Resources.lcellbackground;
26 |
27 | public static Cursor EyeDropper => new(new MemoryStream(Resources.eyedroppercur));
28 |
29 | public static Image LoadPalette => Resources.palette_load;
30 |
31 | public static Image SavePalette => Resources.palette_save;
32 |
33 | public static Image ScreenPicker => Resources.eyedropper;
34 |
35 | #endregion Public Properties
36 | }
37 | }
38 | ;
--------------------------------------------------------------------------------
/AltUI/ColorPicker/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace AltUI.ColorPicker {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
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 | /// Returns the cached ResourceManager instance used by this class.
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("AltUI.ColorPicker.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
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 | /// Looks up a localized resource of type System.Drawing.Bitmap.
65 | ///
66 | internal static System.Drawing.Bitmap cellbackground {
67 | get {
68 | object obj = ResourceManager.GetObject("cellbackground", resourceCulture);
69 | return ((System.Drawing.Bitmap)(obj));
70 | }
71 | }
72 |
73 | ///
74 | /// Looks up a localized resource of type System.Drawing.Bitmap.
75 | ///
76 | internal static System.Drawing.Bitmap eyedropper {
77 | get {
78 | object obj = ResourceManager.GetObject("eyedropper", resourceCulture);
79 | return ((System.Drawing.Bitmap)(obj));
80 | }
81 | }
82 |
83 | ///
84 | /// Looks up a localized resource of type System.Byte[].
85 | ///
86 | internal static byte[] eyedroppercur {
87 | get {
88 | object obj = ResourceManager.GetObject("eyedroppercur", resourceCulture);
89 | return ((byte[])(obj));
90 | }
91 | }
92 |
93 | ///
94 | /// Looks up a localized resource of type System.Drawing.Bitmap.
95 | ///
96 | internal static System.Drawing.Bitmap lcellbackground {
97 | get {
98 | object obj = ResourceManager.GetObject("lcellbackground", resourceCulture);
99 | return ((System.Drawing.Bitmap)(obj));
100 | }
101 | }
102 |
103 | ///
104 | /// Looks up a localized resource of type System.Drawing.Bitmap.
105 | ///
106 | internal static System.Drawing.Bitmap palette_load {
107 | get {
108 | object obj = ResourceManager.GetObject("palette_load", resourceCulture);
109 | return ((System.Drawing.Bitmap)(obj));
110 | }
111 | }
112 |
113 | ///
114 | /// Looks up a localized resource of type System.Drawing.Bitmap.
115 | ///
116 | internal static System.Drawing.Bitmap palette_save {
117 | get {
118 | object obj = ResourceManager.GetObject("palette_save", resourceCulture);
119 | return ((System.Drawing.Bitmap)(obj));
120 | }
121 | }
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/RgbaChannel.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.ColorPicker
2 | {
3 | // Cyotek Color Picker controls library
4 | // Copyright © 2013-2017 Cyotek Ltd.
5 | // http://cyotek.com/blog/tag/colorpicker
6 |
7 | // Licensed under the MIT License. See license.txt for the full text.
8 |
9 | // If you use this code in your applications, donations or attribution are welcome
10 |
11 | public enum RgbaChannel
12 | {
13 | Red,
14 |
15 | Green,
16 |
17 | Blue,
18 |
19 | Alpha
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/AltUI/ColorPicker/ScreenColorPickerHooks.cs:
--------------------------------------------------------------------------------
1 | // Cyotek Color Picker Controls Library
2 | // http://cyotek.com/blog/tag/colorpicker
3 |
4 | // Copyright (c) 2021 Cyotek Ltd.
5 |
6 | // This work is licensed under the MIT License.
7 | // See LICENSE.TXT for the full text
8 |
9 | // Found this code useful?
10 | // https://www.cyotek.com/contribute
11 |
12 | // Mouse hook derived from https://docs.microsoft.com/en-us/archive/blogs/toub/low-level-mouse-hook-in-c
13 | // Keyboard hook derived from https://docs.microsoft.com/en-us/archive/blogs/toub/low-level-keyboard-hook-in-c
14 |
15 | using System;
16 | using System.ComponentModel;
17 | using System.Diagnostics;
18 | using System.Runtime.InteropServices;
19 | using System.Windows.Forms;
20 |
21 | namespace AltUI.ColorPicker
22 | {
23 | internal static class ScreenColorPickerHooks
24 | {
25 | #region Private Fields
26 |
27 | private static readonly LowLevelKeyboardProc _keyboardHookProc = KeyboardHookProc;
28 |
29 | private static readonly LowLevelMouseProc _mouseHookProc = MouseHookProc;
30 |
31 | private static IntPtr _keyboardHook = IntPtr.Zero;
32 |
33 | private static IntPtr _mouseHook = IntPtr.Zero;
34 |
35 | private static ScreenColorPicker _owner;
36 |
37 | #endregion Private Fields
38 |
39 | #region Public Methods
40 |
41 | public static void Capture(ScreenColorPicker owner)
42 | {
43 | Release();
44 |
45 | if (owner.MarkAsCapturing())
46 | {
47 | _mouseHook = SetHook(_mouseHookProc);
48 | _keyboardHook = SetHook(_keyboardHookProc);
49 |
50 | _owner = owner;
51 | }
52 | }
53 |
54 | public static void Release()
55 | {
56 | _owner?.MarkAsReleased();
57 | _owner = null;
58 |
59 | Release(ref _mouseHook);
60 | Release(ref _keyboardHook);
61 | }
62 |
63 | #endregion Public Methods
64 |
65 | #region Private Methods
66 |
67 | private static IntPtr KeyboardHookProc(int nCode, IntPtr wParam, IntPtr lParam)
68 | {
69 | IntPtr result;
70 |
71 | if (nCode >= 0 && wParam == (IntPtr)NativeMethods.WM_KEYDOWN)
72 | {
73 | if ((Keys)Marshal.ReadInt32(lParam) == Keys.Escape)
74 | {
75 | // if the user presses escape, abort the capture
76 | // but also eat the message so the press isn't intercepted
77 | Release();
78 |
79 | result = new IntPtr(1);
80 | }
81 | else
82 | {
83 | // do not eat, continue to next hook
84 | result = NativeMethods.CallNextHookEx(_mouseHook, nCode, wParam, lParam);
85 | }
86 | }
87 | else
88 | {
89 | // do not process, continue to next hook
90 | result = NativeMethods.CallNextHookEx(_mouseHook, nCode, wParam, lParam);
91 | }
92 |
93 | return result;
94 | }
95 |
96 | private static IntPtr MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam)
97 | {
98 | IntPtr result;
99 |
100 | if (nCode >= 0)
101 | {
102 | int message;
103 |
104 | message = wParam.ToInt32();
105 |
106 | if (message == NativeMethods.WM_MOUSEMOVE)
107 | {
108 | _owner.RequestUpdate();
109 | }
110 |
111 | if (message == NativeMethods.WM_LBUTTONDOWN || message == NativeMethods.WM_NCLBUTTONDOWN)
112 | {
113 | // if the user presses a button then update the colour, release,
114 | // but also eat the message so the click isn't intercepted
115 | _owner.UpdateColor();
116 | Release();
117 |
118 | result = new IntPtr(1);
119 | }
120 | else
121 | {
122 | // do not eat, continue to next hook
123 | result = NativeMethods.CallNextHookEx(_mouseHook, nCode, wParam, lParam);
124 | }
125 | }
126 | else
127 | {
128 | // do not process, continue to next hook
129 | result = NativeMethods.CallNextHookEx(_mouseHook, nCode, wParam, lParam);
130 | }
131 |
132 | return result;
133 | }
134 |
135 | private static void Release(ref IntPtr handle)
136 | {
137 | if (handle != IntPtr.Zero)
138 | {
139 | if (!NativeMethods.UnhookWindowsHookEx(handle))
140 | {
141 | throw new Win32Exception();
142 | }
143 |
144 | handle = IntPtr.Zero;
145 | }
146 | }
147 |
148 | private static IntPtr SetHook(LowLevelMouseProc proc)
149 | {
150 | using var curProcess = Process.GetCurrentProcess();
151 | using var curModule = curProcess.MainModule;
152 | return NativeMethods.SetWindowsHookEx(NativeMethods.WH_MOUSE_LL, proc, NativeMethods.GetModuleHandle(curModule.ModuleName), 0);
153 | }
154 |
155 | private static IntPtr SetHook(LowLevelKeyboardProc proc)
156 | {
157 | using var curProcess = Process.GetCurrentProcess();
158 | using var curModule = curProcess.MainModule;
159 | return NativeMethods.SetWindowsHookEx(NativeMethods.WH_KEYBOARD_LL, proc, NativeMethods.GetModuleHandle(curModule.ModuleName), 0);
160 | }
161 |
162 | #endregion Private Methods
163 | }
164 | }
165 |
--------------------------------------------------------------------------------
/AltUI/Config/Colors.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 |
3 | namespace AltUI.Config
4 | {
5 | public class Colors
6 | {
7 | public Color GreyBackground { get; set; }
8 |
9 | public Color HeaderBackground { get; set; }
10 |
11 | public Color BlueBackground { get; set; }
12 |
13 | public Color DarkBlueBackground { get; set; }
14 |
15 | public Color DarkBackground { get; set; }
16 |
17 | public Color MediumBackground { get; set; }
18 |
19 | public Color LightBackground { get; set; }
20 |
21 | public Color LighterBackground { get; set; }
22 |
23 | public Color LightestBackground { get; set; }
24 |
25 | public Color LightBorder { get; set; }
26 |
27 | public Color DarkBorder { get; set; }
28 |
29 | public Color LightText { get; set; }
30 |
31 | public Color DisabledText { get; set; }
32 |
33 | public Color BlueHighlight { get; set; }
34 |
35 | public Color BlueSelection { get; set; }
36 |
37 | public Color GreyHighlight { get; set; }
38 |
39 | public Color GreySelection { get; set; }
40 |
41 | public Color DarkGreySelection { get; set; }
42 |
43 | public Color DarkBlueBorder { get; set; }
44 |
45 | public Color LightBlueBorder { get; set; }
46 |
47 | public Color ActiveControl { get; set; }
48 |
49 | public Color OpaqueBackground { get; set; }
50 |
51 | public Color TransparentBackground { get; set; }
52 |
53 | public Color DefaultBackground { get; set; }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/AltUI/Config/Consts.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.Config
2 | {
3 | public sealed class Consts2
4 | {
5 | public static int Padding = 10;
6 |
7 | public static int ScrollBarSize = 15;
8 | public static int ArrowButtonSize = 15;
9 | public static int MinimumThumbSize = 11;
10 |
11 | public static int CheckBoxSize = 12;
12 | public static int RadioButtonSize = 12;
13 |
14 | public const int ToolWindowHeaderSize = 25;
15 | public const int DocumentTabAreaSize = 24;
16 | public const int ToolWindowTabAreaSize = 21;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/AltUI/Config/DarkTheme.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 |
3 | namespace AltUI.Config
4 | {
5 | public class DarkTheme : ITheme
6 | {
7 | public Sizes Sizes { get; } = new Sizes();
8 |
9 | public Colors Colors { get; } = new Colors();
10 |
11 | public DarkTheme()
12 | {
13 | Colors.GreyBackground = ThemeProvider.BackgroundColour; //Form Background
14 | Colors.HeaderBackground = Color.FromArgb(22, 22, 22); // List Alt Colour
15 | Colors.BlueBackground = Color.FromArgb(66, 77, 95);
16 | Colors.DarkBlueBackground = Color.FromArgb(52, 57, 66);
17 | Colors.DarkBackground = Color.FromArgb(47, 47, 47); // Control Clicked
18 | Colors.MediumBackground = Color.FromArgb(49, 51, 53);
19 | Colors.LightBackground = Color.FromArgb(26, 26, 28); // Control Colour
20 | Colors.LighterBackground = Color.FromArgb(33, 33, 35); // Control Hover
21 | Colors.LightestBackground = Color.FromArgb(230, 230, 230);
22 | Colors.LightBorder = Color.FromArgb(81, 81, 81);
23 | Colors.DarkBorder = Color.FromArgb(32, 32, 32);
24 | Colors.LightText = Color.FromArgb(213, 213, 213); // Normal Text
25 | Colors.DisabledText = Color.FromArgb(101, 101, 101); // Disabled Text
26 | Colors.BlueHighlight = ThemeProvider.GetAccentColor(0); // Blue Borders
27 | Colors.BlueSelection = ThemeProvider.GetAccentColor(0); // DropDown Selection
28 | Colors.GreyHighlight = Color.FromArgb(146, 146, 146); // ComboBox Arrow
29 | Colors.GreySelection = Color.FromArgb(48, 48, 52); // Control Border
30 | Colors.DarkGreySelection = Color.FromArgb(82, 82, 82);
31 | Colors.DarkBlueBorder = Color.FromArgb(51, 61, 78);
32 | Colors.LightBlueBorder = Color.FromArgb(86, 97, 114);
33 | Colors.ActiveControl = Color.FromArgb(159, 178, 196);
34 | Colors.OpaqueBackground = Color.FromArgb(28, 28, 30);
35 | Colors.TransparentBackground = Color.FromArgb(31, 31, 32);
36 | Colors.DefaultBackground = Color.FromArgb(16, 16, 17);
37 |
38 | Sizes.Padding = 10;
39 | Sizes.ScrollBarSize = 15;
40 | Sizes.ArrowButtonSize = 15;
41 | Sizes.MinimumThumbSize = 11;
42 | Sizes.CheckBoxSize = 12;
43 | Sizes.RadioButtonSize = 12;
44 | Sizes.ToolWindowHeaderSize = 25;
45 | Sizes.DocumentTabAreaSize = 24;
46 | Sizes.ToolWindowTabAreaSize = 21;
47 |
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/AltUI/Config/ITheme.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.Config
2 | {
3 | public interface ITheme
4 | {
5 | Sizes Sizes { get; }
6 |
7 | Colors Colors { get; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/AltUI/Config/LightTheme.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 |
3 | namespace AltUI.Config
4 | {
5 | public class LightTheme : ITheme
6 | {
7 | public Sizes Sizes { get; } = new Sizes();
8 |
9 | public Colors Colors { get; } = new Colors();
10 |
11 | public LightTheme()
12 | {
13 | Colors.GreyBackground = ThemeProvider.BackgroundColour; //Form Background
14 | Colors.HeaderBackground = Color.FromArgb(177, 180, 182);
15 | Colors.BlueBackground = Color.FromArgb(186, 197, 215);
16 | Colors.DarkBlueBackground = Color.FromArgb(172, 177, 186);
17 | Colors.DarkBackground = Color.FromArgb(160, 160, 160);
18 | Colors.MediumBackground = Color.FromArgb(169, 171, 173);
19 | Colors.LightBackground = Color.FromArgb(238, 238, 242); // Control Colour
20 | Colors.LighterBackground = Color.FromArgb(226, 226, 226); // Control Hover
21 | Colors.LightestBackground = Color.FromArgb(0, 0, 0);
22 | Colors.LightBorder = Color.FromArgb(201, 201, 201);
23 | Colors.DarkBorder = Color.FromArgb(220, 220, 220);
24 | Colors.LightText = Color.FromArgb(30, 30, 30); // Normal Text
25 | Colors.DisabledText = Color.FromArgb(113, 113, 113); // Disabled Text
26 | Colors.BlueHighlight = ThemeProvider.GetAccentColor(50); // Selected Control Borders
27 | Colors.BlueSelection = ThemeProvider.GetAccentColor(0); // DropDown Selection
28 | Colors.GreyHighlight = Color.FromArgb(113, 113, 113); // ComboBox Arrow
29 | Colors.GreySelection = Color.FromArgb(204, 206, 219); // Control Border
30 | Colors.DarkGreySelection = Color.FromArgb(202, 202, 202);
31 | Colors.DarkBlueBorder = Color.FromArgb(171, 181, 198);
32 | Colors.LightBlueBorder = Color.FromArgb(206, 217, 114);
33 | Colors.ActiveControl = Color.FromArgb(159, 178, 196);
34 | Colors.TransparentBackground = Color.FromArgb(231, 231, 232);
35 | Colors.DefaultBackground = Color.FromArgb(255, 255, 255);
36 |
37 | Sizes.Padding = 10;
38 | Sizes.ScrollBarSize = 15;
39 | Sizes.ArrowButtonSize = 15;
40 | Sizes.MinimumThumbSize = 11;
41 | Sizes.CheckBoxSize = 12;
42 | Sizes.RadioButtonSize = 12;
43 | Sizes.ToolWindowHeaderSize = 25;
44 | Sizes.DocumentTabAreaSize = 24;
45 | Sizes.ToolWindowTabAreaSize = 21;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/AltUI/Config/Sizes.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.Config
2 | {
3 | public class Sizes
4 | {
5 | public int Padding { get; set; } = 10;
6 |
7 | public int ScrollBarSize { get; set; } = 15;
8 | public int ArrowButtonSize { get; set; } = 15;
9 | public int MinimumThumbSize { get; set; } = 11;
10 |
11 | public int CheckBoxSize { get; set; } = 12;
12 | public int RadioButtonSize { get; set; } = 12;
13 |
14 | public int ToolWindowHeaderSize { get; set; } = 25;
15 | public int DocumentTabAreaSize { get; set; } = 24;
16 | public int ToolWindowTabAreaSize { get; set; } = 21;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkButtonStyle.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.Controls
2 | {
3 | public enum DarkButtonStyle
4 | {
5 | Normal,
6 | Flat,
7 | Image
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkContentAlignment.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.Controls
2 | {
3 | public enum DarkContentAlignment
4 | {
5 | Center,
6 | Left,
7 | Right
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkContextMenu.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 | using AltUI.Renderers;
3 |
4 | namespace AltUI.Controls
5 | {
6 | public class DarkContextMenu : ContextMenuStrip
7 | {
8 | #region Constructor Region
9 |
10 | public DarkContextMenu()
11 | {
12 | Renderer = new DarkMenuRenderer();
13 | }
14 |
15 | #endregion
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkControlState.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.Controls
2 | {
3 | public enum DarkControlState
4 | {
5 | Normal,
6 | Hover,
7 | Pressed
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkDropdownItem.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 |
3 | namespace AltUI.Controls
4 | {
5 | public class DarkDropdownItem
6 | {
7 | #region Property Region
8 |
9 | public string Text { get; set; }
10 |
11 | public Bitmap Icon { get; set; }
12 |
13 | #endregion
14 |
15 | #region Constructor Region
16 |
17 | public DarkDropdownItem()
18 | { }
19 |
20 | public DarkDropdownItem(string text)
21 | {
22 | Text = text;
23 | }
24 |
25 | public DarkDropdownItem(string text, Bitmap icon)
26 | : this(text)
27 | {
28 | Icon = icon;
29 | }
30 |
31 | #endregion
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkGroupBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Drawing;
4 | using System.Drawing.Drawing2D;
5 | using System.Windows.Forms;
6 | using AltUI.Config;
7 |
8 | namespace AltUI.Controls
9 | {
10 | public class DarkGroupBox : GroupBox
11 | {
12 | #region Field Region
13 |
14 | private bool _opaqueBackground;
15 |
16 | #endregion
17 |
18 | #region Property Region
19 |
20 | [Category("Appearance")]
21 | [Description("Determines whether the background of the GroupBox should be filled in.")]
22 | [DefaultValue(false)]
23 | public bool OpaqueBackground
24 | {
25 | get => _opaqueBackground;
26 | set
27 | {
28 | _opaqueBackground = value;
29 | Invalidate();
30 | }
31 | }
32 |
33 | #endregion
34 |
35 | public DarkGroupBox()
36 | {
37 | SetStyle(ControlStyles.OptimizedDoubleBuffer |
38 | ControlStyles.ResizeRedraw |
39 | ControlStyles.UserPaint, true);
40 |
41 | ResizeRedraw = true;
42 | DoubleBuffered = true;
43 | }
44 |
45 | protected override void OnPaint(PaintEventArgs e)
46 | {
47 | var g = e.Graphics;
48 | var rect = new Rectangle(0, 0, ClientSize.Width, ClientSize.Height);
49 | var stringSize = g.MeasureString(Text, Font);
50 |
51 | var borderColor = ThemeProvider.Theme.Colors.GreySelection;
52 | var textColor = ThemeProvider.Theme.Colors.LightText;
53 | var fillColor = ThemeProvider.Theme.Colors.GreyBackground;
54 |
55 | using (var b = new SolidBrush(fillColor))
56 | {
57 | g.FillRectangle(b, rect);
58 | }
59 |
60 | using (var p = new Pen(borderColor, 1))
61 | {
62 | var borderRect = new Rectangle(0, (int)stringSize.Height / 2, rect.Width - 1, rect.Height - ((int)stringSize.Height / 2) - 1);
63 | g.SmoothingMode = SmoothingMode.AntiAlias;
64 | if (_opaqueBackground)
65 | g.FillRoundedRectangle(new SolidBrush(ThemeProvider.Theme.Colors.LightBackground), borderRect, 4);
66 | g.DrawRoundedRectangle(p, borderRect, 4);
67 | g.SmoothingMode = SmoothingMode.None;
68 | }
69 |
70 | var textRect = new Rectangle(rect.Left + ThemeProvider.Theme.Sizes.Padding,
71 | rect.Top,
72 | rect.Width - (ThemeProvider.Theme.Sizes.Padding * 2),
73 | (int)stringSize.Height);
74 |
75 | using (var b2 = new SolidBrush(ThemeProvider.Theme.Colors.GreyBackground))
76 | {
77 | var modRect = new Rectangle(textRect.Left, textRect.Top, Math.Min(textRect.Width, (int)stringSize.Width), textRect.Height);
78 | g.FillRectangle(b2, modRect);
79 | }
80 |
81 | using (var b = new SolidBrush(textColor))
82 | {
83 | var stringFormat = new StringFormat
84 | {
85 | LineAlignment = StringAlignment.Center,
86 | Alignment = StringAlignment.Near,
87 | FormatFlags = StringFormatFlags.NoWrap,
88 | Trimming = StringTrimming.EllipsisCharacter
89 | };
90 |
91 | g.DrawString(Text, Font, b, textRect, stringFormat);
92 | }
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkLabel.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 | using AltUI.Config;
5 |
6 | namespace AltUI.Controls
7 | {
8 | public class DarkLabel : Label
9 | {
10 | #region Field Region
11 |
12 | private bool _autoUpdateHeight;
13 | private bool _isGrowing;
14 |
15 | private DarkControlState _controlState = DarkControlState.Normal;
16 |
17 | #endregion
18 |
19 | #region Property Region
20 | [Category("Layout")]
21 | [Description("Enables automatic height sizing based on the contents of the label.")]
22 | [DefaultValue(false)]
23 | public bool AutoUpdateHeight
24 | {
25 | get => _autoUpdateHeight;
26 | set
27 | {
28 | _autoUpdateHeight = value;
29 |
30 | if (_autoUpdateHeight)
31 | {
32 | AutoSize = false;
33 | ResizeLabel();
34 | }
35 | }
36 | }
37 |
38 | #endregion
39 |
40 |
41 | #region Constructor Region
42 |
43 | private void ResizeLabel()
44 | {
45 | if (!_autoUpdateHeight || _isGrowing)
46 | return;
47 |
48 | try
49 | {
50 | _isGrowing = true;
51 | var sz = new Size(Width, int.MaxValue);
52 | sz = TextRenderer.MeasureText(Text, Font, sz, TextFormatFlags.WordBreak);
53 | Height = sz.Height;
54 | }
55 | finally
56 | {
57 | _isGrowing = false;
58 | }
59 | }
60 |
61 | public DarkLabel()
62 | {
63 | SetStyle(ControlStyles.SupportsTransparentBackColor |
64 | ControlStyles.OptimizedDoubleBuffer |
65 | ControlStyles.ResizeRedraw |
66 | ControlStyles.UserPaint, true);
67 | }
68 |
69 | #endregion
70 |
71 | #region Method Region
72 |
73 | private void SetControlState(DarkControlState controlState)
74 | {
75 | if (_controlState != controlState)
76 | {
77 | _controlState = controlState;
78 | Invalidate();
79 | }
80 | }
81 |
82 | #endregion
83 |
84 | #region Paint Region
85 |
86 | protected override void OnPaint(PaintEventArgs e)
87 | {
88 | var g = e.Graphics;
89 | var rect = new Rectangle(0, 0, ClientSize.Width, ClientSize.Height);
90 |
91 | var textColor = ThemeProvider.Theme.Colors.LightText;
92 |
93 | if (!Enabled)
94 | {
95 | textColor = ThemeProvider.Theme.Colors.DisabledText;
96 | }
97 |
98 | using (var b = new SolidBrush(BackColor))
99 | {
100 | g.FillRectangle(b, rect);
101 | }
102 |
103 | using (var b = new SolidBrush(textColor))
104 | {
105 | var stringFormat = new StringFormat
106 | {
107 | LineAlignment = StringAlignment.Center,
108 | Alignment = StringAlignment.Near
109 | };
110 | var modRect = new Rectangle(0, 0, rect.Width + (int)g.MeasureString("E", Font).Width, rect.Height);
111 | g.DrawString(Text, Font, b, modRect, stringFormat);
112 | }
113 | }
114 |
115 | #endregion
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkListBox.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 | using AltUI.Config;
3 |
4 | namespace AltUI.Controls
5 | {
6 | public class DarkListBox : ListBox
7 | {
8 | #region Constructor Region
9 |
10 | public DarkListBox()
11 | {
12 | BackColor = ThemeProvider.Theme.Colors.LightBackground;
13 | ForeColor = ThemeProvider.Theme.Colors.LightText;
14 | BorderStyle = BorderStyle.FixedSingle;
15 | }
16 |
17 | #endregion
18 | }
19 | }
--------------------------------------------------------------------------------
/AltUI/Controls/DarkListItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 |
4 | namespace AltUI.Controls
5 | {
6 | public class DarkListItem
7 | {
8 | #region Event Region
9 |
10 | public event EventHandler TextChanged;
11 |
12 | #endregion
13 |
14 | #region Field Region
15 |
16 | private string _text;
17 |
18 | #endregion
19 |
20 | #region Property Region
21 |
22 | public string Text
23 | {
24 | get => _text;
25 | set
26 | {
27 | _text = value;
28 |
29 | if (TextChanged != null)
30 | TextChanged(this, new EventArgs());
31 | }
32 | }
33 |
34 | public Rectangle Area { get; set; }
35 |
36 | //public Color TextColor { get; set; }
37 |
38 | public FontStyle FontStyle { get; set; }
39 |
40 | public Bitmap Icon { get; set; }
41 |
42 | public object Tag { get; set; }
43 |
44 | #endregion
45 |
46 | #region Constructor Region
47 |
48 | public DarkListItem()
49 | {
50 | //TextColor = ThemeProvider.Theme.Colors.LightText;
51 | FontStyle = FontStyle.Regular;
52 | }
53 |
54 | public DarkListItem(string text)
55 | : this()
56 | {
57 | Text = text;
58 | }
59 |
60 | #endregion
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkMenuStrip.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 | using AltUI.Renderers;
3 |
4 | namespace AltUI.Controls
5 | {
6 | public class DarkMenuStrip : MenuStrip
7 | {
8 | #region Constructor Region
9 |
10 | public DarkMenuStrip()
11 | {
12 | Renderer = new DarkMenuRenderer();
13 | Padding = new Padding(3, 2, 0, 2);
14 | }
15 |
16 | #endregion
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkProgressBar.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Drawing.Drawing2D;
4 | using System.Windows.Forms;
5 | using AltUI.Config;
6 |
7 | namespace AltUI.Controls
8 | {
9 | public class DarkProgressBar : ProgressBar
10 | {
11 | private string _text;
12 | public override string Text
13 | {
14 | get => _text;
15 | set { _text = value; Invalidate(); }
16 | }
17 | public DarkProgressBar()
18 | {
19 | SetStyle(ControlStyles.UserPaint, true);
20 | SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
21 | }
22 |
23 | protected override void OnPaint(PaintEventArgs e)
24 | {
25 | var g = e.Graphics;
26 | g.SmoothingMode = SmoothingMode.AntiAlias;
27 | g.Clip = new Region(ClientRectangle);
28 | var modRect = new Rectangle(0, 0, Width - 1, Height + 1);
29 | using (var b = new SolidBrush(ThemeProvider.Theme.Colors.GreyBackground))
30 | {
31 | g.FillRectangle(b, ClientRectangle);
32 | }
33 | using (var b = new SolidBrush(ThemeProvider.Theme.Colors.LightBackground))
34 | {
35 | g.FillRoundedRectangle(b, modRect, 4);
36 | }
37 | using (var b = new SolidBrush(ThemeProvider.Theme.Colors.BlueHighlight))
38 | {
39 | var barWidth = (int)(modRect.Width * ((double)Value / Maximum));
40 | var barRect = new Rectangle(0, 0, barWidth, modRect.Height - 2);
41 | switch (barWidth)
42 | { case 0:
43 | goto skip;
44 | case 1:
45 | barRect = new Rectangle(0, modRect.Y + 1, barWidth, modRect.Height - 2);
46 | break;
47 | case 2:
48 | barRect = new Rectangle(0, modRect.Y + 2, barWidth, modRect.Height - 4);
49 | break; }
50 | modRect.Height -= 2;
51 | g.FillRoundedRectangle(b, barRect, 4);
52 | }
53 | skip:
54 | using (var p = new Pen(ThemeProvider.Theme.Colors.GreySelection))
55 | {
56 | g.DrawRoundedRectangle(p, modRect, 4);
57 | }
58 | base.OnPaint(e);
59 | using (var p = new Pen(ThemeProvider.Theme.Colors.LightText))
60 | {
61 | g.DrawString(Text, Font, p.Brush, new Point(modRect.X + 2, modRect.Height / 2 - Font.Height / 2));
62 | }
63 | }
64 | protected override void OnVisibleChanged(EventArgs e)
65 | {
66 | Invalidate();
67 | base.OnVisibleChanged(e);
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/AltUI/Controls/DarkRichTextBox.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Windows.Forms;
3 | using AltUI.Config;
4 |
5 | namespace AltUI.Controls
6 | {
7 | public class DarkRichTextBox : RichTextBox
8 | {
9 | [Browsable(false)]
10 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
11 | public bool HasFocus => Focused;
12 |
13 | public DarkRichTextBox()
14 | {
15 | BackColor = ThemeProvider.Theme.Colors.GreyBackground;
16 | ForeColor = ThemeProvider.Theme.Colors.LightText;
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/AltUI/Controls/DarkScrollOrientation.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.Controls
2 | {
3 | public enum DarkScrollOrientation
4 | {
5 | Vertical,
6 | Horizontal
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkScrollView.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 | using AltUI.Config;
4 |
5 | namespace AltUI.Controls
6 | {
7 | public abstract class DarkScrollView : DarkScrollBase
8 | {
9 | #region Constructor Region
10 |
11 | protected DarkScrollView()
12 | {
13 | SetStyle(ControlStyles.OptimizedDoubleBuffer |
14 | ControlStyles.ResizeRedraw |
15 | ControlStyles.UserPaint, true);
16 | }
17 |
18 | #endregion
19 |
20 | #region Paint Region
21 |
22 | protected abstract void PaintContent(Graphics g);
23 |
24 | protected override void OnPaint(PaintEventArgs e)
25 | {
26 | var g = e.Graphics;
27 |
28 | // Draw background
29 | using (var b = new SolidBrush(ThemeProvider.Theme.Colors.GreyBackground))
30 | {
31 | g.FillRectangle(b, ClientRectangle);
32 | }
33 |
34 | // Offset the graphics based on the viewport, render the control contents, then reset it.
35 | g.TranslateTransform(Viewport.Left * -1, Viewport.Top * -1);
36 |
37 | PaintContent(g);
38 |
39 | g.TranslateTransform(Viewport.Left, Viewport.Top);
40 |
41 | // Draw the bit where the scrollbars meet
42 | if (_vScrollBar.Visible && _hScrollBar.Visible)
43 | {
44 | using var b = new SolidBrush(ThemeProvider.Theme.Colors.GreyBackground);
45 | var rect = new Rectangle(_hScrollBar.Right, _vScrollBar.Bottom, _vScrollBar.Width,
46 | _hScrollBar.Height);
47 |
48 | g.FillRectangle(b, rect);
49 | }
50 | }
51 |
52 | protected override void OnPaintBackground(PaintEventArgs e)
53 | {
54 | // Absorb event
55 | }
56 |
57 | #endregion
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkSectionPanel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Drawing;
4 | using System.Drawing.Drawing2D;
5 | using System.Windows.Forms;
6 | using AltUI.Config;
7 |
8 | namespace AltUI.Controls
9 | {
10 | public class DarkSectionPanel : Panel
11 | {
12 | #region Field Region
13 |
14 | private string _sectionHeader;
15 |
16 | #endregion
17 |
18 | #region Property Region
19 |
20 | [Browsable(false)]
21 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
22 | public new Padding Padding => base.Padding;
23 |
24 | [Category("Appearance")]
25 | [Description("The section header text associated with this control.")]
26 | public string SectionHeader
27 | {
28 | get => _sectionHeader;
29 | set
30 | {
31 | _sectionHeader = value;
32 | Invalidate();
33 | }
34 | }
35 |
36 | #endregion
37 |
38 | #region Constructor Region
39 |
40 | public DarkSectionPanel()
41 | {
42 | SetStyle(ControlStyles.OptimizedDoubleBuffer |
43 | ControlStyles.ResizeRedraw |
44 | ControlStyles.UserPaint, true);
45 | BackColor = ThemeProvider.Theme.Colors.OpaqueBackground;
46 | foreach (Control c in Controls)
47 | {
48 | c.BackColor = ThemeProvider.Theme.Colors.OpaqueBackground;
49 | }
50 |
51 | base.Padding = new Padding(1, 25, 1, 1);
52 | }
53 |
54 | #endregion
55 |
56 | #region Event Handler Region
57 |
58 | protected override void OnEnter(EventArgs e)
59 | {
60 | base.OnEnter(e);
61 |
62 | Invalidate();
63 | }
64 |
65 | protected override void OnLeave(EventArgs e)
66 | {
67 | base.OnLeave(e);
68 |
69 | Invalidate();
70 | }
71 |
72 | protected override void OnMouseDown(MouseEventArgs e)
73 | {
74 | base.OnMouseDown(e);
75 |
76 | if (Controls.Count > 0)
77 | Controls[0].Focus();
78 | }
79 |
80 | #endregion
81 |
82 | #region Paint Region
83 |
84 | protected override void OnPaint(PaintEventArgs e)
85 | {
86 | var g = e.Graphics;
87 | var rect = ClientRectangle;
88 |
89 | // Fill body
90 | using (var b = new SolidBrush(ThemeProvider.BackgroundColour))
91 | {
92 | g.FillRectangle(b, rect);
93 | }
94 |
95 | // Draw header
96 | var bgColor = ContainsFocus ? ThemeProvider.Theme.Colors.BlueBackground : ThemeProvider.Theme.Colors.HeaderBackground;
97 | var borderColor = ContainsFocus ? ThemeProvider.Theme.Colors.DarkBlueBorder : ThemeProvider.Theme.Colors.GreySelection;
98 |
99 | using (var b = new SolidBrush(bgColor))
100 | {
101 | var bgRect = new Rectangle(0, 0, rect.Width -1, 25);
102 | g.FillRoundedRectangle(b, bgRect, 4, true);
103 | }
104 |
105 | using (var p = new Pen(borderColor))
106 | {
107 | g.DrawLine(p, rect.Left, 25 - 1, rect.Right, 25 - 1);
108 | }
109 |
110 | var xOffset = 3;
111 |
112 | using (var b = new SolidBrush(ThemeProvider.Theme.Colors.LightText))
113 | {
114 | var textRect = new Rectangle(xOffset, 0, rect.Width - 4 - xOffset, 25);
115 |
116 | var format = new StringFormat
117 | {
118 | Alignment = StringAlignment.Near,
119 | LineAlignment = StringAlignment.Center,
120 | FormatFlags = StringFormatFlags.NoWrap,
121 | Trimming = StringTrimming.EllipsisCharacter
122 | };
123 |
124 | g.DrawString(SectionHeader, Font, b, textRect, format);
125 | }
126 |
127 | // Draw border
128 | using (var p = new Pen(borderColor, 1))
129 | {
130 | var modRect = new Rectangle(rect.Left, rect.Top, rect.Width - 1, rect.Height - 1);
131 | g.SmoothingMode = SmoothingMode.AntiAlias;
132 | g.DrawRoundedRectangle(p, modRect,4);
133 | g.SmoothingMode = SmoothingMode.None;
134 | }
135 | }
136 |
137 | protected override void OnPaintBackground(PaintEventArgs e)
138 | {
139 | // Absorb event
140 | }
141 |
142 | #endregion
143 | }
144 | }
145 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkSeparator.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 | using AltUI.Config;
4 |
5 | namespace AltUI.Controls
6 | {
7 | public class DarkSeparator : Control
8 | {
9 | #region Constructor Region
10 |
11 | public DarkSeparator()
12 | {
13 | SetStyle(ControlStyles.Selectable, false);
14 |
15 | Dock = DockStyle.Top;
16 | Size = new Size(1, 2);
17 | }
18 |
19 | #endregion
20 |
21 | #region Paint Region
22 |
23 | protected override void OnPaint(PaintEventArgs e)
24 | {
25 | var g = e.Graphics;
26 |
27 | using (var p = new Pen(ThemeProvider.Theme.Colors.DarkBorder))
28 | {
29 | g.DrawLine(p, ClientRectangle.Left, 0, ClientRectangle.Right, 0);
30 | }
31 |
32 | using (var p = new Pen(ThemeProvider.Theme.Colors.LightBorder))
33 | {
34 | g.DrawLine(p, ClientRectangle.Left, 1, ClientRectangle.Right, 1);
35 | }
36 | }
37 |
38 | protected override void OnPaintBackground(PaintEventArgs e)
39 | {
40 | // Absorb event
41 | }
42 |
43 | #endregion
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkStatusStrip.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 | using AltUI.Config;
4 |
5 | namespace AltUI.Controls
6 | {
7 | public class DarkStatusStrip : StatusStrip
8 | {
9 | #region Constructor Region
10 |
11 | public DarkStatusStrip()
12 | {
13 | AutoSize = false;
14 | BackColor = ThemeProvider.Theme.Colors.GreyBackground;
15 | ForeColor = ThemeProvider.Theme.Colors.LightText;
16 | Padding = new Padding(0, 5, 0, 3);
17 | Size = new Size(Size.Width, 24);
18 | SizingGrip = false;
19 | }
20 |
21 | #endregion
22 |
23 | #region Paint Region
24 |
25 | protected override void OnPaintBackground(PaintEventArgs e)
26 | {
27 | var g = e.Graphics;
28 |
29 | using (var b = new SolidBrush(ThemeProvider.Theme.Colors.GreyBackground))
30 | {
31 | g.FillRectangle(b, ClientRectangle);
32 | }
33 |
34 | using (var p = new Pen(ThemeProvider.Theme.Colors.DarkBorder))
35 | {
36 | g.DrawLine(p, ClientRectangle.Left, 0, ClientRectangle.Right, 0);
37 | }
38 |
39 | using (var p = new Pen(ThemeProvider.Theme.Colors.LightBorder))
40 | {
41 | g.DrawLine(p, ClientRectangle.Left, 1, ClientRectangle.Right, 1);
42 | }
43 | }
44 |
45 | #endregion
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkTextBox.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 | using AltUI.Config;
3 |
4 | namespace AltUI.Controls
5 | {
6 | public class DarkTextBox : TextBox
7 | {
8 | #region Constructor Region
9 |
10 | public DarkTextBox()
11 | {
12 | BackColor = ThemeProvider.Theme.Colors.LightBackground;
13 | ForeColor = ThemeProvider.Theme.Colors.LightText;
14 | Padding = new Padding(2, 2, 2, 2);
15 | BorderStyle = BorderStyle.FixedSingle;
16 | }
17 | #endregion
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkTitle.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 | using AltUI.Config;
4 |
5 | namespace AltUI.Controls
6 | {
7 | public class DarkTitle : Label
8 | {
9 | #region Constructor Region
10 |
11 | #endregion
12 |
13 | #region Paint Region
14 |
15 | protected override void OnPaint(PaintEventArgs e)
16 | {
17 | var g = e.Graphics;
18 | var rect = new Rectangle(0, 0, ClientSize.Width, ClientSize.Height);
19 |
20 | using (var b = new SolidBrush(ThemeProvider.Theme.Colors.GreyBackground))
21 | {
22 | g.FillRectangle(b, rect);
23 | }
24 |
25 | var textSize = g.MeasureString(Text, Font);
26 |
27 | using (var b = new SolidBrush(ThemeProvider.Theme.Colors.LightText))
28 | {
29 | g.DrawString(Text, Font, b, new PointF(-2, 0));
30 | }
31 |
32 | using (var p = new Pen(ThemeProvider.Theme.Colors.GreyHighlight))
33 | {
34 | var p1 = new PointF(textSize.Width + 5, textSize.Height / 2);
35 | var p2 = new PointF(rect.Width, textSize.Height / 2);
36 | g.DrawLine(p, p1, p2);
37 | }
38 | }
39 |
40 | #endregion
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkToolStrip.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 | using AltUI.Renderers;
4 |
5 | namespace AltUI.Controls
6 | {
7 | public class DarkToolStrip : ToolStrip
8 | {
9 | #region Constructor Region
10 |
11 | public DarkToolStrip()
12 | {
13 | Renderer = new DarkToolStripRenderer();
14 | Padding = new Padding(5, 0, 1, 0);
15 | AutoSize = false;
16 | Size = new Size(1, 28);
17 | }
18 |
19 | #endregion
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/AltUI/Controls/DarkToolTip.cs:
--------------------------------------------------------------------------------
1 | using AltUI.Config;
2 | using System.Drawing;
3 | using System.Drawing.Drawing2D;
4 | using System.Linq;
5 | using System.Windows.Forms;
6 |
7 | namespace AltUI.Controls
8 | {
9 | public class DarkToolTip : ToolTip
10 | {
11 | public DarkToolTip()
12 | {
13 | this.OwnerDraw = true;
14 | this.Popup += new PopupEventHandler(this.OnPopup);
15 | this.Draw += new DrawToolTipEventHandler(this.OnDraw);
16 | }
17 |
18 | private void OnPopup(object sender, PopupEventArgs e) // use this event to set the size of the tool tip
19 | {
20 | var tooltipText = this.GetToolTip(e.AssociatedControl);
21 | var font = new Font("Segoe UI", 9F);
22 | var strSize = TextRenderer.MeasureText(tooltipText, font);
23 | var newLines = tooltipText.Count(c => c == '\n');
24 | if (newLines == 0) newLines = 1;
25 | e.ToolTipSize = e.ToolTipSize with { Width = strSize.Width + 6, Height = strSize.Height + 5 + 3 * newLines };
26 | }
27 |
28 | private void OnDraw(object sender, DrawToolTipEventArgs e) // use this event to customise the tool tip
29 | {
30 | var g = e.Graphics;
31 | var font = new Font("Segoe UI", 9F);
32 | var strSize = g.MeasureString(e.ToolTipText, font);
33 | var bgRect = e.Bounds with { Width = e.Bounds.Width - 1, Height = e.Bounds.Height - 1 };
34 |
35 | g.FillRoundedRectangle(new SolidBrush(ThemeProvider.Theme.Colors.LightBackground), bgRect, 4);
36 | g.DrawRoundedRectangle(new Pen(ThemeProvider.Theme.Colors.LightBackground, 1), bgRect, 4);
37 | g.SmoothingMode = SmoothingMode.AntiAlias;
38 | g.DrawRoundedRectangle(new Pen(ThemeProvider.Theme.Colors.GreySelection, 1), bgRect, 4);
39 |
40 | g.DrawString(e.ToolTipText, font, new SolidBrush(ThemeProvider.Theme.Colors.LightText),
41 | new PointF(e.Bounds.X + 4, e.Bounds.Y + 3));
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/AltUI/Controls/ScrollValueEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace AltUI.Controls
4 | {
5 | public class ScrollValueEventArgs : EventArgs
6 | {
7 | public int Value { get; private set; }
8 |
9 | public ScrollValueEventArgs(int value)
10 | {
11 | Value = value;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/AltUI/Docking/DarkDockArea.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.Docking
2 | {
3 | public enum DarkDockArea
4 | {
5 | None,
6 | Document,
7 | Left,
8 | Right,
9 | Bottom
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/AltUI/Docking/DarkDockContent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Drawing;
4 | using System.Windows.Forms;
5 |
6 | namespace AltUI.Docking
7 | {
8 | [ToolboxItem(false)]
9 | public class DarkDockContent : UserControl
10 | {
11 | #region Event Handler Region
12 |
13 | public event EventHandler DockTextChanged;
14 |
15 | #endregion
16 |
17 | #region Field Region
18 |
19 | private string _dockText;
20 | private Image _icon;
21 |
22 | #endregion
23 |
24 | #region Property Region
25 |
26 | [Category("Appearance")]
27 | [Description("Determines the text that will appear in the content tabs and headers.")]
28 | public string DockText
29 | {
30 | get => _dockText;
31 | set
32 | {
33 | var oldText = _dockText;
34 |
35 | _dockText = value;
36 |
37 | if (DockTextChanged != null)
38 | DockTextChanged(this, null);
39 |
40 | Invalidate();
41 | }
42 | }
43 |
44 | [Category("Appearance")]
45 | [Description("Determines the icon that will appear in the content tabs and headers.")]
46 | public Image Icon
47 | {
48 | get => _icon;
49 | set
50 | {
51 | _icon = value;
52 | Invalidate();
53 | }
54 | }
55 |
56 | [Category("Layout")]
57 | [Description("Determines the default area of the dock panel this content will be added to.")]
58 | [DefaultValue(DarkDockArea.Document)]
59 | public DarkDockArea DefaultDockArea { get; set; }
60 |
61 | [Category("Behavior")]
62 | [Description("Determines the key used by this content in the dock serialization.")]
63 | public string SerializationKey { get; set; }
64 |
65 | [Browsable(false)]
66 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
67 | public DarkDockPanel DockPanel { get; internal set; }
68 |
69 | [Browsable(false)]
70 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
71 | public DarkDockRegion DockRegion { get; internal set; }
72 |
73 | [Browsable(false)]
74 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
75 | public DarkDockGroup DockGroup { get; internal set; }
76 |
77 | [Browsable(false)]
78 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
79 | public DarkDockArea DockArea { get; set; }
80 |
81 | [Browsable(false)]
82 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
83 | public int Order { get; set; }
84 |
85 | #endregion
86 |
87 | #region Constructor Region
88 |
89 | public DarkDockContent()
90 | {
91 | BackColor = Color.Transparent;// ThemeProvider.Theme.Colors.GreyBackground;
92 | }
93 |
94 | #endregion
95 |
96 | #region Method Region
97 |
98 | public virtual void Close()
99 | {
100 | if (DockPanel != null)
101 | DockPanel.RemoveContent(this);
102 | }
103 |
104 | #endregion
105 |
106 | #region Event Handler Region
107 |
108 | protected override void OnEnter(EventArgs e)
109 | {
110 | base.OnEnter(e);
111 |
112 | if (DockPanel == null)
113 | return;
114 |
115 | DockPanel.ActiveContent = this;
116 | }
117 |
118 | #endregion
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/AltUI/Docking/DarkDockTab.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 |
3 | namespace AltUI.Docking
4 | {
5 | internal class DarkDockTab
6 | {
7 | #region Property Region
8 |
9 | public DarkDockContent DockContent { get; set; }
10 |
11 | public Rectangle ClientRectangle { get; set; }
12 |
13 | public Rectangle CloseButtonRectangle { get; set; }
14 |
15 | public bool Hot { get; set; }
16 |
17 | public bool CloseButtonHot { get; set; }
18 |
19 | public bool ShowSeparator { get; set; }
20 |
21 | #endregion
22 |
23 | #region Constructor Region
24 |
25 | public DarkDockTab(DarkDockContent content)
26 | {
27 | DockContent = content;
28 | }
29 |
30 | #endregion
31 |
32 | #region Method Region
33 |
34 | public int CalculateWidth(Graphics g, Font font)
35 | {
36 | var width = (int)g.MeasureString(DockContent.DockText, font).Width;
37 | width += 10;
38 |
39 | return width;
40 | }
41 |
42 | #endregion
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/AltUI/Docking/DarkDockTabArea.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 | using AltUI.Controls;
5 |
6 | namespace AltUI.Docking
7 | {
8 | internal class DarkDockTabArea
9 | {
10 | #region Field Region
11 |
12 | private Dictionary _tabs = new Dictionary();
13 |
14 | private List _menuItems = new List();
15 | private DarkContextMenu _tabMenu = new();
16 |
17 | #endregion
18 |
19 | #region Property Region
20 |
21 | public DarkDockArea DockArea { get; private set; }
22 |
23 | public Rectangle ClientRectangle { get; set; }
24 |
25 | public Rectangle DropdownRectangle { get; set; }
26 |
27 | public bool DropdownHot { get; set; }
28 |
29 | public int Offset { get; set; }
30 |
31 | public int TotalTabSize { get; set; }
32 |
33 | public bool Visible { get; set; }
34 |
35 | public DarkDockTab ClickedCloseButton { get; set; }
36 |
37 | #endregion
38 |
39 | #region Constructor Region
40 |
41 | public DarkDockTabArea(DarkDockArea dockArea)
42 | {
43 | DockArea = dockArea;
44 | }
45 |
46 | #endregion
47 |
48 | #region Method Region
49 |
50 | public void ShowMenu(Control control, Point location)
51 | {
52 | _tabMenu.Show(control, location);
53 | }
54 |
55 | public void AddMenuItem(ToolStripMenuItem menuItem)
56 | {
57 | _menuItems.Add(menuItem);
58 | RebuildMenu();
59 | }
60 |
61 | public void RemoveMenuItem(ToolStripMenuItem menuItem)
62 | {
63 | _menuItems.Remove(menuItem);
64 | RebuildMenu();
65 | }
66 |
67 | public ToolStripMenuItem GetMenuItem(DarkDockContent content)
68 | {
69 | ToolStripMenuItem menuItem = null;
70 | foreach (var item in _menuItems)
71 | {
72 | var menuContent = item.Tag as DarkDockContent;
73 | if (menuContent == null)
74 | continue;
75 |
76 | if (menuContent == content)
77 | menuItem = item;
78 | }
79 |
80 | return menuItem;
81 | }
82 |
83 | public void RebuildMenu()
84 | {
85 | _tabMenu.Items.Clear();
86 |
87 | var orderedItems = new List();
88 |
89 | var index = 0;
90 | for (var i = 0; i < _menuItems.Count; i++)
91 | {
92 | foreach (var item in _menuItems)
93 | {
94 | var content = (DarkDockContent)item.Tag;
95 | if (content.Order == index)
96 | orderedItems.Add(item);
97 | }
98 | index++;
99 | }
100 |
101 | foreach (var item in orderedItems)
102 | _tabMenu.Items.Add(item);
103 | }
104 |
105 | #endregion
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/AltUI/Docking/DarkDocument.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using AltUI.Config;
3 |
4 | namespace AltUI.Docking
5 | {
6 | [ToolboxItem(false)]
7 | public class DarkDocument : DarkDockContent
8 | {
9 | #region Property Region
10 |
11 | [Browsable(false)]
12 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
13 | public new DarkDockArea DefaultDockArea => base.DefaultDockArea;
14 |
15 | #endregion
16 |
17 | #region Constructor Region
18 |
19 | public DarkDocument()
20 | {
21 | BackColor = ThemeProvider.Theme.Colors.GreyBackground;
22 | base.DefaultDockArea = DarkDockArea.Document;
23 | }
24 |
25 | #endregion
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/AltUI/Docking/DarkSplitterType.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.Docking
2 | {
3 | public enum DarkSplitterType
4 | {
5 | Left,
6 | Right,
7 | Top,
8 | Bottom
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/AltUI/Docking/DockContentEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace AltUI.Docking
4 | {
5 | public class DockContentEventArgs : EventArgs
6 | {
7 | public DarkDockContent Content { get; private set; }
8 |
9 | public DockContentEventArgs(DarkDockContent content)
10 | {
11 | Content = content;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/AltUI/Docking/DockDropCollection.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.Docking
2 | {
3 | internal class DockDropCollection
4 | {
5 | #region Property Region
6 |
7 | internal DockDropArea DropArea { get; private set; }
8 |
9 | internal DockDropArea InsertBeforeArea { get; private set; }
10 |
11 | internal DockDropArea InsertAfterArea { get; private set; }
12 |
13 | #endregion
14 |
15 | #region Constructor Region
16 |
17 | internal DockDropCollection(DarkDockPanel dockPanel, DarkDockGroup group)
18 | {
19 | DropArea = new DockDropArea(dockPanel, group, DockInsertType.None);
20 | InsertBeforeArea = new DockDropArea(dockPanel, group, DockInsertType.Before);
21 | InsertAfterArea = new DockDropArea(dockPanel, group, DockInsertType.After);
22 | }
23 |
24 | #endregion
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/AltUI/Docking/DockGroupState.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace AltUI.Docking
4 | {
5 | public class DockGroupState
6 | {
7 | #region Property Region
8 |
9 | public List Contents { get; set; }
10 |
11 | public string VisibleContent { get; set; }
12 |
13 | #endregion
14 |
15 | #region Constructor Region
16 |
17 | public DockGroupState()
18 | {
19 | Contents = new List();
20 | }
21 |
22 | #endregion
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/AltUI/Docking/DockInsertType.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.Docking
2 | {
3 | public enum DockInsertType
4 | {
5 | None,
6 | Before,
7 | After
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/AltUI/Docking/DockPanelState.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace AltUI.Docking
4 | {
5 | public class DockPanelState
6 | {
7 | #region Property Region
8 |
9 | public List Regions { get; set; }
10 |
11 | #endregion
12 |
13 | #region Constructor Region
14 |
15 | public DockPanelState()
16 | {
17 | Regions = new List();
18 | }
19 |
20 | #endregion
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/AltUI/Docking/DockRegionState.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Drawing;
3 |
4 | namespace AltUI.Docking
5 | {
6 | public class DockRegionState
7 | {
8 | #region Property Region
9 |
10 | public DarkDockArea Area { get; set; }
11 |
12 | public Size Size { get; set; }
13 |
14 | public List Groups { get; set; }
15 |
16 | #endregion
17 |
18 | #region Constructor Region
19 |
20 | public DockRegionState()
21 | {
22 | Groups = new List();
23 | }
24 |
25 | public DockRegionState(DarkDockArea area)
26 | : this()
27 | {
28 | Area = area;
29 | }
30 |
31 | public DockRegionState(DarkDockArea area, Size size)
32 | : this(area)
33 | {
34 | Size = size;
35 | }
36 |
37 | #endregion
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/AltUI/Extensions/BitmapExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 |
3 | namespace AltUI.Extensions
4 | {
5 | internal static class BitmapExtensions
6 | {
7 | internal static Bitmap SetColor(this Bitmap bitmap, Color color)
8 | {
9 | var newBitmap = new Bitmap(bitmap.Width, bitmap.Height);
10 | for (var i = 0; i < bitmap.Width; i++)
11 | {
12 | for (var j = 0; j < bitmap.Height; j++)
13 | {
14 | var pixel = bitmap.GetPixel(i, j);
15 | if (pixel.A > 0)
16 | newBitmap.SetPixel(i, j, color);
17 | }
18 | }
19 | return newBitmap;
20 | }
21 |
22 | internal static Bitmap ChangeColor(this Bitmap bitmap, Color oldColor, Color newColor)
23 | {
24 | var newBitmap = new Bitmap(bitmap.Width, bitmap.Height);
25 | for (var i = 0; i < bitmap.Width; i++)
26 | {
27 | for (var j = 0; j < bitmap.Height; j++)
28 | {
29 | var pixel = bitmap.GetPixel(i, j);
30 | if (pixel == oldColor)
31 | newBitmap.SetPixel(i, j, newColor);
32 | }
33 | }
34 | return newBitmap;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/AltUI/Extensions/IEnumerableExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 |
4 | namespace AltUI.Extensions
5 | {
6 | internal static class IEnumerableExtensions
7 | {
8 | internal static bool IsLast(this IEnumerable items, T item)
9 | {
10 | var last = items.LastOrDefault();
11 | if (last == null)
12 | return false;
13 | return item.Equals(last);
14 | }
15 |
16 | internal static bool IsFirst(this IEnumerable items, T item)
17 | {
18 | var first = items.FirstOrDefault();
19 | if (first == null)
20 | return false;
21 | return item.Equals(first);
22 | }
23 |
24 | internal static bool IsFirstOrLast(this IEnumerable items, T item)
25 | {
26 | return items.IsFirst(item) || items.IsLast(item);
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/AltUI/Forms/DarkDialogButton.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.Forms
2 | {
3 | public enum DarkDialogButton
4 | {
5 | Ok,
6 | Close,
7 | OkCancel,
8 | YesNo,
9 | YesNoCancel,
10 | AbortRetryIgnore,
11 | RetryCancel
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/AltUI/Forms/DarkForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Windows.Forms;
4 | using AltUI.Config;
5 |
6 | namespace AltUI.Forms
7 | {
8 | public class DarkForm : Form
9 | {
10 | #region Field Region
11 |
12 | private bool _customBorder;
13 | private CornerPreference _cornerPreference;
14 | public enum CornerPreference { Default, Square, Round, SlightRound }
15 | #endregion
16 |
17 | #region Property Region
18 |
19 | [Category("Appearance")]
20 | [Description("Determines whether the form's border should be set to the colour of a Control's border.")]
21 | [DefaultValue(false)]
22 | public bool CustomBorder
23 | {
24 | get => _customBorder;
25 | set
26 | {
27 | _customBorder = value;
28 | Invalidate();
29 | }
30 | }
31 |
32 | [Category("Appearance")]
33 | [Description("Determines the \"roundness\" of corners.")]
34 | [DefaultValue(0)]
35 | public CornerPreference CornerStyle
36 | {
37 | get => _cornerPreference;
38 | set
39 | {
40 | _cornerPreference = value;
41 | Invalidate();
42 | }
43 | }
44 |
45 | #endregion
46 |
47 | #region Constructor Region
48 |
49 | public DarkForm()
50 | {
51 | BackColor = ThemeProvider.Theme.Colors.GreyBackground;
52 | }
53 |
54 | #endregion
55 |
56 | protected override void OnHandleCreated(EventArgs e)
57 | {
58 | var cp = _cornerPreference;
59 | if (cp == 0) { cp = FormBorderStyle == FormBorderStyle.None ? CornerPreference.SlightRound : CornerPreference.Round; }
60 | ThemeProvider.SetupWindow(Handle, (int) cp, CustomBorder);
61 | if (ThemeProvider.TransparencyMode & ThemeProvider.WindowsVersion >= 22000)
62 | {
63 | TransparencyKey = BackColor;
64 | AllowTransparency = true;
65 | }
66 | else
67 | {
68 | AllowTransparency = false;
69 | }
70 | base.OnHandleCreated(e);
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/AltUI/Forms/DarkInputBox.Designer.cs:
--------------------------------------------------------------------------------
1 | using AltUI.Controls;
2 |
3 | namespace AltUI.Forms
4 | {
5 | partial class DarkInputBox
6 | {
7 | ///
8 | /// Required designer variable.
9 | ///
10 | private System.ComponentModel.IContainer components = null;
11 |
12 | ///
13 | /// Clean up any resources being used.
14 | ///
15 | /// true if managed resources should be disposed; otherwise, false.
16 | protected override void Dispose(bool disposing)
17 | {
18 | if (disposing && (components != null))
19 | {
20 | components.Dispose();
21 | }
22 | base.Dispose(disposing);
23 | }
24 |
25 | #region Windows Form Designer generated code
26 |
27 | ///
28 | /// Required method for Designer support - do not modify
29 | /// the contents of this method with the code editor.
30 | ///
31 | private void InitializeComponent()
32 | {
33 | this.picIcon = new System.Windows.Forms.PictureBox();
34 | this.lblText = new AltUI.Controls.DarkLabel();
35 | this.txtInput = new AltUI.Controls.DarkTextBox();
36 | ((System.ComponentModel.ISupportInitialize)(this.picIcon)).BeginInit();
37 | this.SuspendLayout();
38 | //
39 | // picIcon
40 | //
41 | this.picIcon.Location = new System.Drawing.Point(10, 10);
42 | this.picIcon.Name = "picIcon";
43 | this.picIcon.Size = new System.Drawing.Size(32, 32);
44 | this.picIcon.TabIndex = 3;
45 | this.picIcon.TabStop = false;
46 | //
47 | // lblText
48 | //
49 | this.lblText.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
50 | this.lblText.Location = new System.Drawing.Point(50, 9);
51 | this.lblText.Name = "lblText";
52 | this.lblText.Size = new System.Drawing.Size(185, 15);
53 | this.lblText.TabIndex = 4;
54 | this.lblText.Text = "Something something something";
55 | //
56 | // txtInput
57 | //
58 | this.txtInput.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(69)))), ((int)(((byte)(73)))), ((int)(((byte)(74)))));
59 | this.txtInput.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
60 | this.txtInput.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
61 | this.txtInput.Location = new System.Drawing.Point(10, 49);
62 | this.txtInput.Name = "txtInput";
63 | this.txtInput.Size = new System.Drawing.Size(225, 23);
64 | this.txtInput.TabIndex = 0;
65 | //
66 | // DarkInputBox
67 | //
68 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
69 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
70 | this.ClientSize = new System.Drawing.Size(244, 129);
71 | this.Controls.Add(this.txtInput);
72 | this.Controls.Add(this.lblText);
73 | this.Controls.Add(this.picIcon);
74 | this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
75 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
76 | this.MaximizeBox = false;
77 | this.MinimizeBox = false;
78 | this.Name = "DarkInputBox";
79 | this.ShowIcon = false;
80 | this.ShowInTaskbar = false;
81 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
82 | this.Text = "Message box";
83 | this.Controls.SetChildIndex(this.picIcon, 0);
84 | this.Controls.SetChildIndex(this.lblText, 0);
85 | this.Controls.SetChildIndex(this.txtInput, 0);
86 | ((System.ComponentModel.ISupportInitialize)(this.picIcon)).EndInit();
87 | this.ResumeLayout(false);
88 | this.PerformLayout();
89 |
90 | }
91 |
92 | #endregion
93 |
94 | private System.Windows.Forms.PictureBox picIcon;
95 | private DarkLabel lblText;
96 | public DarkTextBox txtInput;
97 | }
98 | }
--------------------------------------------------------------------------------
/AltUI/Forms/DarkMessageBox.Designer.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Windows.Forms;
3 | using AltUI.Controls;
4 |
5 | namespace AltUI.Forms
6 | {
7 | partial class DarkMessageBox
8 | {
9 | ///
10 | /// Required designer variable.
11 | ///
12 | private IContainer components = null;
13 |
14 | ///
15 | /// Clean up any resources being used.
16 | ///
17 | /// true if managed resources should be disposed; otherwise, false.
18 | protected override void Dispose(bool disposing)
19 | {
20 | if (disposing && (components != null))
21 | {
22 | components.Dispose();
23 | }
24 | base.Dispose(disposing);
25 | }
26 |
27 | #region Windows Form Designer generated code
28 |
29 | ///
30 | /// Required method for Designer support - do not modify
31 | /// the contents of this method with the code editor.
32 | ///
33 | private void InitializeComponent()
34 | {
35 | this.picIcon = new System.Windows.Forms.PictureBox();
36 | this.lblText = new AltUI.Controls.DarkLabel();
37 | ((System.ComponentModel.ISupportInitialize)(this.picIcon)).BeginInit();
38 | this.SuspendLayout();
39 | //
40 | // picIcon
41 | //
42 | this.picIcon.Location = new System.Drawing.Point(10, 10);
43 | this.picIcon.Name = "picIcon";
44 | this.picIcon.Size = new System.Drawing.Size(32, 32);
45 | this.picIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
46 | this.picIcon.TabIndex = 3;
47 | this.picIcon.TabStop = false;
48 | //
49 | // lblText
50 | //
51 | this.lblText.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
52 | this.lblText.Location = new System.Drawing.Point(50, 9);
53 | this.lblText.Name = "lblText";
54 | this.lblText.Size = new System.Drawing.Size(185, 15);
55 | this.lblText.TabIndex = 4;
56 | this.lblText.Text = "Something something something";
57 | //
58 | // DarkMessageBox
59 | //
60 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
61 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
62 | this.ClientSize = new System.Drawing.Size(244, 86);
63 | this.Controls.Add(this.lblText);
64 | this.Controls.Add(this.picIcon);
65 | this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
66 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
67 | this.MaximizeBox = false;
68 | this.MinimizeBox = false;
69 | this.Name = "DarkMessageBox";
70 | this.ShowIcon = false;
71 | this.ShowInTaskbar = false;
72 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
73 | this.Text = "Message box";
74 | this.Controls.SetChildIndex(this.picIcon, 0);
75 | this.Controls.SetChildIndex(this.lblText, 0);
76 | ((System.ComponentModel.ISupportInitialize)(this.picIcon)).EndInit();
77 | this.ResumeLayout(false);
78 |
79 | }
80 |
81 | #endregion
82 |
83 | private PictureBox picIcon;
84 | private DarkLabel lblText;
85 | }
86 | }
--------------------------------------------------------------------------------
/AltUI/Forms/DarkMessageBoxIcon.cs:
--------------------------------------------------------------------------------
1 | namespace AltUI.Forms
2 | {
3 | public enum DarkMessageBoxIcon
4 | {
5 | None,
6 | Information,
7 | Warning,
8 | Error,
9 | Custom,
10 | LInformation,
11 | LWarning,
12 | LError
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/AltUI/Forms/DarkTranslucentForm.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 |
4 | namespace AltUI.Forms
5 | {
6 | internal class DarkTranslucentForm : Form
7 | {
8 | #region Property Region
9 |
10 | protected override bool ShowWithoutActivation => true;
11 |
12 | #endregion
13 |
14 | #region Constructor Region
15 |
16 | public DarkTranslucentForm(Color backColor, double opacity = 0.6)
17 | {
18 | StartPosition = FormStartPosition.Manual;
19 | FormBorderStyle = FormBorderStyle.None;
20 | Size = new Size(1, 1);
21 | ShowInTaskbar = false;
22 | AllowTransparency = true;
23 | Opacity = opacity;
24 | BackColor = backColor;
25 | }
26 |
27 | #endregion
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/AltUI/Icons/DropdownIcons.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | using System.CodeDom.Compiler;
12 | using System.ComponentModel;
13 | using System.Diagnostics;
14 | using System.Diagnostics.CodeAnalysis;
15 | using System.Drawing;
16 | using System.Globalization;
17 | using System.Resources;
18 | using System.Runtime.CompilerServices;
19 |
20 | namespace AltUI.Icons {
21 | ///
22 | /// A strongly-typed resource class, for looking up localized strings, etc.
23 | ///
24 | // This class was auto-generated by the StronglyTypedResourceBuilder
25 | // class via a tool like ResGen or Visual Studio.
26 | // To add or remove a member, edit your .ResX file then rerun ResGen
27 | // with the /str option, or rebuild your VS project.
28 | [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
29 | [DebuggerNonUserCode]
30 | [CompilerGenerated]
31 | internal class DropdownIcons {
32 |
33 | private static ResourceManager resourceMan;
34 |
35 | private static CultureInfo resourceCulture;
36 |
37 | [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
38 | internal DropdownIcons() {
39 | }
40 |
41 | ///
42 | /// Returns the cached ResourceManager instance used by this class.
43 | ///
44 | [EditorBrowsable(EditorBrowsableState.Advanced)]
45 | internal static ResourceManager ResourceManager {
46 | get {
47 | if (ReferenceEquals(resourceMan, null)) {
48 | ResourceManager temp = new("AltUI.Icons.DropdownIcons", typeof(DropdownIcons).Assembly);
49 | resourceMan = temp;
50 | }
51 | return resourceMan;
52 | }
53 | }
54 |
55 | ///
56 | /// Overrides the current thread's CurrentUICulture property for all
57 | /// resource lookups using this strongly typed resource class.
58 | ///
59 | [EditorBrowsable(EditorBrowsableState.Advanced)]
60 | internal static CultureInfo Culture {
61 | get => resourceCulture;
62 | set => resourceCulture = value;
63 | }
64 |
65 | ///
66 | /// Looks up a localized resource of type System.Drawing.Bitmap.
67 | ///
68 | internal static Bitmap small_arrow {
69 | get {
70 | object obj = ResourceManager.GetObject("small_arrow", resourceCulture);
71 | return ((Bitmap)(obj));
72 | }
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/AltUI/Icons/MenuIcons.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | using System.CodeDom.Compiler;
12 | using System.ComponentModel;
13 | using System.Diagnostics;
14 | using System.Diagnostics.CodeAnalysis;
15 | using System.Drawing;
16 | using System.Globalization;
17 | using System.Resources;
18 | using System.Runtime.CompilerServices;
19 |
20 | namespace AltUI.Icons {
21 | ///
22 | /// A strongly-typed resource class, for looking up localized strings, etc.
23 | ///
24 | // This class was auto-generated by the StronglyTypedResourceBuilder
25 | // class via a tool like ResGen or Visual Studio.
26 | // To add or remove a member, edit your .ResX file then rerun ResGen
27 | // with the /str option, or rebuild your VS project.
28 | [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
29 | [DebuggerNonUserCode]
30 | [CompilerGenerated]
31 | public class MenuIcons {
32 |
33 | private static ResourceManager resourceMan;
34 |
35 | private static CultureInfo resourceCulture;
36 |
37 | [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
38 | internal MenuIcons() {
39 | }
40 |
41 | ///
42 | /// Returns the cached ResourceManager instance used by this class.
43 | ///
44 | [EditorBrowsable(EditorBrowsableState.Advanced)]
45 | public static ResourceManager ResourceManager {
46 | get {
47 | if (ReferenceEquals(resourceMan, null)) {
48 | ResourceManager temp = new("AltUI.Icons.MenuIcons", typeof(MenuIcons).Assembly);
49 | resourceMan = temp;
50 | }
51 | return resourceMan;
52 | }
53 | }
54 |
55 | ///
56 | /// Overrides the current thread's CurrentUICulture property for all
57 | /// resource lookups using this strongly typed resource class.
58 | ///
59 | [EditorBrowsable(EditorBrowsableState.Advanced)]
60 | public static CultureInfo Culture {
61 | get => resourceCulture;
62 | set => resourceCulture = value;
63 | }
64 |
65 | ///
66 | /// Looks up a localized resource of type System.Drawing.Bitmap.
67 | ///
68 | public static Bitmap grip {
69 | get {
70 | object obj = ResourceManager.GetObject("grip", resourceCulture);
71 | return ((Bitmap)(obj));
72 | }
73 | }
74 |
75 | ///
76 | /// Looks up a localized resource of type System.Drawing.Bitmap.
77 | ///
78 | public static Bitmap tick {
79 | get {
80 | object obj = ResourceManager.GetObject("tick", resourceCulture);
81 | return ((Bitmap)(obj));
82 | }
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/AltUI/Icons/MessageBoxIcons.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | using System.CodeDom.Compiler;
12 | using System.ComponentModel;
13 | using System.Diagnostics;
14 | using System.Diagnostics.CodeAnalysis;
15 | using System.Drawing;
16 | using System.Globalization;
17 | using System.Resources;
18 | using System.Runtime.CompilerServices;
19 |
20 | namespace AltUI.Icons {
21 | ///
22 | /// A strongly-typed resource class, for looking up localized strings, etc.
23 | ///
24 | // This class was auto-generated by the StronglyTypedResourceBuilder
25 | // class via a tool like ResGen or Visual Studio.
26 | // To add or remove a member, edit your .ResX file then rerun ResGen
27 | // with the /str option, or rebuild your VS project.
28 | [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
29 | [DebuggerNonUserCode]
30 | [CompilerGenerated]
31 | internal class MessageBoxIcons {
32 |
33 | private static ResourceManager resourceMan;
34 |
35 | private static CultureInfo resourceCulture;
36 |
37 | [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
38 | internal MessageBoxIcons() {
39 | }
40 |
41 | ///
42 | /// Returns the cached ResourceManager instance used by this class.
43 | ///
44 | [EditorBrowsable(EditorBrowsableState.Advanced)]
45 | internal static ResourceManager ResourceManager {
46 | get {
47 | if (ReferenceEquals(resourceMan, null)) {
48 | ResourceManager temp = new("AltUI.Icons.MessageBoxIcons", typeof(MessageBoxIcons).Assembly);
49 | resourceMan = temp;
50 | }
51 | return resourceMan;
52 | }
53 | }
54 |
55 | ///
56 | /// Overrides the current thread's CurrentUICulture property for all
57 | /// resource lookups using this strongly typed resource class.
58 | ///
59 | [EditorBrowsable(EditorBrowsableState.Advanced)]
60 | internal static CultureInfo Culture {
61 | get => resourceCulture;
62 | set => resourceCulture = value;
63 | }
64 |
65 | ///
66 | /// Looks up a localized resource of type System.Drawing.Bitmap.
67 | ///
68 | internal static Bitmap error {
69 | get {
70 | object obj = ResourceManager.GetObject("error", resourceCulture);
71 | return ((Bitmap)(obj));
72 | }
73 | }
74 |
75 | ///
76 | /// Looks up a localized resource of type System.Drawing.Bitmap.
77 | ///
78 | internal static Bitmap info {
79 | get {
80 | object obj = ResourceManager.GetObject("info", resourceCulture);
81 | return ((Bitmap)(obj));
82 | }
83 | }
84 |
85 | ///
86 | /// Looks up a localized resource of type System.Drawing.Bitmap.
87 | ///
88 | internal static Bitmap lerror {
89 | get {
90 | object obj = ResourceManager.GetObject("lerror", resourceCulture);
91 | return ((Bitmap)(obj));
92 | }
93 | }
94 |
95 | ///
96 | /// Looks up a localized resource of type System.Drawing.Bitmap.
97 | ///
98 | internal static Bitmap linfo {
99 | get {
100 | object obj = ResourceManager.GetObject("linfo", resourceCulture);
101 | return ((Bitmap)(obj));
102 | }
103 | }
104 |
105 | ///
106 | /// Looks up a localized resource of type System.Drawing.Bitmap.
107 | ///
108 | internal static Bitmap lwarning {
109 | get {
110 | object obj = ResourceManager.GetObject("lwarning", resourceCulture);
111 | return ((Bitmap)(obj));
112 | }
113 | }
114 |
115 | ///
116 | /// Looks up a localized resource of type System.Drawing.Bitmap.
117 | ///
118 | internal static Bitmap warning {
119 | get {
120 | object obj = ResourceManager.GetObject("warning", resourceCulture);
121 | return ((Bitmap)(obj));
122 | }
123 | }
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/AltUI/Icons/TreeViewIcons.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | using System.CodeDom.Compiler;
12 | using System.ComponentModel;
13 | using System.Diagnostics;
14 | using System.Diagnostics.CodeAnalysis;
15 | using System.Drawing;
16 | using System.Globalization;
17 | using System.Resources;
18 | using System.Runtime.CompilerServices;
19 |
20 | namespace AltUI.Icons {
21 | ///
22 | /// A strongly-typed resource class, for looking up localized strings, etc.
23 | ///
24 | // This class was auto-generated by the StronglyTypedResourceBuilder
25 | // class via a tool like ResGen or Visual Studio.
26 | // To add or remove a member, edit your .ResX file then rerun ResGen
27 | // with the /str option, or rebuild your VS project.
28 | [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
29 | [DebuggerNonUserCode]
30 | [CompilerGenerated]
31 | internal class TreeViewIcons {
32 |
33 | private static ResourceManager resourceMan;
34 |
35 | private static CultureInfo resourceCulture;
36 |
37 | [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
38 | internal TreeViewIcons() {
39 | }
40 |
41 | ///
42 | /// Returns the cached ResourceManager instance used by this class.
43 | ///
44 | [EditorBrowsable(EditorBrowsableState.Advanced)]
45 | internal static ResourceManager ResourceManager {
46 | get {
47 | if (ReferenceEquals(resourceMan, null)) {
48 | ResourceManager temp = new("AltUI.Icons.TreeViewIcons", typeof(TreeViewIcons).Assembly);
49 | resourceMan = temp;
50 | }
51 | return resourceMan;
52 | }
53 | }
54 |
55 | ///
56 | /// Overrides the current thread's CurrentUICulture property for all
57 | /// resource lookups using this strongly typed resource class.
58 | ///
59 | [EditorBrowsable(EditorBrowsableState.Advanced)]
60 | internal static CultureInfo Culture {
61 | get => resourceCulture;
62 | set => resourceCulture = value;
63 | }
64 |
65 | ///
66 | /// Looks up a localized resource of type System.Drawing.Bitmap.
67 | ///
68 | internal static Bitmap node_closed_empty {
69 | get {
70 | object obj = ResourceManager.GetObject("node_closed_empty", resourceCulture);
71 | return ((Bitmap)(obj));
72 | }
73 | }
74 |
75 | ///
76 | /// Looks up a localized resource of type System.Drawing.Bitmap.
77 | ///
78 | internal static Bitmap node_closed_full {
79 | get {
80 | object obj = ResourceManager.GetObject("node_closed_full", resourceCulture);
81 | return ((Bitmap)(obj));
82 | }
83 | }
84 |
85 | ///
86 | /// Looks up a localized resource of type System.Drawing.Bitmap.
87 | ///
88 | internal static Bitmap node_open {
89 | get {
90 | object obj = ResourceManager.GetObject("node_open", resourceCulture);
91 | return ((Bitmap)(obj));
92 | }
93 | }
94 |
95 | ///
96 | /// Looks up a localized resource of type System.Drawing.Bitmap.
97 | ///
98 | internal static Bitmap node_open_empty {
99 | get {
100 | object obj = ResourceManager.GetObject("node_open_empty", resourceCulture);
101 | return ((Bitmap)(obj));
102 | }
103 | }
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/AltUI/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("AltUI")]
8 | [assembly: AssemblyDescription("Dark themed control and docking library for .NET WinForms.")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Robin Perris")]
11 | [assembly: AssemblyProduct("AltUI")]
12 | [assembly: AssemblyCopyright("Copyright © Robin Perris")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("f19472f5-8c44-4c51-a8a0-b9de5f555255")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("2.0.1.0")]
35 | [assembly: AssemblyFileVersion("2.0.1.0")]
36 |
--------------------------------------------------------------------------------
/AltUI/Renderers/DarkMenuRenderer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 | using AltUI.Config;
5 | using AltUI.Icons;
6 |
7 | namespace AltUI.Renderers
8 | {
9 | public class DarkMenuRenderer : ToolStripRenderer
10 | {
11 | #region Initialisation Region
12 |
13 | protected override void Initialize(ToolStrip toolStrip)
14 | {
15 | base.Initialize(toolStrip);
16 |
17 | toolStrip.BackColor = ThemeProvider.Theme.Colors.GreyBackground;
18 | toolStrip.ForeColor = ThemeProvider.Theme.Colors.LightText;
19 | }
20 |
21 | protected override void InitializeItem(ToolStripItem item)
22 | {
23 | base.InitializeItem(item);
24 |
25 | item.BackColor = ThemeProvider.Theme.Colors.GreyBackground;
26 | item.ForeColor = ThemeProvider.Theme.Colors.LightText;
27 |
28 | if (item.GetType() == typeof(ToolStripSeparator))
29 | {
30 | item.Margin = new Padding(0, 0, 0, 1);
31 | }
32 | }
33 |
34 | #endregion
35 |
36 | #region Render Region
37 |
38 | protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
39 | {
40 | var g = e.Graphics;
41 | using var b = new SolidBrush(ThemeProvider.Theme.Colors.GreyBackground);
42 | g.FillRectangle(b, e.AffectedBounds);
43 | }
44 |
45 | protected override void OnRenderImageMargin(ToolStripRenderEventArgs e)
46 | {
47 | var g = e.Graphics;
48 |
49 | var rect = new Rectangle(0, 0, e.ToolStrip.Width - 1, e.ToolStrip.Height - 1);
50 |
51 | using var p = new Pen(ThemeProvider.Theme.Colors.LightBorder);
52 | g.DrawRectangle(p, rect);
53 | }
54 |
55 | protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
56 | {
57 | var g = e.Graphics;
58 |
59 | var rect = new Rectangle(e.ImageRectangle.Left - 2, e.ImageRectangle.Top - 2,
60 | e.ImageRectangle.Width + 4, e.ImageRectangle.Height + 4);
61 |
62 | using (var b = new SolidBrush(ThemeProvider.Theme.Colors.LightBorder))
63 | {
64 | g.FillRectangle(b, rect);
65 | }
66 |
67 | using (var p = new Pen(ThemeProvider.Theme.Colors.BlueHighlight))
68 | {
69 | var modRect = new Rectangle(rect.Left, rect.Top, rect.Width - 1, rect.Height - 1);
70 | g.DrawRectangle(p, modRect);
71 | }
72 |
73 | if (e.Item.ImageIndex == -1 && String.IsNullOrEmpty(e.Item.ImageKey) && e.Item.Image == null)
74 | {
75 | g.DrawImageUnscaled(MenuIcons.tick, new Point(e.ImageRectangle.Left, e.ImageRectangle.Top));
76 | }
77 | }
78 |
79 | protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e)
80 | {
81 | var g = e.Graphics;
82 |
83 | var rect = new Rectangle(1, 3, e.Item.Width, 1);
84 |
85 | using var b = new SolidBrush(ThemeProvider.Theme.Colors.LightBorder);
86 | g.FillRectangle(b, rect);
87 | }
88 |
89 | protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
90 | {
91 | e.ArrowColor = ThemeProvider.Theme.Colors.LightText;
92 | e.ArrowRectangle = new Rectangle(new Point(e.ArrowRectangle.Left, e.ArrowRectangle.Top - 1), e.ArrowRectangle.Size);
93 |
94 | base.OnRenderArrow(e);
95 | }
96 |
97 | protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
98 | {
99 | var g = e.Graphics;
100 |
101 | e.Item.ForeColor = e.Item.Enabled ? ThemeProvider.Theme.Colors.LightText : ThemeProvider.Theme.Colors.DisabledText;
102 |
103 | if (e.Item.Enabled)
104 | {
105 |
106 | var bgColor = e.Item.Selected ? ThemeProvider.Theme.Colors.GreyHighlight : e.Item.BackColor;
107 |
108 | // Normal item
109 | var rect = new Rectangle(2, 0, e.Item.Width - 3, e.Item.Height);
110 |
111 | using (var b = new SolidBrush(bgColor))
112 | {
113 | g.FillRectangle(b, rect);
114 | }
115 |
116 | // Header item on open menu
117 | if (e.Item.GetType() == typeof(ToolStripMenuItem))
118 | {
119 | if (((ToolStripMenuItem)e.Item).DropDown.Visible && e.Item.IsOnDropDown == false)
120 | {
121 | using var b = new SolidBrush(ThemeProvider.Theme.Colors.GreySelection);
122 | g.FillRectangle(b, rect);
123 | }
124 | }
125 | }
126 | }
127 |
128 | #endregion
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/AltUI/Resources/active-inactive-close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/active-inactive-close.png
--------------------------------------------------------------------------------
/AltUI/Resources/arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/arrow.png
--------------------------------------------------------------------------------
/AltUI/Resources/cellbackground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/cellbackground.png
--------------------------------------------------------------------------------
/AltUI/Resources/close-selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/close-selected.png
--------------------------------------------------------------------------------
/AltUI/Resources/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/close.png
--------------------------------------------------------------------------------
/AltUI/Resources/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/error.png
--------------------------------------------------------------------------------
/AltUI/Resources/eyedropper.cur:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/eyedropper.cur
--------------------------------------------------------------------------------
/AltUI/Resources/eyedropper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/eyedropper.png
--------------------------------------------------------------------------------
/AltUI/Resources/grip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/grip.png
--------------------------------------------------------------------------------
/AltUI/Resources/inactive-close-selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/inactive-close-selected.png
--------------------------------------------------------------------------------
/AltUI/Resources/inactive-close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/inactive-close.png
--------------------------------------------------------------------------------
/AltUI/Resources/info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/info.png
--------------------------------------------------------------------------------
/AltUI/Resources/lcellbackground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/lcellbackground.png
--------------------------------------------------------------------------------
/AltUI/Resources/lerror.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/lerror.png
--------------------------------------------------------------------------------
/AltUI/Resources/linfo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/linfo.png
--------------------------------------------------------------------------------
/AltUI/Resources/lwarning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/lwarning.png
--------------------------------------------------------------------------------
/AltUI/Resources/node_closed_empty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/node_closed_empty.png
--------------------------------------------------------------------------------
/AltUI/Resources/node_closed_full.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/node_closed_full.png
--------------------------------------------------------------------------------
/AltUI/Resources/node_open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/node_open.png
--------------------------------------------------------------------------------
/AltUI/Resources/node_open_empty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/node_open_empty.png
--------------------------------------------------------------------------------
/AltUI/Resources/palette-load.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/palette-load.png
--------------------------------------------------------------------------------
/AltUI/Resources/palette-save.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/palette-save.png
--------------------------------------------------------------------------------
/AltUI/Resources/scrollbar_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/scrollbar_arrow.png
--------------------------------------------------------------------------------
/AltUI/Resources/scrollbar_arrow_clicked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/scrollbar_arrow_clicked.png
--------------------------------------------------------------------------------
/AltUI/Resources/scrollbar_arrow_hot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/scrollbar_arrow_hot.png
--------------------------------------------------------------------------------
/AltUI/Resources/scrollbar_arrow_small_clicked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/scrollbar_arrow_small_clicked.png
--------------------------------------------------------------------------------
/AltUI/Resources/scrollbar_arrow_small_hot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/scrollbar_arrow_small_hot.png
--------------------------------------------------------------------------------
/AltUI/Resources/scrollbar_arrow_small_standard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/scrollbar_arrow_small_standard.png
--------------------------------------------------------------------------------
/AltUI/Resources/scrollbar_arrow_standard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/scrollbar_arrow_standard.png
--------------------------------------------------------------------------------
/AltUI/Resources/scrollbar_disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/scrollbar_disabled.png
--------------------------------------------------------------------------------
/AltUI/Resources/small_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/small_arrow.png
--------------------------------------------------------------------------------
/AltUI/Resources/tick.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/tick.png
--------------------------------------------------------------------------------
/AltUI/Resources/tw_active_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/tw_active_close.png
--------------------------------------------------------------------------------
/AltUI/Resources/tw_active_close_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/tw_active_close_selected.png
--------------------------------------------------------------------------------
/AltUI/Resources/tw_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/tw_close.png
--------------------------------------------------------------------------------
/AltUI/Resources/tw_close_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/tw_close_selected.png
--------------------------------------------------------------------------------
/AltUI/Resources/warning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/AltUI/Resources/warning.png
--------------------------------------------------------------------------------
/AltUI/Win32/ControlScrollFilter.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 |
4 | namespace AltUI.Win32
5 | {
6 | public class ControlScrollFilter : IMessageFilter
7 | {
8 | public bool PreFilterMessage(ref Message m)
9 | {
10 | switch (m.Msg)
11 | {
12 | case (int)WM.MOUSEWHEEL:
13 | case (int)WM.MOUSEHWHEEL:
14 | var hControlUnderMouse = Native.WindowFromPoint(new Point((int)m.LParam));
15 |
16 | if (hControlUnderMouse == m.HWnd)
17 | return false;
18 |
19 | Native.SendMessage(hControlUnderMouse, (uint)m.Msg, m.WParam, m.LParam);
20 | return true;
21 | }
22 |
23 | return false;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/AltUI/Win32/Native.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Runtime.InteropServices;
4 |
5 | namespace AltUI.Win32
6 | {
7 | internal sealed class Native
8 | {
9 | [DllImport("user32.dll")]
10 | internal static extern IntPtr WindowFromPoint(Point point);
11 |
12 | [DllImport("user32.dll", CharSet = CharSet.Auto)]
13 | internal static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Example/Example.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net6.0-windows
4 | WinExe
5 | false
6 | true
7 | true
8 |
9 |
10 |
11 | ..\AltUI\bin\Release\AltUI.dll
12 |
13 |
14 | .\Newtonsoft.Json.dll
15 |
16 |
17 |
18 |
19 | UserControl
20 |
21 |
22 | UserControl
23 |
24 |
25 | UserControl
26 |
27 |
28 | UserControl
29 |
30 |
31 | UserControl
32 |
33 |
34 | UserControl
35 |
36 |
37 |
38 |
39 | Icons
40 | Example
41 |
42 |
43 |
44 |
45 | all
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/Example/Forms/Dialogs/DialogAbout.cs:
--------------------------------------------------------------------------------
1 | using AltUI.Forms;
2 | using System.Windows.Forms;
3 |
4 | namespace Example.Dialogs
5 | {
6 | public partial class DialogAbout : DarkDialog
7 | {
8 | #region Constructor Region
9 |
10 | public DialogAbout()
11 | {
12 | InitializeComponent();
13 |
14 | lblVersion.Text = $"Version: {Application.ProductVersion.ToString()}";
15 | btnOk.Text = "Close";
16 | }
17 |
18 | #endregion
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Example/Forms/Dialogs/DialogControls.cs:
--------------------------------------------------------------------------------
1 | using AltUI.Controls;
2 | using AltUI.Forms;
3 |
4 | namespace Example.Dialogs
5 | {
6 | public partial class DialogControls : DarkDialog
7 | {
8 | public DialogControls()
9 | {
10 | InitializeComponent();
11 |
12 | // Build dummy list data
13 | for (var i = 0; i < 100; i++)
14 | {
15 | var item = new DarkListItem($"List item #{i}");
16 | lstTest.Items.Add(item);
17 | }
18 |
19 | // Build dummy nodes
20 | var childCount = 0;
21 | for (var i = 0; i < 20; i++)
22 | {
23 | var node = new DarkTreeNode($"Root node #{i}");
24 | node.ExpandedIcon = Icons.folder_open;
25 | node.Icon = Icons.folder_closed;
26 |
27 | for (var x = 0; x < 10; x++)
28 | {
29 | var childNode = new DarkTreeNode($"Child node #{childCount}");
30 | childNode.Icon = Icons.files;
31 | childCount++;
32 | node.Nodes.Add(childNode);
33 | }
34 |
35 | treeTest.Nodes.Add(node);
36 | }
37 |
38 | // Hook dialog button events
39 | btnDialog.Click += delegate
40 | {
41 | DarkMessageBox.ShowError("This is an error", "Dark UI - Example");
42 | };
43 |
44 | btnMessageBox.Click += delegate
45 | {
46 | DarkMessageBox.ShowInformation("This is some information, except it is much bigger, so there we go. I wonder how this is going to go. I hope it resizes properly. It probably will.", "Dark UI - Example");
47 | };
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Example/Forms/Docking/DockConsole.Designer.cs:
--------------------------------------------------------------------------------
1 | using AltUI.Controls;
2 | using AltUI.Docking;
3 |
4 | namespace Example.Docking
5 | {
6 | partial class DockConsole
7 | {
8 | ///
9 | /// Required designer variable.
10 | ///
11 | private System.ComponentModel.IContainer components = null;
12 |
13 | ///
14 | /// Clean up any resources being used.
15 | ///
16 | /// true if managed resources should be disposed; otherwise, false.
17 | protected override void Dispose(bool disposing)
18 | {
19 | if (disposing && (components != null))
20 | {
21 | components.Dispose();
22 | }
23 | base.Dispose(disposing);
24 | }
25 |
26 | #region Component Designer generated code
27 |
28 | ///
29 | /// Required method for Designer support - do not modify
30 | /// the contents of this method with the code editor.
31 | ///
32 | private void InitializeComponent()
33 | {
34 | this.lstConsole = new AltUI.Controls.DarkListView();
35 | this.SuspendLayout();
36 | //
37 | // lstConsole
38 | //
39 | this.lstConsole.Dock = System.Windows.Forms.DockStyle.Fill;
40 | this.lstConsole.Location = new System.Drawing.Point(0, 25);
41 | this.lstConsole.MultiSelect = true;
42 | this.lstConsole.Name = "lstConsole";
43 | this.lstConsole.Size = new System.Drawing.Size(500, 175);
44 | this.lstConsole.TabIndex = 0;
45 | this.lstConsole.Text = "darkListView1";
46 | //
47 | // DockConsole
48 | //
49 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
50 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
51 | this.Controls.Add(this.lstConsole);
52 | this.DefaultDockArea = AltUI.Docking.DarkDockArea.Bottom;
53 | this.DockText = "Console";
54 | this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
55 | this.Icon = global::Example.Icons.Console;
56 | this.Name = "DockConsole";
57 | this.SerializationKey = "DockConsole";
58 | this.Size = new System.Drawing.Size(500, 200);
59 | this.ResumeLayout(false);
60 |
61 | }
62 |
63 | #endregion
64 |
65 | private DarkListView lstConsole;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/Example/Forms/Docking/DockConsole.cs:
--------------------------------------------------------------------------------
1 | using AltUI.Controls;
2 | using AltUI.Docking;
3 |
4 | namespace Example.Docking
5 | {
6 | public partial class DockConsole : DarkToolWindow
7 | {
8 | #region Constructor Region
9 |
10 | public DockConsole()
11 | {
12 | InitializeComponent();
13 |
14 | // Build dummy list data
15 | for (var i = 0; i < 100; i++)
16 | {
17 | var item = new DarkListItem($"List item #{i}");
18 | lstConsole.Items.Add(item);
19 | }
20 | }
21 |
22 | #endregion
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Example/Forms/Docking/DockDocument.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Example.Docking
2 | {
3 | partial class DockDocument
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.txtDocument = new System.Windows.Forms.TextBox();
32 | this.cmbOptions = new AltUI.Controls.DarkDropdownList();
33 | this.SuspendLayout();
34 | //
35 | // txtDocument
36 | //
37 | this.txtDocument.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(43)))), ((int)(((byte)(43)))), ((int)(((byte)(43)))));
38 | this.txtDocument.BorderStyle = System.Windows.Forms.BorderStyle.None;
39 | this.txtDocument.Dock = System.Windows.Forms.DockStyle.Fill;
40 | this.txtDocument.ForeColor = System.Drawing.Color.Gainsboro;
41 | this.txtDocument.Location = new System.Drawing.Point(0, 0);
42 | this.txtDocument.Multiline = true;
43 | this.txtDocument.Name = "txtDocument";
44 | this.txtDocument.Size = new System.Drawing.Size(175, 173);
45 | this.txtDocument.TabIndex = 1;
46 | this.txtDocument.Text = "This is some Example text";
47 | //
48 | // cmbOptions
49 | //
50 | this.cmbOptions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
51 | this.cmbOptions.DropdownDirection = System.Windows.Forms.ToolStripDropDownDirection.AboveRight;
52 | this.cmbOptions.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
53 | this.cmbOptions.Location = new System.Drawing.Point(0, 158);
54 | this.cmbOptions.MaxHeight = 300;
55 | this.cmbOptions.Name = "cmbOptions";
56 | this.cmbOptions.ShowBorder = false;
57 | this.cmbOptions.Size = new System.Drawing.Size(65, 15);
58 | this.cmbOptions.TabIndex = 2;
59 | this.cmbOptions.Text = "darkComboBox1";
60 | //
61 | // DockDocument
62 | //
63 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
64 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
65 | this.Controls.Add(this.cmbOptions);
66 | this.Controls.Add(this.txtDocument);
67 | this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
68 | this.Name = "DockDocument";
69 | this.Size = new System.Drawing.Size(175, 173);
70 | this.ResumeLayout(false);
71 | this.PerformLayout();
72 |
73 | }
74 |
75 | #endregion
76 |
77 | private System.Windows.Forms.TextBox txtDocument;
78 | private AltUI.Controls.DarkDropdownList cmbOptions;
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/Example/Forms/Docking/DockDocument.cs:
--------------------------------------------------------------------------------
1 | using AltUI.Config;
2 | using AltUI.Controls;
3 | using AltUI.Docking;
4 | using AltUI.Forms;
5 | using System.Drawing;
6 | using System.Windows.Forms;
7 |
8 | namespace Example.Docking
9 | {
10 | public partial class DockDocument : DarkDocument
11 | {
12 | #region Constructor Region
13 |
14 | public DockDocument()
15 | {
16 | InitializeComponent();
17 |
18 | // Workaround to stop the textbox from highlight all text.
19 | txtDocument.SelectionStart = txtDocument.Text.Length;
20 |
21 | // Build dummy dropdown data
22 | cmbOptions.Items.Add(new DarkDropdownItem("25%"));
23 | cmbOptions.Items.Add(new DarkDropdownItem("50%"));
24 | cmbOptions.Items.Add(new DarkDropdownItem("100%"));
25 | cmbOptions.Items.Add(new DarkDropdownItem("200%"));
26 | cmbOptions.Items.Add(new DarkDropdownItem("300%"));
27 | cmbOptions.Items.Add(new DarkDropdownItem("400%"));
28 | }
29 |
30 | public DockDocument(string text, Image icon)
31 | : this()
32 | {
33 | DockText = text;
34 | Icon = icon;
35 | }
36 |
37 | #endregion
38 |
39 | #region Event Handler Region
40 |
41 | public override void Close()
42 | {
43 | var result = DarkMessageBox.ShowWarning(@"You will lose any unsaved changes. Continue? ", @"Close document", DarkDialogButton.YesNo);
44 | if (result == DialogResult.No)
45 | return;
46 |
47 | base.Close();
48 | }
49 |
50 | #endregion
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Example/Forms/Docking/DockHistory.Designer.cs:
--------------------------------------------------------------------------------
1 | using AltUI.Config;
2 | using AltUI.Controls;
3 | using AltUI.Docking;
4 |
5 | namespace Example.Docking
6 | {
7 | partial class DockHistory
8 | {
9 | ///
10 | /// Required designer variable.
11 | ///
12 | private System.ComponentModel.IContainer components = null;
13 |
14 | ///
15 | /// Clean up any resources being used.
16 | ///
17 | /// true if managed resources should be disposed; otherwise, false.
18 | protected override void Dispose(bool disposing)
19 | {
20 | if (disposing && (components != null))
21 | {
22 | components.Dispose();
23 | }
24 | base.Dispose(disposing);
25 | }
26 |
27 | #region Component Designer generated code
28 |
29 | ///
30 | /// Required method for Designer support - do not modify
31 | /// the contents of this method with the code editor.
32 | ///
33 | private void InitializeComponent()
34 | {
35 | this.lstHistory = new AltUI.Controls.DarkListView();
36 | this.SuspendLayout();
37 | //
38 | // lstHistory
39 | //
40 | this.lstHistory.Dock = System.Windows.Forms.DockStyle.Fill;
41 | this.lstHistory.Location = new System.Drawing.Point(0, 25);
42 | this.lstHistory.Name = "lstHistory";
43 | this.lstHistory.Size = new System.Drawing.Size(280, 425);
44 | this.lstHistory.TabIndex = 0;
45 | this.lstHistory.Text = "darkListView1";
46 | //
47 | // DockHistory
48 | //
49 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
50 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
51 | this.Controls.Add(this.lstHistory);
52 | this.DefaultDockArea = AltUI.Docking.DarkDockArea.Right;
53 | this.DockText = "History";
54 | this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
55 | this.Icon = global::Example.Icons.RefactoringLog_12810;
56 | this.Name = "DockHistory";
57 | this.SerializationKey = "DockHistory";
58 | this.Size = new System.Drawing.Size(280, 450);
59 | this.ResumeLayout(false);
60 |
61 | }
62 |
63 | #endregion
64 |
65 | private DarkListView lstHistory;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/Example/Forms/Docking/DockHistory.cs:
--------------------------------------------------------------------------------
1 | using AltUI.Controls;
2 | using AltUI.Docking;
3 |
4 | namespace Example.Docking
5 | {
6 | public partial class DockHistory : DarkToolWindow
7 | {
8 | #region Constructor Region
9 |
10 | public DockHistory()
11 | {
12 | InitializeComponent();
13 |
14 | // Build dummy list data
15 | for (var i = 0; i < 100; i++)
16 | {
17 | var item = new DarkListItem($"List item #{i}");
18 | lstHistory.Items.Add(item);
19 | }
20 | }
21 |
22 | #endregion
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Example/Forms/Docking/DockLayers.Designer.cs:
--------------------------------------------------------------------------------
1 | using AltUI.Controls;
2 | using AltUI.Docking;
3 |
4 | namespace Example.Docking
5 | {
6 | partial class DockLayers
7 | {
8 | ///
9 | /// Required designer variable.
10 | ///
11 | private System.ComponentModel.IContainer components = null;
12 |
13 | ///
14 | /// Clean up any resources being used.
15 | ///
16 | /// true if managed resources should be disposed; otherwise, false.
17 | protected override void Dispose(bool disposing)
18 | {
19 | if (disposing && (components != null))
20 | {
21 | components.Dispose();
22 | }
23 | base.Dispose(disposing);
24 | }
25 |
26 | #region Component Designer generated code
27 |
28 | ///
29 | /// Required method for Designer support - do not modify
30 | /// the contents of this method with the code editor.
31 | ///
32 | private void InitializeComponent()
33 | {
34 | this.lstLayers = new AltUI.Controls.DarkListView();
35 | this.cmbList = new AltUI.Controls.DarkDropdownList();
36 | this.SuspendLayout();
37 | //
38 | // lstLayers
39 | //
40 | this.lstLayers.Dock = System.Windows.Forms.DockStyle.Fill;
41 | this.lstLayers.HideScrollBars = false;
42 | this.lstLayers.Location = new System.Drawing.Point(0, 51);
43 | this.lstLayers.Name = "lstLayers";
44 | this.lstLayers.ShowIcons = true;
45 | this.lstLayers.Size = new System.Drawing.Size(280, 399);
46 | this.lstLayers.TabIndex = 0;
47 | this.lstLayers.Text = "darkListView1";
48 | //
49 | // cmbList
50 | //
51 | this.cmbList.Dock = System.Windows.Forms.DockStyle.Top;
52 | this.cmbList.Location = new System.Drawing.Point(0, 25);
53 | this.cmbList.Name = "cmbList";
54 | this.cmbList.ShowBorder = false;
55 | this.cmbList.Size = new System.Drawing.Size(280, 26);
56 | this.cmbList.TabIndex = 1;
57 | this.cmbList.Text = "darkDropdownList1";
58 | //
59 | // DockLayers
60 | //
61 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
62 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
63 | this.Controls.Add(this.lstLayers);
64 | this.Controls.Add(this.cmbList);
65 | this.DefaultDockArea = AltUI.Docking.DarkDockArea.Right;
66 | this.DockText = "Layers";
67 | this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
68 | this.Icon = global::Example.Icons.Collection_16xLG;
69 | this.Name = "DockLayers";
70 | this.SerializationKey = "DockLayers";
71 | this.Size = new System.Drawing.Size(280, 450);
72 | this.ResumeLayout(false);
73 |
74 | }
75 |
76 | #endregion
77 |
78 | private DarkListView lstLayers;
79 | private DarkDropdownList cmbList;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/Example/Forms/Docking/DockLayers.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using AltUI.Controls;
3 | using AltUI.Docking;
4 |
5 | namespace Example.Docking
6 | {
7 | public partial class DockLayers : DarkToolWindow
8 | {
9 | #region Constructor Region
10 |
11 | public DockLayers()
12 | {
13 | InitializeComponent();
14 |
15 | // Build dummy list data
16 | for (var i = 0; i < 100; i++)
17 | {
18 | var item = new DarkListItem($"List item #{i}");
19 | item.Icon = Icons.application_16x;
20 | lstLayers.Items.Add(item);
21 | }
22 |
23 | // Build dropdown list data
24 | for (var i = 0; i < 5; i++)
25 | {
26 | cmbList.Items.Add(new DarkDropdownItem($"Dropdown item #{i}"));
27 | }
28 | }
29 |
30 | #endregion
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Example/Forms/Docking/DockProject.Designer.cs:
--------------------------------------------------------------------------------
1 | using AltUI.Config;
2 | using AltUI.Controls;
3 | using AltUI.Docking;
4 |
5 | namespace Example.Docking
6 | {
7 | partial class DockProject
8 | {
9 | ///
10 | /// Required designer variable.
11 | ///
12 | private System.ComponentModel.IContainer components = null;
13 |
14 | ///
15 | /// Clean up any resources being used.
16 | ///
17 | /// true if managed resources should be disposed; otherwise, false.
18 | protected override void Dispose(bool disposing)
19 | {
20 | if (disposing && (components != null))
21 | {
22 | components.Dispose();
23 | }
24 | base.Dispose(disposing);
25 | }
26 |
27 | #region Component Designer generated code
28 |
29 | ///
30 | /// Required method for Designer support - do not modify
31 | /// the contents of this method with the code editor.
32 | ///
33 | private void InitializeComponent()
34 | {
35 | this.treeProject = new AltUI.Controls.DarkTreeView();
36 | this.SuspendLayout();
37 | //
38 | // treeProject
39 | //
40 | this.treeProject.AllowMoveNodes = true;
41 | this.treeProject.Dock = System.Windows.Forms.DockStyle.Fill;
42 | this.treeProject.Location = new System.Drawing.Point(0, 25);
43 | this.treeProject.MaxDragChange = 20;
44 | this.treeProject.MultiSelect = true;
45 | this.treeProject.Name = "treeProject";
46 | this.treeProject.ShowIcons = true;
47 | this.treeProject.Size = new System.Drawing.Size(280, 425);
48 | this.treeProject.TabIndex = 0;
49 | this.treeProject.Text = "darkTreeView1";
50 | //
51 | // DockProject
52 | //
53 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
54 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
55 | this.BackColor = System.Drawing.Color.Transparent;
56 | this.Controls.Add(this.treeProject);
57 | this.DefaultDockArea = AltUI.Docking.DarkDockArea.Left;
58 | this.DockText = "Project Explorer";
59 | this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
60 | this.Icon = global::Example.Icons.application_16x;
61 | this.Name = "DockProject";
62 | this.SerializationKey = "DockProject";
63 | this.Size = new System.Drawing.Size(280, 450);
64 | this.ResumeLayout(false);
65 |
66 | }
67 |
68 | #endregion
69 |
70 | private DarkTreeView treeProject;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/Example/Forms/Docking/DockProject.cs:
--------------------------------------------------------------------------------
1 | using AltUI.Controls;
2 | using AltUI.Docking;
3 |
4 | namespace Example.Docking
5 | {
6 | public partial class DockProject : DarkToolWindow
7 | {
8 | #region Constructor Region
9 |
10 | public DockProject()
11 | {
12 | InitializeComponent();
13 |
14 | BackColor = System.Drawing.Color.Transparent;
15 |
16 | // Build dummy nodes
17 | var childCount = 0;
18 | for (var i = 0; i < 20; i++)
19 | {
20 | var node = new DarkTreeNode($"Root node #{i}");
21 | node.ExpandedIcon = Icons.folder_open;
22 | node.Icon = Icons.folder_closed;
23 |
24 | for (var x = 0; x < 10; x++)
25 | {
26 | var childNode = new DarkTreeNode($"Child node #{childCount}");
27 | childNode.Icon = Icons.files;
28 | childCount++;
29 | node.Nodes.Add(childNode);
30 | }
31 |
32 | treeProject.Nodes.Add(node);
33 | }
34 | }
35 |
36 | #endregion
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Example/Forms/Docking/DockProperties.cs:
--------------------------------------------------------------------------------
1 | using AltUI.Config;
2 | using AltUI.Controls;
3 | using AltUI.Docking;
4 |
5 | namespace Example.Docking
6 | {
7 | public partial class DockProperties : DarkToolWindow
8 | {
9 | #region Constructor Region
10 |
11 | public DockProperties()
12 | {
13 | InitializeComponent();
14 |
15 | panel1.BackColor = panel2.BackColor = panel3.BackColor = System.Drawing.Color.Transparent;
16 |
17 | // Build dummy dropdown data
18 | cmbList.Items.Add(new DarkDropdownItem("Item1"));
19 | cmbList.Items.Add(new DarkDropdownItem("Item2"));
20 | cmbList.Items.Add(new DarkDropdownItem("Item3"));
21 | cmbList.Items.Add(new DarkDropdownItem("Item4"));
22 | cmbList.Items.Add(new DarkDropdownItem("Item5"));
23 | cmbList.Items.Add(new DarkDropdownItem("Item6"));
24 |
25 | cmbList.SelectedItemChanged += delegate { System.Console.WriteLine($"Item changed to {cmbList.SelectedItem.Text}"); };
26 | }
27 |
28 | #endregion
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Example/Helpers/SerializerHelper.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Converters;
3 | using System.IO;
4 |
5 | namespace Example.Helpers
6 | {
7 | public class SerializerHelper
8 | {
9 | public static void Serialize(T obj, string file)
10 | {
11 | using (var fs = File.CreateText(file))
12 | {
13 | var serializer = new JsonSerializer();
14 | serializer.Converters.Add(new StringEnumConverter());
15 | serializer.Formatting = Formatting.Indented;
16 |
17 | serializer.Serialize(fs, obj);
18 | }
19 | }
20 |
21 | public static T Deserialize(string file) where T : class
22 | {
23 | using (var fs = File.OpenText(file))
24 | {
25 | var serializer = new JsonSerializer();
26 | serializer.Converters.Add(new StringEnumConverter());
27 |
28 | var result = serializer.Deserialize(fs, typeof(T));
29 | return result as T;
30 | }
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Example/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/Example/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/Example/Program.cs:
--------------------------------------------------------------------------------
1 | using Example.Forms;
2 | using System;
3 | using System.Windows.Forms;
4 |
5 | namespace Example
6 | {
7 | static class Program
8 | {
9 | [STAThread]
10 | static void Main()
11 | {
12 | Application.EnableVisualStyles();
13 | Application.SetHighDpiMode(HighDpiMode.SystemAware);
14 | Application.SetCompatibleTextRenderingDefault(false);
15 | Application.Run(new MainForm());
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Example/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Dark UI Example")]
9 | [assembly: AssemblyDescription("Example application for Dark UI")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Robin Perris")]
12 | [assembly: AssemblyProduct("Dark UI")]
13 | [assembly: AssemblyCopyright("Copyright © Robin Perris")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("fa334815-6d78-4e9a-9f4d-6c8a58222a57")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Example/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Example.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
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 | /// Returns the cached ResourceManager instance used by this class.
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("Example.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
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 |
--------------------------------------------------------------------------------
/Example/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Example.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 |
--------------------------------------------------------------------------------
/Example/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Example/Resources/Close_16xLG.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/Example/Resources/Close_16xLG.png
--------------------------------------------------------------------------------
/Example/Resources/Collection_16xLG.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/Example/Resources/Collection_16xLG.png
--------------------------------------------------------------------------------
/Example/Resources/Console.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/Example/Resources/Console.png
--------------------------------------------------------------------------------
/Example/Resources/Files_7954.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/Example/Resources/Files_7954.png
--------------------------------------------------------------------------------
/Example/Resources/NewFile_6276.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/Example/Resources/NewFile_6276.png
--------------------------------------------------------------------------------
/Example/Resources/RefactoringLog_12810.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/Example/Resources/RefactoringLog_12810.png
--------------------------------------------------------------------------------
/Example/Resources/StatusAnnotations_Information_16xLG_color.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/Example/Resources/StatusAnnotations_Information_16xLG_color.png
--------------------------------------------------------------------------------
/Example/Resources/StatusAnnotations_Information_16xMD_color.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/Example/Resources/StatusAnnotations_Information_16xMD_color.png
--------------------------------------------------------------------------------
/Example/Resources/application_16x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/Example/Resources/application_16x.png
--------------------------------------------------------------------------------
/Example/Resources/document_16xLG.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/Example/Resources/document_16xLG.png
--------------------------------------------------------------------------------
/Example/Resources/folder_16x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/Example/Resources/folder_16x.png
--------------------------------------------------------------------------------
/Example/Resources/folder_Closed_16xLG.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/Example/Resources/folder_Closed_16xLG.png
--------------------------------------------------------------------------------
/Example/Resources/properties_16xLG.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/Example/Resources/properties_16xLG.png
--------------------------------------------------------------------------------
/Example/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Robin
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.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## Alt UI
4 | Bringing modern styling and features to WinForms
5 |
6 | ### About Alt UI
7 | Alt UI is an attempt to create a simple, extensible control library which emulates standard WinForms controls, but with a more modern look and feel.
8 | It does this with a mix of rounded corners, an a theme that matches your system settings.
9 | For Windows 11, [StartAllBack](https://www.startallback.com)'s "Colorize Everything" option is recommended.
10 |
11 | ### Attributio
12 |
13 | Special thanks to the team over at [Ascension Game Dev](https://www.ascensiongamedev.com/) for expanding the library to include `DarkComboBox`, `DarkGroupBox`, and `DarkNumericUpDown`,
14 | aswell as [Robin Perris](http://www.robinperris.com) for the Original DarkUI this is based on, and anyone who contributed to [this specific fork.](https://github.com/Polo-Sul-Informatica/DarkUI2)
15 |
16 | This repo also includes modified code from [HTAlt](https://github.com/haltroy/HTAlt) for the `DarkTabControl`
17 | and [Cyotek](https://www.cyotek.com)'s [ColorPicker](https://github.com/cyotek/Cyotek.Windows.Forms.ColorPicker) controls.
18 |
19 | ### How to use
20 | Use it as you would use standard WinForms controls.
21 |
22 | You can also read the [original GitHub projects wiki](https://github.com/RobinPerris/DarkUI/wiki). This contains all the information you need to get started as well as more detailed information and guides.
23 |
--------------------------------------------------------------------------------
/icon-64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/icon-64.png
--------------------------------------------------------------------------------
/package.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DarkUI
5 | 2.0.2
6 | DarkUI
7 | Robin Perris
8 | false
9 | MIT
10 | http://www.darkui.com/
11 | icon-64.png
12 | http://www.darkui.com/images/icon-64.png
13 | Dark themed control and docking library for .NET WinForms
14 | Fixed an issue where clearing the items from a DarkDropDown did not also clear the menu
15 | Copyright © Robin Perris
16 | docking winforms net-winforms docking-library docking-application c-sharp dotnet dotnet-framework visual-studio visual-studio-themes windows windows-desktop windows-forms
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/title.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kran27/AltUI/6d52b858355b346518cdb50884206d65fcef7359/title.png
--------------------------------------------------------------------------------
/todo.txt:
--------------------------------------------------------------------------------
1 | DarkUI2
2 | -- moving nodes within a treeview doesn't re-build the next/prev references
3 | -- Add textbox control
4 | -- Add dropdown control
5 | -- Allow dropdown to show arbitrary control types
6 | -- Add dropdown treeview control
7 | -- Add tooltip control
8 | -- Add split panel control (and serialised version)
9 | -- Add filter/search control
10 | -- Add tabbed panel control
11 | -- Fix DarkButton image align bullshit
12 | -- Fix checkbox and radiobutton CheckAlign support
13 | -- If you collapse a node when a child has focus, focus the parent node
14 | -- arrow keys to scroll around the scrollbase control -- space to pan?
15 | -- standardise the amount you scroll through with the mousewheel. Basing it on the pixels makes it weird.
16 | -- ScrollView not taking in to account size WITHOUT scrollbars causing you to have to overshoot when re-sizing to get rid of them
17 | -- if the final node in a treeview has been previous expanded, pressing 'down' will cause it to re-open
18 | -- create click-through panel
19 | -- dragging treeview nodes doesn't rebuild prev/next references
20 |
21 | Dock panel
22 | -- make it so highlight form doesn't steal focus
23 | -- add splitters between region groups
24 | -- fix max position of splitters - can currently resize a tool window offscreen
25 | -- serialise the visible content for groups and the active content
26 | -- right click tab menu. close all, close all but this etc. etc.
27 | -- stop dragging tabs instantly going to the end of the row
28 | -- stop differently sized toolwindow tabs from vibrating when dragging
29 | -- remove 1 pixel left padding from bottom region
30 | -- add 1 pixel border between groups in bottom region
31 | -- if bottom & left regions are invisible on load, then content is added, the bottom region will expand too far to the left
--------------------------------------------------------------------------------