当前位置: 首页>>代码示例>>C#>>正文


C# RECT.ToRectangle方法代码示例

本文整理汇总了C#中System.Windows.Forms.RECT.ToRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# RECT.ToRectangle方法的具体用法?C# RECT.ToRectangle怎么用?C# RECT.ToRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.RECT的用法示例。


在下文中一共展示了RECT.ToRectangle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PaintEventStart

		internal override PaintEventArgs PaintEventStart(ref Message msg, IntPtr handle, bool client) {
			IntPtr		hdc;
			PAINTSTRUCT	ps;
			PaintEventArgs	paint_event;
			RECT		rect;
			Rectangle	clip_rect;
			Hwnd		hwnd;

			clip_rect = new Rectangle();
			rect = new RECT();
			ps = new PAINTSTRUCT();

			hwnd = Hwnd.ObjectFromHandle(msg.HWnd);
			
			if (client) {
				if (Win32GetUpdateRect(msg.HWnd, ref rect, false)) {
					if (handle != msg.HWnd) {
						// We need to validate the window where the paint message
						// was generated, otherwise we'll never stop getting paint 
						// messages.
						Win32GetClientRect (msg.HWnd, out rect);
						Win32ValidateRect (msg.HWnd, ref rect);
						hdc = Win32GetDC (handle);
					} else {
						hdc = Win32BeginPaint (handle, ref ps);
						rect = ps.rcPaint;
					}
				} else {
					hdc = Win32GetDC(handle);
				}
				clip_rect = rect.ToRectangle ();
			} else {
				hdc = Win32GetWindowDC (handle);

				// HACK this in for now
				Win32GetWindowRect (handle, out rect);
				clip_rect = new Rectangle (0, 0, rect.Width, rect.Height);
			}

			// If we called BeginPaint, store the PAINTSTRUCT,
			// otherwise store hdc, so that PaintEventEnd can know
			// whether to call EndPaint or ReleaseDC.
			if (ps.hdc != IntPtr.Zero) {
				hwnd.drawing_stack.Push (ps);
			} else {
				hwnd.drawing_stack.Push (hdc);
			}
			
			Graphics dc = Graphics.FromHdc(hdc);
			hwnd.drawing_stack.Push (dc);

			paint_event = new PaintEventArgs(dc, clip_rect);

			return paint_event;
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:55,代码来源:XplatUIWin32.cs

示例2: ToRectangle

 public static global::System.Drawing.Rectangle ToRectangle(RECT Rectangle)
 {
     return Rectangle.ToRectangle();
 }
开发者ID:wimverdamme,项目名称:HideShowWindows,代码行数:4,代码来源:MainForm.cs


注:本文中的System.Windows.Forms.RECT.ToRectangle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。