當前位置: 首頁>>代碼示例>>C#>>正文


C# Windows.Win32Rectangle類代碼示例

本文整理匯總了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()));
 }
開發者ID:raphaelts3,項目名稱:opentk,代碼行數:12,代碼來源:WinGLNative.cs

示例2: GetWindowRect

 internal extern static BOOL GetWindowRect(HWND windowHandle, out Win32Rectangle windowRectangle);
開發者ID:jpbruyere,項目名稱:opentk,代碼行數:1,代碼來源:API.cs

示例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;
        }
開發者ID:raphaelts3,項目名稱:opentk,代碼行數:58,代碼來源:WinGLNative.cs

示例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;
 }
開發者ID:jpbruyere,項目名稱:opentk,代碼行數:9,代碼來源:API.cs

示例5: GetClientRect

 internal extern static BOOL GetClientRect(HWND windowHandle, out Win32Rectangle clientRectangle);
開發者ID:jpbruyere,項目名稱:opentk,代碼行數:1,代碼來源:API.cs

示例6: AdjustWindowRectEx

 internal static extern bool AdjustWindowRectEx(
     ref Win32Rectangle lpRect,
     WindowStyle dwStyle,
     [MarshalAs(UnmanagedType.Bool)] bool bMenu,
     ExtendedWindowStyle dwExStyle);
開發者ID:jpbruyere,項目名稱:opentk,代碼行數:5,代碼來源:API.cs

示例7: AdjustWindowRectEx

 internal static extern bool AdjustWindowRectEx(ref Win32Rectangle lpRect, WindowStyle dwStyle, bool bMenu, ExtendedWindowStyle dwExStyle);
開發者ID:shahid-pk,項目名稱:opentk,代碼行數:1,代碼來源:API.cs

示例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;
 }
開發者ID:tanis2000,項目名稱:FEZ,代碼行數:44,代碼來源:WinGLNative.cs

示例9: ClipCursor

 public static bool ClipCursor(ref Win32Rectangle rcClip);
開發者ID:tanis2000,項目名稱:FEZ,代碼行數:1,代碼來源:Functions.cs

示例10: GetWindowRect

 internal static bool GetWindowRect(IntPtr windowHandle, out Win32Rectangle windowRectangle);
開發者ID:tanis2000,項目名稱:FEZ,代碼行數:1,代碼來源:Functions.cs

示例11: GetClientRect

 internal static bool GetClientRect(IntPtr windowHandle, out Win32Rectangle clientRectangle);
開發者ID:tanis2000,項目名稱:FEZ,代碼行數:1,代碼來源:Functions.cs


注:本文中的OpenTK.Platform.Windows.Win32Rectangle類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。