Komentáře jsou sice v AJ, ale naprosto srozumitelné:
C#
//Tyto atributy zde nemusi byt, funguje to stejne dobre i bez nich
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.LinkDemand, Flags = System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)]
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
// Get handle to device context.
IntPtr hdc = e.Graphics.GetHdc();
// Create new graphics object using handle to device context.
Graphics newGraphics = Graphics.FromHdc(hdc);
// Draw rectangle to screen.
newGraphics.DrawRectangle(new Pen(Color.Red, 3), 0, 0, 200, 100);
// Release handle to device context and dispose of the Graphics object
e.Graphics.ReleaseHdc(hdc);
newGraphics.Dispose();
}Snad si někdy udělám čas a tento článek rozšířím aby vás naučil jak dělat výřezy obrazovky s pohledem na to co vyřezáváte.