4 Replies - 6632 Views - Last Post: 23 November 2010 - 12:30 PM Rate Topic: -----

#1 onlinespec  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 23-November 10

Drawing On A PictureBox

Posted 23 November 2010 - 04:33 AM

Please can someone help me on a code to draw Circle,regtangle on a picturebox. and the item drawn should not clear when i minimize the form
Is This A Good Question/Topic? 0
  • +

Replies To: Drawing On A PictureBox

#2 Luc001  Icon User is offline

  • D.I.C Addict

Reputation: 84
  • View blog
  • Posts: 617
  • Joined: 04-May 09

Re: Drawing On A PictureBox

Posted 23 November 2010 - 05:38 AM

Hi,

You can find some examples here.

And here.
Was This Post Helpful? 1
  • +
  • -

#3 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1057
  • View blog
  • Posts: 4,090
  • Joined: 02-July 08

Re: Drawing On A PictureBox

Posted 23 November 2010 - 07:11 AM

Those are good examples and there are many out there - especially if you name the object you want to use in your search. As for keeping the things you draw, you must provide a collection of that and iterate it in the paint event. I use custom objects and a List(Of <thatobject>) for this purpose. The pain event wipes the slate clean every time it is called - why you see the lines disappear with minimaize(causes the paint event to fire).
Was This Post Helpful? 0
  • +
  • -

#4 onlinespec  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 23-November 10

Re: Drawing On A PictureBox

Posted 23 November 2010 - 11:38 AM

Thanks For The Posting Brothers. I dont want to draw automatically from within code, I want to use my mouse events and draw the shapes as if am picking a button from toolbox and drawing it on the form
Was This Post Helpful? 0
  • +
  • -

#5 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1057
  • View blog
  • Posts: 4,090
  • Joined: 02-July 08

Re: Drawing On A PictureBox

Posted 23 November 2010 - 12:30 PM

View Postonlinespec, on 23 November 2010 - 05:33 AM, said:

...and the item drawn should not clear when i minimize the form


So if you want to only draw them in the mouseevents they will not persist. A variable or collection is the only way to make it persist and this occurs when we repaint(refresh/invalidate the region/control). If you only need 1 object then a variable will do, you can make a boolean for when to show or hide it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1