simple paint similar to MS Paint.. I have qustions!

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2007
Posts: 4
Reputation: Nana.vb is an unknown quantity at this point 
Solved Threads: 0
Nana.vb Nana.vb is offline Offline
Newbie Poster

simple paint similar to MS Paint.. I have qustions!

 
0
  #1
Apr 26th, 2007
Hi,

I work with Microsoft Visual Studio 2005.


I'm about to build a simple paint editor similar to MS Paint program.


of course, it has Edit menu, with Undo, Redo, Cut, Copy, Paste, Delete... etc.


I have a problem with Undo and Redo!

How to do them with drawing?

have I use Stack or something like this?

I'm just a beginner and I have no idea


Another question..

For Cut, Paste, Copy and Delete, I need a selection tool same as the one in MS Paint.
Where can I find it? or how to Cut and Paste with out it?

Please, I really need your help

thanx a lot.
Last edited by Nana.vb; Apr 26th, 2007 at 9:05 am.
Reply With Quote Quick reply to this message  
Join Date: Dec 2002
Posts: 461
Reputation: waynespangler is on a distinguished road 
Solved Threads: 56
waynespangler waynespangler is offline Offline
Posting Pro in Training

Re: simple paint similar to MS Paint.. I have qustions!

 
1
  #2
Apr 27th, 2007
Here is how I did a undo:
  1. Dim UndoStack As New Stack(Of Bitmap)() 'holds the backup images
  2.  
  3. '==========================================================================
  4. ' Saves the picture passed
  5. '==========================================================================
  6. Private Sub PushUndo(ByVal b As Bitmap)
  7. UndoStack.Push(b)
  8. btnUnDo.Visible = True
  9. End Sub
  10.  
  11. '==========================================================================
  12. ' Returns the last picture saved
  13. '==========================================================================
  14. Private Function PopUndo() As Bitmap
  15. If UndoStack.Count = 0 Then
  16. Return Nothing
  17. btnUnDo.Visible = False
  18. Exit Function
  19. End If
  20. If UndoStack.Count = 1 Then btnUnDo.Visible = False
  21. Return UndoStack.Pop
  22. End Function
To save a bitmap:
  1. 'save the current picture for undo
  2. PushUndo(Display.Image.Clone)
To undo:
  1. '==========================================================================
  2. ' pops the last bitmat off the stack and places it in the display
  3. '==========================================================================
  4. Private Sub btnUnDo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUnDo.Click
  5. Dim bmp As Bitmap
  6. bmp = PopUndo()
  7. If bmp IsNot Nothing Then
  8. Display.Image = bmp
  9. End If
  10. End Sub
The second part I am going to have to find. I'll get back at you.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 4
Reputation: Nana.vb is an unknown quantity at this point 
Solved Threads: 0
Nana.vb Nana.vb is offline Offline
Newbie Poster

Re: simple paint similar to MS Paint.. I have qustions!

 
0
  #3
Apr 27th, 2007
waynespangler

thank u soooo mutch ..


I have a good idea now : )


thanks again
Reply With Quote Quick reply to this message  
Join Date: Dec 2002
Posts: 461
Reputation: waynespangler is on a distinguished road 
Solved Threads: 56
waynespangler waynespangler is offline Offline
Posting Pro in Training

Re: simple paint similar to MS Paint.. I have qustions!

 
0
  #4
Apr 27th, 2007
After all this time I finally found my bug in this routine. The undo button would never go off and I couldn't figure out why. Can you see it?
  1. If UndoStack.Count = 0 Then
  2. Return Nothing
  3. btnUnDo.Visible = False
  4. Exit Function
  5. End If
In vb net a return exits the routine immediatlly so in the above btnUnDo.visible=False never got executed and neither did Exit Function. Because it was exiting I figured it was working right. Now I know why not.
It should be:
  1. If UndoStack.Count = 0 Then
  2. btnUnDo.Visible = False
  3. Return Nothing
  4. End If
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,142
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 531
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: simple paint similar to MS Paint.. I have qustions!

 
0
  #5
Apr 27th, 2007
What are you using for the drawing, GDI+ ?
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 4
Reputation: Nana.vb is an unknown quantity at this point 
Solved Threads: 0
Nana.vb Nana.vb is offline Offline
Newbie Poster

Re: simple paint similar to MS Paint.. I have qustions!

 
0
  #6
Apr 27th, 2007
waynespangler..

ohhh .. yes that's right : )


thanx alooot





jbennet..

The drawing tool bar contains:
  • Lines (in different styles : regular, dashed and thick)
  • curves
  • Shapes: rectangle, circle and oval.
  • Pen.
  • Brush ( in different styles- HatchBrush, LinearGradientBrush, PathGradientBrush and TextureBrush)
  • Text.
  • Fill (with color or pattern)
and I drow on picture box


thank u : )
Last edited by Nana.vb; Apr 27th, 2007 at 12:06 pm.
Reply With Quote Quick reply to this message  
Join Date: Dec 2002
Posts: 461
Reputation: waynespangler is on a distinguished road 
Solved Threads: 56
waynespangler waynespangler is offline Offline
Posting Pro in Training

Re: simple paint similar to MS Paint.. I have qustions!

 
0
  #7
Apr 27th, 2007
Here is some samples of cut, copy and paste. They are not as effecient as they should be, so that is up to you. Post if you have any more questions.
Attached Files
File Type: zip Rubberband.zip (642.9 KB, 143 views)
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 4
Reputation: Nana.vb is an unknown quantity at this point 
Solved Threads: 0
Nana.vb Nana.vb is offline Offline
Newbie Poster

Re: simple paint similar to MS Paint.. I have qustions!

 
0
  #8
May 15th, 2007
waynespangler..

thnx alooot : )

I did my project, and it's perfect now

thnx again
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 3
Reputation: WoW7787 is an unknown quantity at this point 
Solved Threads: 0
WoW7787 WoW7787 is offline Offline
Newbie Poster

Re: simple paint similar to MS Paint.. I have qustions!

 
0
  #9
May 18th, 2007
Hi

please i want to ask about this statment

PushUndo(Display.Image.Clone)

Display is't the surface i draw on it??

i use a picture box for drawing and i don't want just the back ground image to be save

what about the drawings like lines,curves...etc??

please i need your healp

see ya
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 3
Reputation: WoW7787 is an unknown quantity at this point 
Solved Threads: 0
WoW7787 WoW7787 is offline Offline
Newbie Poster

Re: simple paint similar to MS Paint.. I have qustions!

 
0
  #10
May 18th, 2007
plz Nana can you help me ??

i've similar assignment and i need a little help

I'm just a beginner
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC