Really daft question from a newbie...

  • Thread starter Thread starter Rich
  • Start date Start date
R

Rich

Can anyone tell me how to draw a rectangle on a windows form? I've tried
the help but can't find this any info at all!

Thanks
Rich
 
* "Rich said:
Can anyone tell me how to draw a rectangle on a windows form? I've tried
the help but can't find this any info at all!

\\\
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
e.Graphics.DrawRectangle(Pens.Red, New Rectangle(10, 10, 100, 100))
End Sub
///
 
Hi Herfried,

You are right I never answer this because Ken does that far before me or
almost in the same time. However I ddi not see him today and therefore I
start searching and than I saw this page and thought what nice. I went to
the second page what I found nicer, however when you do that on msdn it does
not take the URL. (I saw the class code to draw a rectangle, that I know and
did not see it was not VB)

Thank you for making me attent on it.
(I get no Jscript error)

Cor
 
Cor,

* "Cor Ligthert said:
You are right I never answer this because Ken does that far before me or
almost in the same time. However I ddi not see him today and therefore I
start searching and than I saw this page and thought what nice. I went to
the second page what I found nicer, however when you do that on msdn it does
not take the URL. (I saw the class code to draw a rectangle, that I know and
did not see it was not VB)

OK, I only wanted to mention it :-).
Thank you for making me attent on it.
(I get no Jscript error)

I don't get any script exception. When opening the page, MSIE hangs and
I have to shut it down.
 
Useful example Herfried. In the one app where I wanted one I cheated by
using another control (can't remember which one) which comes supplied with a
box.

Any idea why standard graphics type stuff doesn't appear in the standard
designer within VS? Seems a bit of a hole.
 
* "Rob Oldfield said:
Useful example Herfried. In the one app where I wanted one I cheated by
using another control (can't remember which one) which comes supplied with a
box.

Any idea why standard graphics type stuff doesn't appear in the standard
designer within VS? Seems a bit of a hole.

I am not sure if I understand what you are referring too. Would you
expect design-time shape and line controls like in VB6 or would you
expect the stuff in the 'OnPaint' method to be drawn when editing the
form in the designer? You can archieve the latter by deriving a class
from the form which draws the rectangle. The form designer will
instantiate the base class which will execute drawing code.
 
* "Rob Oldfield said:
Just for reference, IE6 SP1 does the same for me, but works works in Mozilla
1.5

I finally used Mozilla FireFox to open the webpage and it worked too.
 
Can't comment on 'like VB6' as I've never used it, but I did expect to find
a 'Draw Rectangle' tool on the standard toolbar.
 
Herfried K. Wagner said:
url=/library/en-us/gdicpp/GDIPlus/aboutGDIPlus/linescurvesandshapes/
overviewofvectorgraphics.asp

JFYI:

1. MSIE6 SP1 crashes when opening the page.

no problem here (also ie6/sp1)
 
Hi Rob,
Can't comment on 'like VB6' as I've never used it, but I did expect to find
a 'Draw Rectangle' tool on the standard toolbar.

No this methods are much nicer, did you look in the resource kit for GDI+.
Tjere are a lot of samples, I do not send now the link because I thought you
had it already. Especially the clocksampe is very fine, however all others
GDI+ samples too

Cor
 
Back
Top