-
Notifications
You must be signed in to change notification settings - Fork 1
/
MainForm.cs
554 lines (450 loc) · 19.2 KB
/
MainForm.cs
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
using Gma.System.MouseKeyHook;
using Microsoft.Win32;
using NAudio.Wave;
using NAudio.Wave.SampleProviders;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mechvibes.CSharp
{
public partial class MainForm : Form
{
/// <summary>
/// Different states of the program
/// </summary>
public enum ProgramState
{
/// <summary>
/// Window is visible to the user
/// </summary>
Visible,
/// <summary>
/// Window is minimized the the taskbar
/// </summary>
Minimized,
/// <summary>
/// Window is minimized to the system tray
/// </summary>
MinimizedToTray
}
public MainForm()
{
InitializeComponent();
string cursorPath = Registry.CurrentUser.OpenSubKey("Control Panel").OpenSubKey("Cursors").GetValue("Hand").ToString();
IntPtr cursorHandle = string.IsNullOrEmpty(cursorPath) ? IntPtr.Zero : LoadCursorFromFile(cursorPath);
Cursor cursorHand = cursorHandle == IntPtr.Zero ? Cursors.Hand : new Cursor(cursorHandle);
picMinimizeToSystemTray.Cursor = cursorHand;
picMinimize.Cursor = cursorHand;
picClose.Cursor = cursorHand;
cmbSelectedSoundPack.Cursor = cursorHand;
btnReloadSoundPacks.Cursor = cursorHand;
btnShowSoundPackFolder.Cursor = cursorHand;
btnOpenSoundEditor.Cursor = cursorHand;
lblGitHubAccount.Cursor = cursorHand;
lblGitHubRepository.Cursor = cursorHand;
void Unfocus(object sender, EventArgs e) => lblTitle.Focus();
cmbSelectedSoundPack.SelectionChangeCommitted += new EventHandler(Unfocus);
btnReloadSoundPacks.Click += new EventHandler(Unfocus);
btnShowSoundPackFolder.Click += new EventHandler(Unfocus);
btnOpenSoundEditor.Click += new EventHandler(Unfocus);
picMinimizeToSystemTray.Image = Bitmaps.Instance[32, Color.Gray, Color.White, BitmapType.DownArrow];
picMinimize.Image = Bitmaps.Instance[32, Color.Gray, Color.White, BitmapType.Minimize];
picClose.Image = Bitmaps.Instance[32, Color.Black, Color.White, BitmapType.Close];
Bitmap iconBitmap = new Bitmap(32, 32);
using (Graphics iconGraphics = Graphics.FromImage(iconBitmap))
iconGraphics.DrawIcon(Icon, new Rectangle(0, 0, 32, 32));
picIcon.Image = iconBitmap;
Timer t = new Timer { Interval = 1000 };
t.Tick += (s, e) =>
{
string[] args = Environment.GetCommandLineArgs();
args = args.Where(str_Argument => str_Argument != args.First()).ToArray();
if (args.Length > 1)
switch ((ProgramState)TypeDescriptor.GetConverter(typeof(ProgramState)).ConvertFromString(args[0].Substring(2)))
{
case ProgramState.Minimized:
MinimizeWindow(this, EventArgs.Empty);
break;
case ProgramState.MinimizedToTray:
MinimizeToSystemTray(this, EventArgs.Empty);
break;
default: break;
}
t.Dispose();
};
t.Start();
}
#region Basic Window Functionality
[DllImport("user32.dll")]
private static extern IntPtr LoadCursorFromFile(string lpFilename);
[DllImport("user32.dll")]
private static extern bool ReleaseCapture();
[DllImport("user32.dll")]
private static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
public ProgramState State { get; set; } = ProgramState.Visible;
protected override void OnFormClosing(FormClosingEventArgs e)
{
base.OnFormClosing(e);
trayicon.Visible = false;
trayicon.Dispose();
}
private void DragForm(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage(Handle, 161, 2, 0);
}
}
private void UnminimizeWindowToNormal(object sender, EventArgs e)
{
Visible = true;
State = ProgramState.Visible;
}
private void MinimizeToSystemTray(object sender, EventArgs e)
{
Visible = false;
State = ProgramState.MinimizedToTray;
}
private void MinimizeWindow(object sender, EventArgs e)
{
WindowState = FormWindowState.Minimized;
State = ProgramState.Minimized;
}
private void CloseWindow(object sender, EventArgs e)
{
Application.Exit();
}
private void MinimizeSysTray_MouseEnter(object sender, EventArgs e) => picMinimizeToSystemTray.BackColor = SystemColors.Control;
private void MinimizeSysTray_MouseLeave(object sender, EventArgs e) => picMinimizeToSystemTray.BackColor = Color.White;
private void Minimize_MouseEnter(object sender, EventArgs e) => picMinimize.BackColor = SystemColors.Control;
private void Minimize_MouseLeave(object sender, EventArgs e) => picMinimize.BackColor = Color.White;
private void Close_MouseEnter(object sender, EventArgs e) => picClose.BackColor = SystemColors.Control;
private void Close_MouseLeave(object sender, EventArgs e) => picClose.BackColor = Color.White;
private void GitHubAccount_MouseEnter(object sender, EventArgs e) => lblGitHubAccount.Font = new Font("Segoe UI", 10.0f, FontStyle.Underline);
private void GitHubAccount_MouseLeave(object sender, EventArgs e) => lblGitHubAccount.Font = new Font("Segoe UI", 10.0f);
private void GitHubRepository_MouseEnter(object sender, EventArgs e) => lblGitHubRepository.Font = new Font("Segoe UI", 10.0f, FontStyle.Underline);
private void GitHubRepository_MouseLeave(object sender, EventArgs e) => lblGitHubRepository.Font = new Font("Segoe UI", 10.0f);
private void GitHubAccount_Click(object sender, EventArgs e) => Process.Start("https://github.com/Lexz-08");
private void GitHubRepository_Click(object sender, EventArgs e) => Process.Start("https://github.com/Lexz-08/Mechvibes.CSharp");
#endregion
#region SoundPack Management
private readonly string mechvibesFolder = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\mechvibes_custom";
private readonly List<SoundPack> soundpacks = new List<SoundPack>();
private SoundPack currentSoundpack;
private Keys prevKey = Keys.None;
private int audioVolume = 50;
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
DownloadDefaultPacks();
IKeyboardMouseEvents hook = Hook.GlobalEvents();
hook.KeyDown += Keyboard_KeyDown;
hook.KeyUp += Keyboard_KeyUp;
FormClosing += (s, ee) =>
{
hook.KeyDown -= Keyboard_KeyDown;
hook.KeyUp -= Keyboard_KeyUp;
hook.Dispose();
JObject settings = new JObject();
settings.Add(new JProperty("pack", cmbSelectedSoundPack.Text));
settings.Add(new JProperty("volume", numVolume.Value));
File.WriteAllText($"{Application.StartupPath}\\settings.json", settings.ToString().Replace(" ", "\t"));
};
if (!File.Exists($"{Application.StartupPath}\\settings.json"))
File.WriteAllText($"{Application.StartupPath}\\settings.json", "{" +
"\n\t\"pack\": \"CherryMX Black - ABS keycaps\"," +
"\n\t\"volume\": 50" +
"\n}");
else
{
JObject settings = JObject.Parse(File.ReadAllText($"{Application.StartupPath}\\settings.json"));
if (settings.ContainsKey("pack"))
{
string pack = settings.Value<string>("pack");
if (soundpacks.Any(soundpack => soundpack.Name == pack))
{
cmbSelectedSoundPack.Text = pack;
SoundPackSelected(this, e);
}
else File.WriteAllText($"{Application.StartupPath}\\settings.json", File.ReadAllText($"{Application.StartupPath}\\settings.json").Replace("\"pack\": \"" + pack + "\"", "\"pack\": \"CherryMX Black - ABS keycaps\""));
}
else
{
settings.AddFirst(new JProperty("pack", "CherryMX Black - ABS keycaps"));
File.WriteAllText($"{Application.StartupPath}\\settings.json", settings.ToString());
}
if (settings.ContainsKey("volume"))
{
int volume = settings.Value<int>("volume");
if (numVolume.Minimum <= volume && volume <= numVolume.Maximum)
{
numVolume.Value = volume;
trckVolume.Value = volume;
}
else File.WriteAllText($"{Application.StartupPath}\\settings.json", File.ReadAllText($"{Application.StartupPath}\\settings.json").Replace("\"volume\": " + volume, "\"volume\": 50"));
}
else
{
settings.Add(new JProperty("volume", 50));
File.WriteAllText($"{Application.StartupPath}\\settings.json", settings.ToString());
}
}
}
private void DownloadDefaultPacks()
{
void Extract(string Resource, string File)
{
using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream(Resource))
using (BinaryReader br = new BinaryReader(s))
using (FileStream fs = new FileStream(File, FileMode.OpenOrCreate))
using (BinaryWriter bw = new BinaryWriter(fs))
bw.Write(br.ReadBytes((int)s.Length));
}
Assembly asm = Assembly.GetExecutingAssembly();
string[] nk_cream = asm.GetManifestResourceNames().Where(name => name.Contains("nk_cream")).ToArray();
Directory.CreateDirectory($"{Application.StartupPath}\\DefaultPacks");
Directory.CreateDirectory($"{Application.StartupPath}\\DefaultPacks\\cherrymx-black-abs");
Directory.CreateDirectory($"{Application.StartupPath}\\DefaultPacks\\cherrymx-black-pbt");
Directory.CreateDirectory($"{Application.StartupPath}\\DefaultPacks\\cherrymx-blue-abs");
Directory.CreateDirectory($"{Application.StartupPath}\\DefaultPacks\\cherrymx-blue-pbt");
Directory.CreateDirectory($"{Application.StartupPath}\\DefaultPacks\\cherrymx-brown-abs");
Directory.CreateDirectory($"{Application.StartupPath}\\DefaultPacks\\cherrymx-brown-pbt");
Directory.CreateDirectory($"{Application.StartupPath}\\DefaultPacks\\cherrymx-red-abs");
Directory.CreateDirectory($"{Application.StartupPath}\\DefaultPacks\\cherrymx-red-pbt");
Directory.CreateDirectory($"{Application.StartupPath}\\DefaultPacks\\eg-crystal-purple");
Directory.CreateDirectory($"{Application.StartupPath}\\DefaultPacks\\eg-oreo");
Directory.CreateDirectory($"{Application.StartupPath}\\DefaultPacks\\nk-cream");
Directory.CreateDirectory($"{Application.StartupPath}\\DefaultPacks\\topre-purple-hybrid-pbt");
Extract("Mechvibes.CSharp.DefaultPacks.cherrymx_black_abs.config.json", $"{Application.StartupPath}\\DefaultPacks\\cherrymx-black-abs\\config.json");
Extract("Mechvibes.CSharp.DefaultPacks.cherrymx_black_abs.sound.wav", $"{Application.StartupPath}\\DefaultPacks\\cherrymx-black-abs\\sound.wav");
Extract("Mechvibes.CSharp.DefaultPacks.cherrymx_black_pbt.config.json", $"{Application.StartupPath}\\DefaultPacks\\cherrymx-black-pbt\\config.json");
Extract("Mechvibes.CSharp.DefaultPacks.cherrymx_black_pbt.sound.wav", $"{Application.StartupPath}\\DefaultPacks\\cherrymx-black-pbt\\sound.wav");
Extract("Mechvibes.CSharp.DefaultPacks.cherrymx_blue_abs.config.json", $"{Application.StartupPath}\\DefaultPacks\\cherrymx-blue-abs\\config.json");
Extract("Mechvibes.CSharp.DefaultPacks.cherrymx_blue_abs.sound.wav", $"{Application.StartupPath}\\DefaultPacks\\cherrymx-blue-abs\\sound.wav");
Extract("Mechvibes.CSharp.DefaultPacks.cherrymx_blue_pbt.config.json", $"{Application.StartupPath}\\DefaultPacks\\cherrymx-blue-pbt\\config.json");
Extract("Mechvibes.CSharp.DefaultPacks.cherrymx_blue_pbt.sound.wav", $"{Application.StartupPath}\\DefaultPacks\\cherrymx-blue-pbt\\sound.wav");
Extract("Mechvibes.CSharp.DefaultPacks.cherrymx_brown_abs.config.json", $"{Application.StartupPath}\\DefaultPacks\\cherrymx-brown-abs\\config.json");
Extract("Mechvibes.CSharp.DefaultPacks.cherrymx_brown_abs.sound.wav", $"{Application.StartupPath}\\DefaultPacks\\cherrymx-brown-abs\\sound.wav");
Extract("Mechvibes.CSharp.DefaultPacks.cherrymx_brown_pbt.config.json", $"{Application.StartupPath}\\DefaultPacks\\cherrymx-brown-pbt\\config.json");
Extract("Mechvibes.CSharp.DefaultPacks.cherrymx_brown_pbt.sound.wav", $"{Application.StartupPath}\\DefaultPacks\\cherrymx-brown-pbt\\sound.wav");
Extract("Mechvibes.CSharp.DefaultPacks.cherrymx_red_abs.config.json", $"{Application.StartupPath}\\DefaultPacks\\cherrymx-red-abs\\config.json");
Extract("Mechvibes.CSharp.DefaultPacks.cherrymx_red_abs.sound.wav", $"{Application.StartupPath}\\DefaultPacks\\cherrymx-red-abs\\sound.wav");
Extract("Mechvibes.CSharp.DefaultPacks.cherrymx_red_pbt.config.json", $"{Application.StartupPath}\\DefaultPacks\\cherrymx-red-pbt\\config.json");
Extract("Mechvibes.CSharp.DefaultPacks.cherrymx_red_pbt.sound.wav", $"{Application.StartupPath}\\DefaultPacks\\cherrymx-red-pbt\\sound.wav");
Extract("Mechvibes.CSharp.DefaultPacks.eg_crystal_purple.config.json", $"{Application.StartupPath}\\DefaultPacks\\eg-crystal-purple\\config.json");
Extract("Mechvibes.CSharp.DefaultPacks.eg_crystal_purple.purple.wav", $"{Application.StartupPath}\\DefaultPacks\\eg-crystal-purple\\purple.wav");
Extract("Mechvibes.CSharp.DefaultPacks.eg_oreo.config.json", $"{Application.StartupPath}\\DefaultPacks\\eg-oreo\\config.json");
Extract("Mechvibes.CSharp.DefaultPacks.eg_oreo.oreo.wav", $"{Application.StartupPath}\\DefaultPacks\\eg-oreo\\oreo.wav");
Extract("Mechvibes.CSharp.DefaultPacks.topre_purple_hybrid_pbt.config.json", $"{Application.StartupPath}\\DefaultPacks\\topre-purple-hybrid-pbt\\config.json");
Extract("Mechvibes.CSharp.DefaultPacks.topre_purple_hybrid_pbt.sound.wav", $"{Application.StartupPath}\\DefaultPacks\\topre-purple-hybrid-pbt\\sound.wav");
foreach (string nk_cream_file in nk_cream)
{
string[] parts = nk_cream_file.Split('.');
string name = parts[parts.Length - 2];
string type = parts[parts.Length - 1];
Extract(nk_cream_file, $"{Application.StartupPath}\\DefaultPacks\\nk-cream\\{name}.{type}");
}
LoadDefaultPacks();
}
private void LoadDefaultPacks()
{
cmbSelectedSoundPack.Items.Clear();
foreach (string defaultpack in Directory.EnumerateDirectories($"{Application.StartupPath}\\DefaultPacks"))
{
if (SoundPackHelper.IsMultikeyPack(defaultpack + "\\config.json") == true)
{
SoundPack mechvibesPack = SoundPackHelper.LoadFromManifest(defaultpack + "\\config.json");
soundpacks.Add(mechvibesPack);
cmbSelectedSoundPack.Items.Add(mechvibesPack.Name);
}
else
{
SingleKeySoundPack mechvibesPack = SoundPackHelper.LoadSingleKeyFromManifest(defaultpack + "\\config.json");
soundpacks.Add(mechvibesPack);
cmbSelectedSoundPack.Items.Add(mechvibesPack.Name);
}
}
cmbSelectedSoundPack.Text = cmbSelectedSoundPack.Items[0].ToString();
currentSoundpack = soundpacks.Where(soundpack => soundpack.Name == cmbSelectedSoundPack.Text).First();
LoadSoundPacks();
}
private void LoadSoundPacks()
{
foreach (string soundpack in Directory.EnumerateDirectories(mechvibesFolder))
{
if (SoundPackHelper.IsMultikeyPack(soundpack + "\\config.json") == true)
{
SoundPack mechvibesPack = SoundPackHelper.LoadFromManifest(soundpack + "\\config.json");
soundpacks.Add(mechvibesPack);
cmbSelectedSoundPack.Items.Add(mechvibesPack.Name);
}
else
{
SingleKeySoundPack mechvibesPack = SoundPackHelper.LoadSingleKeyFromManifest(soundpack + "\\config.json");
soundpacks.Add(mechvibesPack);
cmbSelectedSoundPack.Items.Add(mechvibesPack.Name);
}
}
cmbSelectedSoundPack.Text = cmbSelectedSoundPack.Items[0].ToString();
currentSoundpack = soundpacks.Where(soundpack => soundpack.Name == cmbSelectedSoundPack.Text).First();
}
private async void PlayAudio(string file, int volume)
{
await Task.Run(() =>
{
try
{
WaveOutEvent output = new WaveOutEvent
{
Volume = volume / 100.0f,
NumberOfBuffers = 30,
DesiredLatency = 150,
};
AudioFileReader audio = new AudioFileReader(file);
output.Init(audio);
output.PlaybackStopped += (s, e) =>
{
output.Dispose();
audio.Dispose();
};
output.Play();
}
catch { return; }
});
GC.Collect();
}
private async void PlayTrimmedAudio(string file, int volume, AudioRange range)
{
await Task.Run(() =>
{
WaveOutEvent output = new WaveOutEvent
{
Volume = volume / 100.0f,
NumberOfBuffers = 30,
DesiredLatency = 325,
};
AudioFileReader audio = new AudioFileReader(file);
OffsetSampleProvider trimmed = new OffsetSampleProvider(audio)
{
SkipOver = TimeSpan.FromMilliseconds(range.Position),
Take = TimeSpan.FromMilliseconds(range.Duration),
};
output.Init(trimmed);
output.PlaybackStopped += (s, e) =>
{
output.Dispose();
audio.Dispose();
};
output.Play();
});
}
private async void Keyboard_KeyDown(object sender, KeyEventArgs e)
{
GC.Collect();
await Task.Run(() =>
{
GC.Collect();
if (e.KeyCode != prevKey)
{
if (currentSoundpack.GetType() == typeof(SoundPack))
PlayAudio(currentSoundpack.GetBindedAudio(KeymapHelper.GetSoundPackKey(e.KeyCode, false)), audioVolume);
else if (currentSoundpack.GetType() == typeof(SingleKeySoundPack))
{
SingleKeySoundPack soundpack = (SingleKeySoundPack)currentSoundpack;
PlayTrimmedAudio(soundpack.AudioFile, audioVolume, soundpack.GetBindedRange(KeymapHelper.GetSoundPackKey(e.KeyCode, false)));
}
prevKey = e.KeyCode;
}
});
GC.Collect();
}
private async void Keyboard_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == prevKey) await Task.Run(() => prevKey = Keys.None );
}
private void SoundPackSelected(object sender, EventArgs e)
{
currentSoundpack = soundpacks.Where(soundpack => soundpack.Name == cmbSelectedSoundPack.Text).First();
}
private void VolumeChanged(object sender, EventArgs e)
{
if (sender == trckVolume)
numVolume.Value = audioVolume = trckVolume.Value;
else if (sender == numVolume)
trckVolume.Value = audioVolume = (int)numVolume.Value;
}
private void ReloadSoundPacks(object sender, EventArgs e) => LoadDefaultPacks();
private void OpenSoundPackFolder(object sender, EventArgs e) => Process.Start("explorer.exe", mechvibesFolder);
private void OpenSoundEditor(object sender, EventArgs e)
{
SoundEditor soundEditor = new SoundEditor();
soundEditor.Shown += (s, ee) => soundEditor.Focus();
soundEditor.Show();
}
#endregion
#region Custom Windows Drop Shadow
private bool m_aeroEnabled = false;
[DllImport("dwmapi.dll")]
private static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMarInset);
[DllImport("dwmapi.dll")]
private static extern int DwmSetWindowAttribute(IntPtr hWnd, int attr, ref int attrValue, int attrSize);
[DllImport("dwmapi.dll")]
private static extern int DwmIsCompositionEnabled(ref int pfEnabled);
private bool CheckAeroEnabled()
{
if (Environment.OSVersion.Version.Major >= 6)
{
int enabled = 0;
DwmIsCompositionEnabled(ref enabled);
return enabled == 1;
}
return false;
}
private struct MARGINS
{
public int leftWidth;
public int rightWidth;
public int topHeight;
public int bottomHeight;
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
m_aeroEnabled = CheckAeroEnabled();
if (!m_aeroEnabled)
cp.ClassStyle |= 0x20000;
return cp;
}
}
protected override void WndProc(ref Message m)
{
if (m_aeroEnabled)
{
int v = 2;
DwmSetWindowAttribute(Handle, 2, ref v, 4);
MARGINS margins = new MARGINS
{
leftWidth = 0,
rightWidth = 0,
topHeight = 1,
bottomHeight = 0,
};
DwmExtendFrameIntoClientArea(Handle, ref margins);
}
base.WndProc(ref m);
}
#endregion
}
}