System.Windows.Forms.Cursor.Draw C# (CSharp) Method

Draw() public method

public Draw ( Graphics g, Rectangle targetRect ) : void
g Graphics
targetRect Rectangle
return void
		public void Draw (Graphics g, Rectangle targetRect)
		{
			/*
			if (cursor == null && std_cursor != (StdCursor) (-1)) 
				cursor = XplatUI.DefineStdCursorBitmap (std_cursor);

			if (cursor != null) {
				// Size of the targetRect is not considered at all
				g.DrawImage (cursor, targetRect.X, targetRect.Y);
			}
			*/
		}

Usage Example

Example #1
0
    public byte[] GetDesktop_ResizedBytes(int w, int h)
    {
        Size     DesktopBitmapSize = GetDesktopBitmapSize();
        Graphics Graphic           = Graphics.FromHwnd(GetDesktopWindow());
        Bitmap   MemImage          = new Bitmap(DesktopBitmapSize.Width, DesktopBitmapSize.Height, Graphic);

        Graphics MemGraphic = Graphics.FromImage(MemImage);
        IntPtr   dc1        = Graphic.GetHdc();
        IntPtr   dc2        = MemGraphic.GetHdc();

        BitBlt(dc2, 0, 0, DesktopBitmapSize.Width, DesktopBitmapSize.Height, dc1, 0, 0, SRCCOPY);
        Graphic.ReleaseHdc(dc1);
        MemGraphic.ReleaseHdc(dc2);
        Graphic.Dispose();
        MemGraphic.Dispose();

        Graphics g = System.Drawing.Graphics.FromImage(MemImage);

        System.Windows.Forms.Cursor cur = System.Windows.Forms.Cursors.Arrow;
        cur.Draw(g, new Rectangle(System.Windows.Forms.Cursor.Position.X - 10, System.Windows.Forms.Cursor.Position.Y - 10, cur.Size.Width, cur.Size.Height));

        Image        img = Get_Resized_Image(w, h, MemImage);
        MemoryStream ms  = new MemoryStream();

        img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
        return(ms.GetBuffer());
    }
All Usage Examples Of System.Windows.Forms.Cursor::Draw