Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Drawing objects on a form
Message
De
11/07/2001 14:50:35
 
 
À
04/07/2001 04:49:39
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00526033
Message ID:
00529352
Vues:
14
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform