468,140 Members | 1,626 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,140 developers. It's quick & easy.

Windows Forms problem.. Drawing...

I am designing a program in which the user will be drawing, lines,
circules and so on, on a paint control which displays an image opened
by the user. "It's like there is a map on the picturebox control and
the user draws some raads on the map."

I am using System::Drawing::Graphics class, first I assign the handle
of the picbox where the user wil draw:

graphicsSurface = System::Drawing::Graphics::FromHwnd(
picBox->Handle );

then, I create a pen and let the user draw,

[i:8c28ff0179]System::Drawing::Pen * redPen;
redPen = new Pen(Color::Red, 3); graphicsSurface->DrawRectangle(
redPen,x1,y1,w,h);[/i:8c28ff0179]

I also draw some other lines and ellipses. Now my problem is, when I
resize the window or when a window overlaps with the print area my
drawings are ereased! In MFC I would handle this in onPaint event,
what shell I do in winforms ? Also Is there a way to save what the
user has drawn as an image, to load later? but I do not want to
modify the image I just want to save what user has drawn.

and a second question is, what is this error ??

[i:8c28ff0179]error C3160: 'startPoint' : cannot declare interior __gc
pointer or reference as a member of
'denemeNet01::Form1'[/i:8c28ff0179]

it happens when I decleare a Point as,

[i:8c28ff0179]System::Drawing::Point * startPoint;[/i:8c28ff0179]

but when I do,

[i:8c28ff0179]System::Drawing::Point __nogc *
startPoint;[/i:8c28ff0179]

The problem is solved, I just found this by trying but what is the
reason for this? Why CAN I decleare a pen like this,

[i:8c28ff0179]System::Drawing::Pen * drawingPen;[/i:8c28ff0179]

but can't decleare a Point like that ???

Thanks in advance,

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 17 '05 #1
0 1083

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Ayende Rahien | last post: by
5 posts views Thread by david | last post: by
reply views Thread by Scott Davies | last post: by
4 posts views Thread by Rod Gill | last post: by
4 posts views Thread by tshad | last post: by
21 posts views Thread by Dan Tallent | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.