Results 1 to 6 of 6

Thread: Question about Paint based application

  1. #1

    Thread Starter
    Member fly_dragoon's Avatar
    Join Date
    Oct 2001
    Location
    Canada
    Posts
    47

    Question 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!!!)

  2. #2

    Thread Starter
    Member fly_dragoon's Avatar
    Join Date
    Oct 2001
    Location
    Canada
    Posts
    47

    Unhappy 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!!!)

  3. #3
    Red Rush-In
    Guest
    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.

  4. #4

    Thread Starter
    Member fly_dragoon's Avatar
    Join Date
    Oct 2001
    Location
    Canada
    Posts
    47

    Talking 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!!!)

  5. #5
    Lively Member
    Join Date
    Aug 1999
    Posts
    89
    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 LongByVal X As LongByVal Y As LongByVal 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

  6. #6

    Thread Starter
    Member fly_dragoon's Avatar
    Join Date
    Oct 2001
    Location
    Canada
    Posts
    47

    Thumbs up

    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
  •  



Click Here to Expand Forum to Full Width