Пример #1
0
 internal static extern bool EndPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
Пример #2
0
 internal static extern IntPtr BeginPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
Пример #3
0
 internal static extern bool EndPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
Пример #4
0
		protected void OnWM_PAINT(ref Message m)
		{
			PAINTSTRUCT ps = new PAINTSTRUCT();

			// Have to call BeginPaint whenever processing a WM_PAINT message
			IntPtr hDC = User32.BeginPaint(m.HWnd, ref ps);

			RECT rectRaw = new RECT();

			// Grab the screen rectangle of the window
			User32.GetWindowRect(this.Handle, ref rectRaw);

			// Convert to a client size rectangle
			Rectangle rectWin = new Rectangle(0, 0, 
				rectRaw.right - rectRaw.left, 
				rectRaw.bottom - rectRaw.top);

			// Create a graphics object for drawing
			using (Graphics g = Graphics.FromHdc(hDC))
			{
				// Create bitmap for drawing onto
				Bitmap memoryBitmap = new Bitmap(rectWin.Width, rectWin.Height);

				using(Graphics h = Graphics.FromImage(memoryBitmap))
				{
					// Draw the background area
					DrawBackground(h, rectWin);

					// Draw the actual menu items
					DrawAllCommands(h);
				}

				// Blit bitmap onto the screen
				g.DrawImageUnscaled(memoryBitmap, 0, 0);
			}

			// Don't forget to end the paint operation!
			User32.EndPaint(m.HWnd, ref ps);
		}
Пример #5
0
 internal static extern IntPtr BeginPaint(IntPtr hWnd, ref PAINTSTRUCT ps);