Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Drawing objects on a form
Message
From
11/07/2001 14:50:35
 
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00526033
Message ID:
00529352
Views:
12
Neil,

Thanks for the info. I researched and was able to find something similar to what you've suggested here but there is a Form.CreateGraphics that actually works the best for what I need.

>Dan,
>
>Forms are derived from lots of classes, one being Control. The Control class inherits a property called Handle from Control, this is the HWND for the form and can be used for whatever purpose.
>
>The easiest way to use the Graphics class is to respond to override the OnPaint handler (the same as handling the WM_PAINT message). The PaintEventArgs parameter is an object containing two properties, Graphics and ClipRectangle which can then be used something like this.
>
>using System;
>using System.WinForms;
>using System.Drawing;
>
>public class SampleForm : Form
>{
>   public SampleForm()
>   {
>      // Update the title bar.
>      Text = "Drawing Demo";
>   }
>
>   protected override void OnPaint(PaintEventArgs e)
>   {
>      e.Graphics.DrawString("Sample Text", Font, new SolidBrush(Color.Black), ClientRectangle);
>   }
>
>   public static void Main(string[] args)
>   {
>      Application.Run(new SampleForm());
>   }
>}
>
>HTH
>Neil
Previous
Reply
Map
View

Click here to load this message in the networking platform