|
-
Dec 24th, 2001, 12:30 PM
#1
Thread Starter
Member
Question about Paint based application
You see everyone I'm stuck with a problem:
I've made a program like Paint with many more thing but my problem is that I dont know how to make an eraser to erase the
drawing made on the picturebox!
I've tried to make the autoredraw value of the picturebox to false
and (as an eraser) make a shape that follow the cursor so that the shape could erase the drawing BUT it do many inconvenient!
Does anyone know how to do this?
Waiting in the shadow...learning and learning....perfectionning my programming skill....I'll see the fall of Bill Gates....and soon enought....HE WILL SEE MY RISING AND I WILL BE HIS BOSS.....and I will RULE THE WORLD!!! MUHAHAHA........(sorry sometime it happen to me.... if it happen again, don't mind me!!!)
-
Dec 26th, 2001, 06:29 AM
#2
Thread Starter
Member
Please
Does anyone with little knowledge of making a drawing application can help me?
Waiting in the shadow...learning and learning....perfectionning my programming skill....I'll see the fall of Bill Gates....and soon enought....HE WILL SEE MY RISING AND I WILL BE HIS BOSS.....and I will RULE THE WORLD!!! MUHAHAHA........(sorry sometime it happen to me.... if it happen again, don't mind me!!!)
-
Dec 26th, 2001, 12:45 PM
#3
Ok, maybe I'm making this too simple... Are you allowing the user to select a fore color and a back color like MS Paint does? All you have to do if they select the eraser is draw the back color instead of the fore color. Thats the best I could come up with given the information you provided.
-
Dec 26th, 2001, 01:04 PM
#4
Thread Starter
Member
Yeah that sound very simple!
But do you think Paint really work like that?
and if it is the only way, how do I do a square shaped eraser?
(because with Pset it draw a round point)
Waiting in the shadow...learning and learning....perfectionning my programming skill....I'll see the fall of Bill Gates....and soon enought....HE WILL SEE MY RISING AND I WILL BE HIS BOSS.....and I will RULE THE WORLD!!! MUHAHAHA........(sorry sometime it happen to me.... if it happen again, don't mind me!!!)
-
Dec 26th, 2001, 10:20 PM
#5
Lively Member
Hi
You can use the API SetPixel which I believe is faster than PSET
its defined as:
PHP Code:
Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
so an example of using it would be SetPixel(picture1.hdc, x, y, RGB(192, 192, 192))
To make a square eraser, what I would do would be to. Get the x and y cordinates of your mouse, and then use that for cordinates of a box, it would be a good idea to make a box cursor icon like Paint does. an example:
Code:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
for x = 1 to x + ERASER_WIDTH
for y = 1 to y + ERASER_HEIGHT
call SetPixel(picture1.hdc, x, y, RGB(192, 0, 192)) ' light gray
next y
next x
End Sub
you would use gray or whatever color the background color is currently selected, and eraser width, and height would be how big of an area you would want to delete
-
Dec 27th, 2001, 12:31 AM
#6
Thread Starter
Member
That's exactly what I wanted to know!
thank's Allanon
Waiting in the shadow...learning and learning....perfectionning my programming skill....I'll see the fall of Bill Gates....and soon enought....HE WILL SEE MY RISING AND I WILL BE HIS BOSS.....and I will RULE THE WORLD!!! MUHAHAHA........(sorry sometime it happen to me.... if it happen again, don't mind me!!!)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|