Skip to content

Commit 3636d0c

Browse files
Updated title bar to match theme
1 parent 8989f41 commit 3636d0c

File tree

7 files changed

+146
-50
lines changed

7 files changed

+146
-50
lines changed

.vs/imageResizer/v17/.suo

-3 KB
Binary file not shown.

imageResizer/AboutBox.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ private void UpdateTheme()
6262

6363
private void SetLightTheme()
6464
{
65+
UseImmersiveDarkMode(Handle, false);
66+
6567
BackColor = DefaultBackColor;
6668
ForeColor = DefaultForeColor;
6769

@@ -71,6 +73,8 @@ private void SetLightTheme()
7173

7274
private void SetDarkTheme()
7375
{
76+
UseImmersiveDarkMode(Handle, true);
77+
7478
BackColor = backgroundColor;
7579
ForeColor = foregroundColor;
7680

imageResizer/Form1.cs

Lines changed: 53 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public partial class Form1 : Form
2020
private Options options;
2121
private readonly string dataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ImageResizer");
2222
private readonly string fileFullPath = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ImageResizer"), "options.xml");
23+
2324
public Form1()
2425
{
2526
InitializeComponent();
@@ -28,6 +29,54 @@ public Form1()
2829
tabControl1.SizeMode = TabSizeMode.Fixed;
2930
}
3031

32+
private void Form1_Load(object sender, EventArgs e)
33+
{
34+
if (File.Exists(fileFullPath))
35+
{
36+
var serializer = new XmlSerializer(typeof(Options));
37+
using (var fs = new FileStream(fileFullPath, System.IO.FileMode.Open))
38+
{
39+
options = (Options)serializer.Deserialize(fs);
40+
41+
}
42+
43+
comboBox1.SelectedIndex = comboBox1.Items.IndexOf(options.NamingConvention) == -1 ? 0 : comboBox1.Items.IndexOf(options.NamingConvention);
44+
switch (options.MaxImageSize.Height)
45+
{
46+
case 480: comboBox2.SelectedIndex = 0; break;
47+
case 600: comboBox2.SelectedIndex = 1; break;
48+
case 768: comboBox2.SelectedIndex = 2; break;
49+
case 1024: comboBox2.SelectedIndex = 3; break;
50+
default: comboBox2.SelectedIndex = 3; break;
51+
}
52+
comboBox3.SelectedIndex = comboBox3.Items.IndexOf(options.FolderName) == -1 ? 0 : comboBox3.Items.IndexOf(options.FolderName);
53+
54+
switch (options.ReducedFolder)
55+
{
56+
case 0: radioButton1.Checked = true; break;
57+
case 1: radioButton2.Checked = true; break;
58+
case 2: radioButton3.Checked = true; break;
59+
}
60+
61+
numericUpDown1.Value = options.ImageQuality;
62+
63+
switch (options.Theme)
64+
{
65+
case 0: radioButton4.Checked = true; break;
66+
case 1: radioButton5.Checked = true; break;
67+
case 2: radioButton6.Checked = true; break;
68+
}
69+
}
70+
else
71+
{
72+
comboBox1.SelectedIndex = 0;
73+
comboBox2.SelectedIndex = 3;
74+
comboBox3.SelectedIndex = 0;
75+
}
76+
77+
UpdateTheme();
78+
}
79+
3180
private void ButtonOptions_Click(object sender, EventArgs e)
3281
{
3382
if (tabControl1.SelectedIndex == 0)
@@ -158,54 +207,6 @@ private void FoldersList_DragEnter(object sender, DragEventArgs e)
158207
e.Effect = DragDropEffects.None;
159208
}
160209

161-
private void Form1_Load(object sender, EventArgs e)
162-
{
163-
if (File.Exists(fileFullPath))
164-
{
165-
var serializer = new XmlSerializer(typeof(Options));
166-
using (var fs = new FileStream(fileFullPath, System.IO.FileMode.Open))
167-
{
168-
options = (Options)serializer.Deserialize(fs);
169-
170-
}
171-
172-
comboBox1.SelectedIndex = comboBox1.Items.IndexOf(options.NamingConvention) == -1 ? 0 : comboBox1.Items.IndexOf(options.NamingConvention);
173-
switch (options.MaxImageSize.Height)
174-
{
175-
case 480: comboBox2.SelectedIndex = 0; break;
176-
case 600: comboBox2.SelectedIndex = 1; break;
177-
case 768: comboBox2.SelectedIndex = 2; break;
178-
case 1024: comboBox2.SelectedIndex = 3; break;
179-
default: comboBox2.SelectedIndex = 3; break;
180-
}
181-
comboBox3.SelectedIndex = comboBox3.Items.IndexOf(options.FolderName) == -1 ? 0 : comboBox3.Items.IndexOf(options.FolderName);
182-
183-
switch (options.ReducedFolder)
184-
{
185-
case 0: radioButton1.Checked = true; break;
186-
case 1: radioButton2.Checked = true; break;
187-
case 2: radioButton3.Checked = true; break;
188-
}
189-
190-
numericUpDown1.Value = options.ImageQuality;
191-
192-
switch (options.Theme)
193-
{
194-
case 0: radioButton4.Checked = true; break;
195-
case 1: radioButton5.Checked = true; break;
196-
case 2: radioButton6.Checked = true; break;
197-
}
198-
}
199-
else
200-
{
201-
comboBox1.SelectedIndex = 0;
202-
comboBox2.SelectedIndex = 3;
203-
comboBox3.SelectedIndex = 0;
204-
}
205-
206-
UpdateTheme();
207-
}
208-
209210
private void ButtonAbout_Click(object sender, EventArgs e)
210211
{
211212
new AboutBox
@@ -308,6 +309,8 @@ private void UpdateTheme()
308309

309310
private void SetLightTheme()
310311
{
312+
UseImmersiveDarkMode(Handle, false);
313+
311314
BackColor = DefaultBackColor;
312315
ForeColor = DefaultForeColor;
313316

@@ -358,6 +361,8 @@ private void SetLightTheme()
358361

359362
private void SetDarkTheme()
360363
{
364+
UseImmersiveDarkMode(Handle, true);
365+
361366
BackColor = backgroundColor;
362367
ForeColor = foregroundColor;
363368

imageResizer/ProgressBars.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ private void UpdateTheme()
257257

258258
private void SetLightTheme()
259259
{
260+
UseImmersiveDarkMode(Handle, false);
261+
260262
BackColor = DefaultBackColor;
261263
ForeColor = DefaultForeColor;
262264

@@ -266,6 +268,8 @@ private void SetLightTheme()
266268

267269
private void SetDarkTheme()
268270
{
271+
UseImmersiveDarkMode(Handle, true);
272+
269273
BackColor = backgroundColor;
270274
ForeColor = foregroundColor;
271275

imageResizer/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("7.0.0")]
35-
[assembly: AssemblyFileVersion("7.0.0")]
34+
[assembly: AssemblyVersion("7.1.0")]
35+
[assembly: AssemblyFileVersion("7.1.0")]

imageResizer/app.manifest

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
3+
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
4+
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
5+
<security>
6+
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
7+
<!-- UAC Manifest Options
8+
If you want to change the Windows User Account Control level replace the
9+
requestedExecutionLevel node with one of the following.
10+
11+
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
12+
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
13+
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
14+
15+
Specifying requestedExecutionLevel element will disable file and registry virtualization.
16+
Remove this element if your application requires this virtualization for backwards
17+
compatibility.
18+
-->
19+
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
20+
</requestedPrivileges>
21+
</security>
22+
</trustInfo>
23+
24+
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
25+
<application>
26+
<!-- A list of the Windows versions that this application has been tested on
27+
and is designed to work with. Uncomment the appropriate elements
28+
and Windows will automatically select the most compatible environment. -->
29+
30+
<!-- Windows Vista -->
31+
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
32+
33+
<!-- Windows 7 -->
34+
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
35+
36+
<!-- Windows 8 -->
37+
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
38+
39+
<!-- Windows 8.1 -->
40+
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
41+
42+
<!-- Windows 10 -->
43+
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
44+
45+
</application>
46+
</compatibility>
47+
48+
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
49+
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
50+
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
51+
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config.
52+
53+
Makes the application long-path aware. See https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
54+
<!--
55+
<application xmlns="urn:schemas-microsoft-com:asm.v3">
56+
<windowsSettings>
57+
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
58+
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
59+
</windowsSettings>
60+
</application>
61+
-->
62+
63+
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
64+
<!--
65+
<dependency>
66+
<dependentAssembly>
67+
<assemblyIdentity
68+
type="win32"
69+
name="Microsoft.Windows.Common-Controls"
70+
version="6.0.0.0"
71+
processorArchitecture="*"
72+
publicKeyToken="6595b64144ccf1df"
73+
language="*"
74+
/>
75+
</dependentAssembly>
76+
</dependency>
77+
-->
78+
79+
</assembly>

imageResizer/imageResizer.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@
6969
<PropertyGroup>
7070
<SignManifests>true</SignManifests>
7171
</PropertyGroup>
72+
<PropertyGroup>
73+
<ApplicationManifest>app.manifest</ApplicationManifest>
74+
</PropertyGroup>
7275
<ItemGroup>
7376
<Reference Include="Microsoft.CSharp" />
7477
<Reference Include="Octokit, Version=0.51.0.0, Culture=neutral, processorArchitecture=MSIL">
@@ -128,6 +131,7 @@
128131
<DesignTime>True</DesignTime>
129132
</Compile>
130133
<None Include="app.config" />
134+
<None Include="app.manifest" />
131135
<None Include="imageResizer_TemporaryKey.pfx" />
132136
<None Include="packages.config" />
133137
<None Include="Properties\Settings.settings">

0 commit comments

Comments
 (0)