diff --git a/CloseWindow.cs b/CloseWindow.cs
new file mode 100644
index 0000000..9a1ead5
--- /dev/null
+++ b/CloseWindow.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Windows;
+using System.Windows.Markup;
+using System.Windows.Input;
+
+namespace Roundify
+{
+ ///
+ /// Closes the current window.
+ ///
+ public class CloseWindowCommand : MarkupExtension, ICommand
+ {
+ public void Execute(object parameter)
+ {
+ if (Application.Current.MainWindow != null) Application.Current.MainWindow.Close();
+ CommandManager.InvalidateRequerySuggested();
+ }
+
+ public event EventHandler CanExecuteChanged;
+
+
+ public bool CanExecute(object parameter)
+ {
+ Window win = Application.Current.MainWindow;
+ return win != null;
+ }
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return this;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Images/Close.png b/Images/Close.png
new file mode 100644
index 0000000..7b03ffc
Binary files /dev/null and b/Images/Close.png differ
diff --git a/Images/icon.ico b/Images/icon.ico
new file mode 100644
index 0000000..16b627d
Binary files /dev/null and b/Images/icon.ico differ
diff --git a/MainWindow.xaml b/MainWindow.xaml
index c3bcaf3..8e86de4 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -3,7 +3,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:local="clr-namespace:Roundify"
+ xmlns:system="clr-namespace:System;assembly=System.Runtime"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800"
AllowsTransparency="True"
@@ -12,5 +14,30 @@
WindowStartupLocation="CenterScreen"
Topmost="True"
IsHitTestVisible="False"
- Background="Transparent">
+ ShowInTaskbar="False"
+ Loaded="Window_Loaded"
+ Background="Transparent"
+ >
+
+
+
+
+
+
+
+
+
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index a58751d..3ffa326 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -8,6 +9,7 @@
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
+using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
@@ -18,15 +20,90 @@ namespace Roundify
///
/// Interaction logic for MainWindow.xaml
///
- public partial class MainWindow : Window
+ public partial class MainWindow : System.Windows.Window
{
+ #region Window styles
+ [Flags]
+ public enum ExtendedWindowStyles
+ {
+ // ...
+ WS_EX_TOOLWINDOW = 0x00000080,
+ // ...
+ }
+
+ public enum GetWindowLongFields
+ {
+ // ...
+ GWL_EXSTYLE = (-20),
+ // ...
+ }
+
+ [DllImport("user32.dll")]
+ private static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex);
+
+ private static IntPtr SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong)
+ {
+ var error = 0;
+ IntPtr result;
+ // Win32 SetWindowLong doesn't clear error on success
+ SetLastError(0);
+
+ if (IntPtr.Size == 4)
+ {
+ // use SetWindowLong
+ var tempResult = IntSetWindowLong(hWnd, nIndex, IntPtrToInt32(dwNewLong));
+ error = Marshal.GetLastWin32Error();
+ result = new IntPtr(tempResult);
+ }
+ else
+ {
+ // use SetWindowLongPtr
+ result = IntSetWindowLongPtr(hWnd, nIndex, dwNewLong);
+ error = Marshal.GetLastWin32Error();
+ }
+
+ if ((result == IntPtr.Zero) && (error != 0))
+ {
+ throw new System.ComponentModel.Win32Exception(error);
+ }
+
+ return result;
+ }
+
+ [DllImport("user32.dll", EntryPoint = "SetWindowLongPtr", SetLastError = true)]
+ private static extern IntPtr IntSetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
+
+ [DllImport("user32.dll", EntryPoint = "SetWindowLong", SetLastError = true)]
+ private static extern Int32 IntSetWindowLong(IntPtr hWnd, int nIndex, Int32 dwNewLong);
+
+ private static int IntPtrToInt32(IntPtr intPtr)
+ {
+ return unchecked((int)intPtr.ToInt64());
+ }
+
+ [DllImport("kernel32.dll", EntryPoint = "SetLastError")]
+ private static extern void SetLastError(int dwErrorCode);
+ #endregion
+
public MainWindow()
{
InitializeComponent();
- ImageBrush myBrush = new ImageBrush();
- myBrush.ImageSource = new BitmapImage(new Uri(@"..\..\..\png.png", UriKind.Relative));
- this.Background = myBrush;
+ var myBrush = new ImageBrush
+ {
+ ImageSource = new BitmapImage(new Uri(@"..\..\..\scaledCorners.png", UriKind.Relative))
+ };
+ Background = myBrush;
+ }
+
+ private void Window_Loaded(object sender, RoutedEventArgs e)
+ {
+ WindowInteropHelper wndHelper = new WindowInteropHelper(this);
+
+ int exStyle = (int)GetWindowLong(wndHelper.Handle, (int)GetWindowLongFields.GWL_EXSTYLE);
+
+ exStyle |= (int)ExtendedWindowStyles.WS_EX_TOOLWINDOW;
+ SetWindowLong(wndHelper.Handle, (int)GetWindowLongFields.GWL_EXSTYLE, (IntPtr)exStyle);
}
}
}
diff --git a/README.MD b/README.MD
index 4ec4bca..b5810f7 100644
--- a/README.MD
+++ b/README.MD
@@ -1,4 +1,9 @@
- ~Description:
+Note: If you are looking for a release for the version that runs in the background with a tray icon, please look at the releases tab.
+
+The following documentation is out of date and will not be updated. You do still need to install the runtime however.
+
+
+~Description:
This is a program that makes your screen's window rounded just like displaperture but for windows.
~Disclamer:
diff --git a/Roundify.csproj b/Roundify.csproj
index 8824b2f..04612f7 100644
--- a/Roundify.csproj
+++ b/Roundify.csproj
@@ -21,4 +21,15 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/roundedCorners.psd b/roundedCorners.psd
new file mode 100644
index 0000000..05670d9
Binary files /dev/null and b/roundedCorners.psd differ
diff --git a/scaledCorners.png b/scaledCorners.png
new file mode 100644
index 0000000..296a86b
Binary files /dev/null and b/scaledCorners.png differ