made doctor window fancy
This commit is contained in:
@@ -6,17 +6,27 @@
|
||||
xmlns:views="clr-namespace:DoctorApp.Views"
|
||||
StartupUri="Views/MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<DataTemplate DataType="{x:Type viewModels:MainViewModel}">
|
||||
<views:MainView />
|
||||
<!-- This is a UserControl -->
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewModels:LoginViewModel}">
|
||||
<views:LoginView />
|
||||
<!-- This is a UserControl -->
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewModels:ClientInfoViewModel}">
|
||||
<views:ClientInfoView/>
|
||||
</DataTemplate>
|
||||
<ResourceDictionary>
|
||||
<DataTemplate DataType="{x:Type viewModels:MainViewModel}">
|
||||
<views:MainView />
|
||||
<!-- This is a UserControl -->
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewModels:LoginViewModel}">
|
||||
<views:LoginView />
|
||||
<!-- This is a UserControl -->
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewModels:ClientInfoViewModel}">
|
||||
<views:ClientInfoView/>
|
||||
</DataTemplate>
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Styles/Fonts.xaml"/>
|
||||
<ResourceDictionary Source="Styles/Colors.xaml"/>
|
||||
<ResourceDictionary Source="Styles/Buttons.xaml"/>
|
||||
<ResourceDictionary Source="Styles/Texts.xaml"/>
|
||||
<ResourceDictionary Source="Styles/Windows.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
||||
@@ -57,6 +57,9 @@ namespace DoctorApp.Utils
|
||||
/// <param name="ar">the result of the async read</param>
|
||||
private void OnRead(IAsyncResult ar)
|
||||
{
|
||||
if (ar == null || (!ar.IsCompleted) || (!this.stream.CanRead))
|
||||
return;
|
||||
|
||||
int receivedBytes = this.stream.EndRead(ar);
|
||||
|
||||
if (totalBufferReceived + receivedBytes > 1024)
|
||||
@@ -91,7 +94,7 @@ namespace DoctorApp.Utils
|
||||
Debug.WriteLine("Username and password correct!");
|
||||
this.LoginViewModel.setLoginStatus(true);
|
||||
this.connected = true;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -192,7 +195,7 @@ namespace DoctorApp.Utils
|
||||
/// <param name="bytes">the message</param>
|
||||
public void Bike(byte[] bytes)
|
||||
{
|
||||
|
||||
|
||||
if (!sessionRunning)
|
||||
{
|
||||
return;
|
||||
@@ -202,18 +205,18 @@ namespace DoctorApp.Utils
|
||||
throw new ArgumentNullException("no bytes");
|
||||
}
|
||||
byte[] message = DataParser.GetRawDataMessage(bytes);
|
||||
|
||||
/* switch (bytes[0])
|
||||
{
|
||||
|
||||
case 0x10:
|
||||
/* switch (bytes[0])
|
||||
{
|
||||
|
||||
if (canSendToEngine) engineConnection.BikeSpeed = (bytes[4] | (bytes[5] << 8)) * 0.01f;
|
||||
break;
|
||||
case 0x19:
|
||||
if (canSendToEngine) engineConnection.BikePower = (bytes[5]) | (bytes[6] & 0b00001111) << 8;
|
||||
break;
|
||||
}*/
|
||||
case 0x10:
|
||||
|
||||
if (canSendToEngine) engineConnection.BikeSpeed = (bytes[4] | (bytes[5] << 8)) * 0.01f;
|
||||
break;
|
||||
case 0x19:
|
||||
if (canSendToEngine) engineConnection.BikePower = (bytes[5]) | (bytes[6] & 0b00001111) << 8;
|
||||
break;
|
||||
}*/
|
||||
|
||||
|
||||
this.stream.BeginWrite(message, 0, message.Length, new AsyncCallback(OnWrite), null);
|
||||
@@ -234,7 +237,7 @@ namespace DoctorApp.Utils
|
||||
/// </summary>
|
||||
public void tryLogin(string username, string password)
|
||||
{
|
||||
|
||||
|
||||
string hashPassword = Util.Hasher.HashString(password);
|
||||
|
||||
byte[] message = DataParser.getJsonMessage(DataParser.LoginAsDoctor(username, hashPassword));
|
||||
@@ -266,5 +269,13 @@ namespace DoctorApp.Utils
|
||||
{
|
||||
this.ClientInfoViewModel = clientInfoViewModel;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Debug.WriteLine("client dispose called");
|
||||
this.stream.Dispose();
|
||||
this.client.Dispose();
|
||||
this.handler?.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,134 @@
|
||||
using DoctorApp.Models;
|
||||
using DoctorApp.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using System.Diagnostics;
|
||||
using Util;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using DoctorApp.Models;
|
||||
using DoctorApp.Utils;
|
||||
using Util.MagicCode;
|
||||
|
||||
namespace DoctorApp.ViewModels
|
||||
{
|
||||
class MainWindowViewModel : ObservableObject
|
||||
{
|
||||
#region private members
|
||||
|
||||
private Window mWindow;
|
||||
|
||||
private int mOuterMarginSize = 10;
|
||||
private int mWindowRadius = 10;
|
||||
|
||||
#endregion
|
||||
|
||||
#region commands
|
||||
|
||||
public ICommand MinimizeCommand { get; set; }
|
||||
|
||||
public ICommand MaximizeCommand { get; set; }
|
||||
|
||||
public ICommand CloseCommand { get; set; }
|
||||
|
||||
public ICommand MenuCommand { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region public properties
|
||||
public Info InfoModel { get; set; }
|
||||
|
||||
public ObservableObject SelectedViewModel { get; set; }
|
||||
|
||||
public Client client { get; }
|
||||
|
||||
public MainWindowViewModel(Client client)
|
||||
/// <summary>
|
||||
/// size of the resize border around the window
|
||||
/// </summary>
|
||||
|
||||
public double MinimumWidth { get; set; } = 250;
|
||||
|
||||
public double MinimumHeight { get; set; } = 250;
|
||||
|
||||
|
||||
|
||||
public int ResizeBorder { get; set; } = 6;
|
||||
|
||||
public Thickness ResizeBorderThickness { get { return new Thickness(ResizeBorder + OuterMarginSize); } }
|
||||
|
||||
public Thickness InnerContentPadding { get { return new Thickness(ResizeBorder); } }
|
||||
|
||||
|
||||
public Thickness OuterMarginThickness { get { return new Thickness(OuterMarginSize); } }
|
||||
|
||||
public CornerRadius WindowCornerRadius { get { return new CornerRadius(WindowRadius); } }
|
||||
|
||||
public int OuterMarginSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return mWindow.WindowState == WindowState.Maximized ? 0 : mOuterMarginSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
mOuterMarginSize = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int WindowRadius
|
||||
{
|
||||
get
|
||||
{
|
||||
return mWindow.WindowState == WindowState.Maximized ? 0 : mWindowRadius;
|
||||
}
|
||||
set
|
||||
{
|
||||
mWindowRadius = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int TitleHeight { get; set; } = 42;
|
||||
|
||||
public GridLength TitleHeightGridLength { get { return new GridLength(TitleHeight + ResizeBorder); } }
|
||||
|
||||
#endregion
|
||||
|
||||
public MainWindowViewModel(Window window, Client client)
|
||||
{
|
||||
this.mWindow = window;
|
||||
|
||||
this.mWindow.StateChanged += (sender, e) =>
|
||||
{
|
||||
OnPropertyChanged(nameof(ResizeBorderThickness));
|
||||
OnPropertyChanged(nameof(OuterMarginThickness));
|
||||
OnPropertyChanged(nameof(WindowCornerRadius));
|
||||
OnPropertyChanged(nameof(OuterMarginSize));
|
||||
OnPropertyChanged(nameof(WindowRadius));
|
||||
};
|
||||
|
||||
this.InfoModel = new Info();
|
||||
this.client = client;
|
||||
LoginViewModel loginViewModel = new LoginViewModel(this);
|
||||
SelectedViewModel = loginViewModel;
|
||||
this.client.SetLoginViewModel(loginViewModel);
|
||||
|
||||
this.MinimizeCommand = new RelayCommand(() => this.mWindow.WindowState = WindowState.Minimized);
|
||||
this.MaximizeCommand = new RelayCommand(() => this.mWindow.WindowState ^= WindowState.Maximized);
|
||||
this.CloseCommand = new RelayCommand(() => this.mWindow.Close());
|
||||
this.MenuCommand = new RelayCommand(() => SystemCommands.ShowSystemMenu(this.mWindow, GetMousePosition()));
|
||||
|
||||
var resizer = new WindowResizer(this.mWindow);
|
||||
|
||||
this.mWindow.Closed += (sender, e) => this.client.Dispose();
|
||||
}
|
||||
|
||||
|
||||
#region helper
|
||||
|
||||
private Point GetMousePosition()
|
||||
{
|
||||
Debug.WriteLine("getmousePosition called");
|
||||
var p = Mouse.GetPosition(this.mWindow);
|
||||
return new Point(p.X + this.mWindow.Left, p.Y + this.mWindow.Top);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,113 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:DoctorApp"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800"
|
||||
WindowState="Maximized">
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
<Window.Resources>
|
||||
<Style TargetType="{x:Type local:MainWindow}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Window}">
|
||||
<Border Padding="{Binding OuterMarginThickness, FallbackValue=10}" >
|
||||
<Grid>
|
||||
|
||||
<!-- opacity mask -->
|
||||
<Border x:Name="Container"
|
||||
Background="{StaticResource BackgroundLightBrush}"
|
||||
CornerRadius="{Binding WindowCornerRadius, FallbackValue=10}"/>
|
||||
|
||||
|
||||
<Border CornerRadius="{Binding WindowCornerRadius, FallbackValue=10}"
|
||||
Background="{StaticResource BackgroundVeryLightBrush}">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect ShadowDepth="0" Opacity="0.2"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
|
||||
|
||||
<Grid>
|
||||
|
||||
<Grid.OpacityMask>
|
||||
<VisualBrush Visual="{Binding ElementName=Container}"/>
|
||||
</Grid.OpacityMask>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="{Binding TitleHeightGridLength, FallbackValue=42}"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Title bar -->
|
||||
<Grid Grid.Column="0" Grid.Row="0" Panel.ZIndex="1" Background="{StaticResource BackgroundLightBrush}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- icon -->
|
||||
<Button Grid.Column="0" Style="{StaticResource SystemIconButton}" Command="{Binding MenuCommand}">
|
||||
<Image Source="/Images/Logo/icon1.ico"/>
|
||||
<!--<TextBlock Text="icon"/>-->
|
||||
</Button>
|
||||
|
||||
<!-- Title -->
|
||||
<Viewbox Grid.Column="1" Margin="0">
|
||||
<TextBlock Style="{StaticResource HeaderText}" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Title, FallbackValue=failed}"/>
|
||||
</Viewbox>
|
||||
|
||||
<!-- Window buttons -->
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<Button Style="{StaticResource WindowControlButton}" Content="_" Command="{Binding MinimizeCommand}"/>
|
||||
<Button Style="{StaticResource WindowControlButton}" Content="[]" Command="{Binding MaximizeCommand}"/>
|
||||
<Button Style="{StaticResource WindowCloseButton}" Content="X" Command="{Binding CloseCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
<!-- Page content -->
|
||||
<Border Grid.Row="1" Grid.Column="0">
|
||||
<ContentPresenter Content="{TemplateBinding Content}"/>
|
||||
</Border>
|
||||
|
||||
<!-- shadow? -->
|
||||
<Border Grid.Row="1" Height="6" BorderThickness="0 0.2 0 0" VerticalAlignment="Top">
|
||||
<!--<Border.BorderBrush>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientStop Color="{StaticResource BackgroundSemiLight}" Offset="0.0"/>
|
||||
<GradientStop Color="{StaticResource BackgroundVeryLight}" Offset="1.0"/>
|
||||
</LinearGradientBrush>
|
||||
</Border.BorderBrush>-->
|
||||
|
||||
|
||||
<Border.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="Transparent" Offset="1.0"/>
|
||||
<GradientStop Color="#7000" Offset="0.0"/>
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome
|
||||
ResizeBorderThickness="{Binding ResizeBorderThickness}"
|
||||
CaptionHeight="{Binding TitleHeight}"
|
||||
CornerRadius="0"
|
||||
GlassFrameThickness="0"/>
|
||||
</WindowChrome.WindowChrome>
|
||||
|
||||
<Grid>
|
||||
<ContentControl HorizontalAlignment="Center" VerticalAlignment="Center" Content="{Binding SelectedViewModel}" Focusable="False" />
|
||||
<Frame Content="{Binding SelectedViewModel}" Focusable="False" NavigationUIVisibility="Hidden"/>
|
||||
<Label Content="gemaakt door: mensen" DockPanel.Dock="Bottom" HorizontalAlignment="Right" VerticalAlignment="Bottom" FontStyle="Italic" Foreground="Gray"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace DoctorApp
|
||||
{
|
||||
Client client = new Client();
|
||||
InitializeComponent();
|
||||
DataContext = new MainWindowViewModel(client);
|
||||
DataContext = new MainWindowViewModel(this, client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DataParser.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Hasher.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)MagicCode\WindowResizer.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ObservableObject.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
212
Hashing/MagicCode/WindowResizer.cs
Normal file
212
Hashing/MagicCode/WindowResizer.cs
Normal file
@@ -0,0 +1,212 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace Util.MagicCode
|
||||
{
|
||||
/// <summary>
|
||||
/// Fixes the issue with Windows of Style <see cref="WindowStyle.None"/> covering the taskbar
|
||||
/// </summary>
|
||||
public class WindowResizer
|
||||
{
|
||||
#region Private Members
|
||||
|
||||
/// <summary>
|
||||
/// The window to handle the resizing for
|
||||
/// </summary>
|
||||
private Window mWindow;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dll Imports
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
static extern bool GetCursorPos(out POINT lpPoint);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern bool GetMonitorInfo(IntPtr hMonitor, MONITORINFO lpmi);
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
static extern IntPtr MonitorFromPoint(POINT pt, MonitorOptions dwFlags);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
/// <param name="window">The window to monitor and correctly maximize</param>
|
||||
/// <param name="adjustSize">The callback for the host to adjust the maximum available size if needed</param>
|
||||
public WindowResizer(Window window)
|
||||
{
|
||||
mWindow = window;
|
||||
|
||||
// Listen out for source initialized to setup
|
||||
mWindow.SourceInitialized += Window_SourceInitialized;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Initialize
|
||||
|
||||
/// <summary>
|
||||
/// Initialize and hook into the windows message pump
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Window_SourceInitialized(object sender, System.EventArgs e)
|
||||
{
|
||||
// Get the handle of this window
|
||||
var handle = (new WindowInteropHelper(mWindow)).Handle;
|
||||
var handleSource = HwndSource.FromHwnd(handle);
|
||||
|
||||
// If not found, end
|
||||
if (handleSource == null)
|
||||
return;
|
||||
|
||||
// Hook into it's Windows messages
|
||||
handleSource.AddHook(WindowProc);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Windows Proc
|
||||
|
||||
/// <summary>
|
||||
/// Listens out for all windows messages for this window
|
||||
/// </summary>
|
||||
/// <param name="hwnd"></param>
|
||||
/// <param name="msg"></param>
|
||||
/// <param name="wParam"></param>
|
||||
/// <param name="lParam"></param>
|
||||
/// <param name="handled"></param>
|
||||
/// <returns></returns>
|
||||
private IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
// Handle the GetMinMaxInfo of the Window
|
||||
case 0x0024:/* WM_GETMINMAXINFO */
|
||||
WmGetMinMaxInfo(hwnd, lParam);
|
||||
handled = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return (IntPtr)0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Get the min/max window size for this window
|
||||
/// Correctly accounting for the taskbar size and position
|
||||
/// </summary>
|
||||
/// <param name="hwnd"></param>
|
||||
/// <param name="lParam"></param>
|
||||
private void WmGetMinMaxInfo(System.IntPtr hwnd, System.IntPtr lParam)
|
||||
{
|
||||
POINT lMousePosition;
|
||||
GetCursorPos(out lMousePosition);
|
||||
|
||||
IntPtr lPrimaryScreen = MonitorFromPoint(new POINT(0, 0), MonitorOptions.MONITOR_DEFAULTTOPRIMARY);
|
||||
MONITORINFO lPrimaryScreenInfo = new MONITORINFO();
|
||||
if (GetMonitorInfo(lPrimaryScreen, lPrimaryScreenInfo) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IntPtr lCurrentScreen = MonitorFromPoint(lMousePosition, MonitorOptions.MONITOR_DEFAULTTONEAREST);
|
||||
|
||||
MINMAXINFO lMmi = (MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(MINMAXINFO));
|
||||
|
||||
if (lPrimaryScreen.Equals(lCurrentScreen) == true)
|
||||
{
|
||||
lMmi.ptMaxPosition.X = lPrimaryScreenInfo.rcWork.Left;
|
||||
lMmi.ptMaxPosition.Y = lPrimaryScreenInfo.rcWork.Top;
|
||||
lMmi.ptMaxSize.X = lPrimaryScreenInfo.rcWork.Right - lPrimaryScreenInfo.rcWork.Left;
|
||||
lMmi.ptMaxSize.Y = lPrimaryScreenInfo.rcWork.Bottom - lPrimaryScreenInfo.rcWork.Top;
|
||||
}
|
||||
else
|
||||
{
|
||||
lMmi.ptMaxPosition.X = lPrimaryScreenInfo.rcMonitor.Left;
|
||||
lMmi.ptMaxPosition.Y = lPrimaryScreenInfo.rcMonitor.Top;
|
||||
lMmi.ptMaxSize.X = lPrimaryScreenInfo.rcMonitor.Right - lPrimaryScreenInfo.rcMonitor.Left;
|
||||
lMmi.ptMaxSize.Y = lPrimaryScreenInfo.rcMonitor.Bottom - lPrimaryScreenInfo.rcMonitor.Top;
|
||||
}
|
||||
|
||||
// Now we have the max size, allow the host to tweak as needed
|
||||
Marshal.StructureToPtr(lMmi, lParam, true);
|
||||
}
|
||||
}
|
||||
|
||||
#region Dll Helper Structures
|
||||
|
||||
enum MonitorOptions : uint
|
||||
{
|
||||
MONITOR_DEFAULTTONULL = 0x00000000,
|
||||
MONITOR_DEFAULTTOPRIMARY = 0x00000001,
|
||||
MONITOR_DEFAULTTONEAREST = 0x00000002
|
||||
}
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
||||
public class MONITORINFO
|
||||
{
|
||||
public int cbSize = Marshal.SizeOf(typeof(MONITORINFO));
|
||||
public Rectangle rcMonitor = new Rectangle();
|
||||
public Rectangle rcWork = new Rectangle();
|
||||
public int dwFlags = 0;
|
||||
}
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Rectangle
|
||||
{
|
||||
public int Left, Top, Right, Bottom;
|
||||
|
||||
public Rectangle(int left, int top, int right, int bottom)
|
||||
{
|
||||
this.Left = left;
|
||||
this.Top = top;
|
||||
this.Right = right;
|
||||
this.Bottom = bottom;
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct MINMAXINFO
|
||||
{
|
||||
public POINT ptReserved;
|
||||
public POINT ptMaxSize;
|
||||
public POINT ptMaxPosition;
|
||||
public POINT ptMinTrackSize;
|
||||
public POINT ptMaxTrackSize;
|
||||
};
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct POINT
|
||||
{
|
||||
/// <summary>
|
||||
/// x coordinate of point.
|
||||
/// </summary>
|
||||
public int X;
|
||||
/// <summary>
|
||||
/// y coordinate of point.
|
||||
/// </summary>
|
||||
public int Y;
|
||||
|
||||
/// <summary>
|
||||
/// Construct a point of coordinates (x,y).
|
||||
/// </summary>
|
||||
public POINT(int x, int y)
|
||||
{
|
||||
this.X = x;
|
||||
this.Y = y;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user