[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

patrick

11/24/2004 3:39:00 AM

Hi Ng,

i want to draw a grid on a panel and I tried out this here, but it didn't
work out (I definded this in the constructor of the panel):

this.SetStyle(ControlStyles.UserPaint, true);
ControlPaint.DrawGrid(System.Drawing.Graphics.FromHwnd(this.Handle),
this.ClientRectangle, new Size(8, 8), Color.Red);

Do you know why? Where do I have to use the ControlPaint.DrawGrid()

Thanks in advance and regards,
Patrick
1 Answer

Bob Powell

11/24/2004 8:56:00 AM

0

On the OnPaintBackground protected override.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tips...

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/f...

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"Patrick" <Patrick@discussions.microsoft.com> wrote in message
news:DFF90DC8-45E5-4654-B7DD-4AB494D3BF7E@microsoft.com...
> Hi Ng,
>
> i want to draw a grid on a panel and I tried out this here, but it didn't
> work out (I definded this in the constructor of the panel):
>
> this.SetStyle(ControlStyles.UserPaint, true);
> ControlPaint.DrawGrid(System.Drawing.Graphics.FromHwnd(this.Handle),
> this.ClientRectangle, new Size(8, 8), Color.Red);
>
> Do you know why? Where do I have to use the ControlPaint.DrawGrid()
>
> Thanks in advance and regards,
> Patrick