-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Simon
committed
Dec 4, 2022
1 parent
682fce1
commit 72429f3
Showing
19 changed files
with
1,527 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
|
||
namespace Core | ||
{ | ||
public class DropShadow | ||
{ | ||
#region Shadowing | ||
|
||
#region Fields | ||
|
||
private bool _isAeroEnabled = false; | ||
private bool _isDraggingEnabled = false; | ||
private const int WM_NCHITTEST = 0x84; | ||
private const int WS_MINIMIZEBOX = 0x20000; | ||
private const int HTCLIENT = 0x1; | ||
private const int HTCAPTION = 0x2; | ||
private const int CS_DBLCLKS = 0x8; | ||
private const int CS_DROPSHADOW = 0x00020000; | ||
private const int WM_NCPAINT = 0x0085; | ||
private const int WM_ACTIVATEAPP = 0x001C; | ||
|
||
#endregion | ||
|
||
#region Structures | ||
|
||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public struct MARGINS | ||
{ | ||
public int leftWidth; | ||
public int rightWidth; | ||
public int topHeight; | ||
public int bottomHeight; | ||
} | ||
|
||
#endregion | ||
|
||
#region Methods | ||
|
||
#region Public | ||
|
||
[DllImport("dwmapi.dll")] | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMarInset); | ||
|
||
[DllImport("dwmapi.dll")] | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize); | ||
|
||
[DllImport("dwmapi.dll")] | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public static extern int DwmIsCompositionEnabled(ref int pfEnabled); | ||
|
||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public static bool IsCompositionEnabled() | ||
{ | ||
if (Environment.OSVersion.Version.Major < 6) return false; | ||
|
||
bool enabled; | ||
DwmIsCompositionEnabled(out enabled); | ||
|
||
return enabled; | ||
} | ||
|
||
#endregion | ||
|
||
#region Private | ||
|
||
[DllImport("dwmapi.dll")] | ||
private static extern int DwmIsCompositionEnabled(out bool enabled); | ||
|
||
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")] | ||
private static extern IntPtr CreateRoundRectRgn | ||
( | ||
int nLeftRect, | ||
int nTopRect, | ||
int nRightRect, | ||
int nBottomRect, | ||
int nWidthEllipse, | ||
int nHeightEllipse | ||
); | ||
|
||
private bool CheckIfAeroIsEnabled() | ||
{ | ||
if (Environment.OSVersion.Version.Major >= 6) | ||
{ | ||
int enabled = 0; | ||
DwmIsCompositionEnabled(ref enabled); | ||
|
||
return (enabled == 1) ? true : false; | ||
} | ||
return false; | ||
} | ||
|
||
#endregion | ||
|
||
#region Overrides | ||
|
||
public void ApplyShadows(Form form) | ||
{ | ||
var v = 2; | ||
|
||
DwmSetWindowAttribute(form.Handle, 2, ref v, 4); | ||
|
||
MARGINS margins = new MARGINS() | ||
{ | ||
bottomHeight = 1, | ||
leftWidth = 0, | ||
rightWidth = 0, | ||
topHeight = 0 | ||
}; | ||
|
||
DwmExtendFrameIntoClientArea(form.Handle, ref margins); | ||
} | ||
|
||
#endregion | ||
|
||
#endregion | ||
|
||
#endregion | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace Splitter | ||
{ | ||
public partial class FormSplitter : Form | ||
{ | ||
public FormSplitter() | ||
{ | ||
InitializeComponent(); | ||
(new Core.DropShadow()).ApplyShadows(this); | ||
} | ||
|
||
private void btnClose_Click(object sender, EventArgs e) | ||
{ | ||
Application.Exit(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<root> | ||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||
<xsd:element name="root" msdata:IsDataSet="true"> | ||
<xsd:complexType> | ||
<xsd:choice maxOccurs="unbounded"> | ||
<xsd:element name="metadata"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" use="required" type="xsd:string" /> | ||
<xsd:attribute name="type" type="xsd:string" /> | ||
<xsd:attribute name="mimetype" type="xsd:string" /> | ||
<xsd:attribute ref="xml:space" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="assembly"> | ||
<xsd:complexType> | ||
<xsd:attribute name="alias" type="xsd:string" /> | ||
<xsd:attribute name="name" type="xsd:string" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="data"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||
<xsd:attribute ref="xml:space" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="resheader"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" type="xsd:string" use="required" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
</xsd:choice> | ||
</xsd:complexType> | ||
</xsd:element> | ||
</xsd:schema> | ||
<resheader name="resmimetype"> | ||
<value>text/microsoft-resx</value> | ||
</resheader> | ||
<resheader name="version"> | ||
<value>2.0</value> | ||
</resheader> | ||
<resheader name="reader"> | ||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<resheader name="writer"> | ||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
</root> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
namespace Splitter | ||
{ | ||
internal static class Program | ||
{ | ||
/// <summary> | ||
/// The main entry point for the application. | ||
/// </summary> | ||
[STAThread] | ||
static void Main(string[] args) | ||
{ | ||
// To customize application configuration such as set high DPI settings or default font, | ||
// see https://aka.ms/applicationconfiguration. | ||
|
||
if (args.Length > 0 && args[0] == "--gui") | ||
{ | ||
ApplicationConfiguration.Initialize(); | ||
Application.Run(new FormSplitter()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net6.0-windows</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<UseWindowsForms>true</UseWindowsForms> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<ApplicationIcon>icons\seperator.ico</ApplicationIcon> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Content Include="icons\seperator.ico" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.4.33110.190 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TaskSplitter11", "TaskSplitter11\TaskSplitter11.csproj", "{1BB6B6E8-2B89-4C0C-B8FA-16096401B733}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Splitter", "Splitter\Splitter.csproj", "{D88803DC-E794-4653-B76F-A5A7C42235D5}" | ||
EndProject | ||
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Installer", "Installer\Installer.vdproj", "{C1AB077D-77F6-4238-9413-A8C879F4D00D}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CD6EEF27-01A7-4952-9181-CD24D8276686}" | ||
ProjectSection(SolutionItems) = preProject | ||
readme.md = readme.md | ||
taskbar-split.png = taskbar-split.png | ||
EndProjectSection | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{1BB6B6E8-2B89-4C0C-B8FA-16096401B733}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{1BB6B6E8-2B89-4C0C-B8FA-16096401B733}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{1BB6B6E8-2B89-4C0C-B8FA-16096401B733}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{1BB6B6E8-2B89-4C0C-B8FA-16096401B733}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{D88803DC-E794-4653-B76F-A5A7C42235D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{D88803DC-E794-4653-B76F-A5A7C42235D5}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{D88803DC-E794-4653-B76F-A5A7C42235D5}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{D88803DC-E794-4653-B76F-A5A7C42235D5}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{C1AB077D-77F6-4238-9413-A8C879F4D00D}.Debug|Any CPU.ActiveCfg = Debug | ||
{C1AB077D-77F6-4238-9413-A8C879F4D00D}.Release|Any CPU.ActiveCfg = Release | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {07A71FEB-CE75-4CED-81D2-FB4E07A2D551} | ||
EndGlobalSection | ||
EndGlobal |
Oops, something went wrong.