本文整理汇总了C#中OpenTK.Platform.Windows.Win32Rectangle类的典型用法代码示例。如果您正苦于以下问题:C# Win32Rectangle类的具体用法?C# Win32Rectangle怎么用?C# Win32Rectangle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Win32Rectangle类属于OpenTK.Platform.Windows命名空间,在下文中一共展示了Win32Rectangle类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GrabCursor
void GrabCursor()
{
Point pos = PointToScreen(new Point(ClientRectangle.X, ClientRectangle.Y));
Win32Rectangle rect = new Win32Rectangle();
rect.left = pos.X;
rect.right = pos.X + ClientRectangle.Width;
rect.top = pos.Y;
rect.bottom = pos.Y + ClientRectangle.Height;
if (!Functions.ClipCursor(ref rect))
Debug.WriteLine(String.Format("Failed to grab cursor. Error: {0}",
Marshal.GetLastWin32Error()));
}
示例2: GetWindowRect
internal extern static BOOL GetWindowRect(HWND windowHandle, out Win32Rectangle windowRectangle);
示例3: CreateWindow
IntPtr CreateWindow(int x, int y, int width, int height, string title, GameWindowFlags options, DisplayDevice device, IntPtr parentHandle)
{
// Use win32 to create the native window.
// Keep in mind that some construction code runs in the WM_CREATE message handler.
// The style of a parent window is different than that of a child window.
// Note: the child window should always be visible, even if the parent isn't.
WindowStyle style = 0;
ExtendedWindowStyle ex_style = 0;
if (parentHandle == IntPtr.Zero)
{
style |= WindowStyle.OverlappedWindow | WindowStyle.ClipChildren;
ex_style = ParentStyleEx;
}
else
{
style |= WindowStyle.Visible | WindowStyle.Child | WindowStyle.ClipSiblings;
ex_style = ChildStyleEx;
}
// Find out the final window rectangle, after the WM has added its chrome (titlebar, sidebars etc).
Win32Rectangle rect = new Win32Rectangle();
rect.left = x; rect.top = y; rect.right = x + width; rect.bottom = y + height;
Functions.AdjustWindowRectEx(ref rect, style, false, ex_style);
// Create the window class that we will use for this window.
// The current approach is to register a new class for each top-level WinGLWindow we create.
if (!class_registered)
{
ExtendedWindowClass wc = new ExtendedWindowClass();
wc.Size = ExtendedWindowClass.SizeInBytes;
wc.Style = DefaultClassStyle;
wc.Instance = Instance;
wc.WndProc = WindowProcedureDelegate;
wc.ClassName = ClassName;
wc.Icon = Icon != null ? Icon.Handle : IntPtr.Zero;
#warning "This seems to resize one of the 'large' icons, rather than using a small icon directly (multi-icon files). Investigate!"
wc.IconSm = Icon != null ? new Icon(Icon, 16, 16).Handle : IntPtr.Zero;
wc.Cursor = Functions.LoadCursor(CursorName.Arrow);
ushort atom = Functions.RegisterClassEx(ref wc);
if (atom == 0)
throw new PlatformException(String.Format("Failed to register window class. Error: {0}", Marshal.GetLastWin32Error()));
class_registered = true;
}
IntPtr window_name = Marshal.StringToHGlobalAuto(title);
IntPtr handle = Functions.CreateWindowEx(
ex_style, ClassName, window_name, style,
rect.left, rect.top, rect.Width, rect.Height,
parentHandle, IntPtr.Zero, Instance, IntPtr.Zero);
if (handle == IntPtr.Zero)
throw new PlatformException(String.Format("Failed to create window. Error: {0}", Marshal.GetLastWin32Error()));
return handle;
}
示例4: From
internal static Win32Rectangle From(Size value)
{
Win32Rectangle rect = new Win32Rectangle();
rect.left = 0;
rect.right = value.Width;
rect.top = 0;
rect.bottom = value.Height;
return rect;
}
示例5: GetClientRect
internal extern static BOOL GetClientRect(HWND windowHandle, out Win32Rectangle clientRectangle);
示例6: AdjustWindowRectEx
internal static extern bool AdjustWindowRectEx(
ref Win32Rectangle lpRect,
WindowStyle dwStyle,
[MarshalAs(UnmanagedType.Bool)] bool bMenu,
ExtendedWindowStyle dwExStyle);
示例7: AdjustWindowRectEx
internal static extern bool AdjustWindowRectEx(ref Win32Rectangle lpRect, WindowStyle dwStyle, bool bMenu, ExtendedWindowStyle dwExStyle);
示例8: CreateWindow
private IntPtr CreateWindow(int x, int y, int width, int height, string title, GameWindowFlags options, DisplayDevice device, IntPtr parentHandle)
{
WindowStyle windowStyle1 = WindowStyle.Overlapped;
WindowStyle windowStyle2;
ExtendedWindowStyle extendedWindowStyle;
if (parentHandle == IntPtr.Zero)
{
windowStyle2 = windowStyle1 | WindowStyle.TiledWindow | WindowStyle.ClipChildren;
extendedWindowStyle = ExtendedWindowStyle.WindowEdge | ExtendedWindowStyle.ApplicationWindow;
}
else
{
windowStyle2 = windowStyle1 | WindowStyle.Child | WindowStyle.Visible | WindowStyle.ClipSiblings;
extendedWindowStyle = ExtendedWindowStyle.Left;
}
Win32Rectangle lpRect = new Win32Rectangle();
lpRect.left = x;
lpRect.top = y;
lpRect.right = x + width;
lpRect.bottom = y + height;
Functions.AdjustWindowRectEx(ref lpRect, windowStyle2, false, extendedWindowStyle);
if (!this.class_registered)
{
if ((int) Functions.RegisterClassEx(ref new ExtendedWindowClass()
{
Size = ExtendedWindowClass.SizeInBytes,
Style = ClassStyle.OwnDC,
Instance = this.Instance,
WndProc = this.WindowProcedureDelegate,
ClassName = this.ClassName,
Icon = this.Icon != null ? this.Icon.Handle : IntPtr.Zero,
IconSm = this.Icon != null ? new Icon(this.Icon, 16, 16).Handle : IntPtr.Zero,
Cursor = Functions.LoadCursor(CursorName.Arrow)
}) == 0)
throw new PlatformException(string.Format("Failed to register window class. Error: {0}", (object) Marshal.GetLastWin32Error()));
this.class_registered = true;
}
IntPtr WindowName = Marshal.StringToHGlobalAuto(title);
IntPtr windowEx = Functions.CreateWindowEx(extendedWindowStyle, this.ClassName, WindowName, windowStyle2, lpRect.left, lpRect.top, lpRect.Width, lpRect.Height, parentHandle, IntPtr.Zero, this.Instance, IntPtr.Zero);
if (windowEx == IntPtr.Zero)
throw new PlatformException(string.Format("Failed to create window. Error: {0}", (object) Marshal.GetLastWin32Error()));
else
return windowEx;
}
示例9: ClipCursor
public static bool ClipCursor(ref Win32Rectangle rcClip);
示例10: GetWindowRect
internal static bool GetWindowRect(IntPtr windowHandle, out Win32Rectangle windowRectangle);
示例11: GetClientRect
internal static bool GetClientRect(IntPtr windowHandle, out Win32Rectangle clientRectangle);