Results 1 to 7 of 7

Thread: clearing a picture box area

  1. #1

    Thread Starter
    Addicted Member chander's Avatar
    Join Date
    Nov 2000
    Location
    New Delhi , India
    Posts
    225

    clearing a picture box area

    is there any API / method to clear a particular area of a picture box .. I have the start and end co-ordinate and i want to clear that particular area of a picture . i think some API like sendmessage can do it by taking pictrue box handle.Write now i m using another pic box and placing it above that area to clear that area but it is causing some problem for other operation ..
    is there any way to do it by coding ??

    thanks in advance ..
    Chander
    Email:[email protected]

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    I'm not sure that you would necessarily need to use an API call. I think using the Pictures build in Line property and its Backcolor might do the trick for you.

  3. #3

    Thread Starter
    Addicted Member chander's Avatar
    Join Date
    Nov 2000
    Location
    New Delhi , India
    Posts
    225
    ya i got .. i think showing a fill rectangle will do ..
    Chander
    Email:[email protected]

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    When you get it all worked out, why don't you post the code your wrote here. It might help someone else.

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    But, Picture1.Cls would clear everything. I think chander only wants to clear a certain portion of the Picture box. Is that correct, chander, or no?

  6. #6
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    Hi Hack
    The qtn was posted twice and already answered in the General forum.
    VB Code:
    1. Private Sub Command1_Click()
    2.     'x1,y1 to x2, y2, req'd colour, B for box and F for fill
    3.     Picture1.Line (0, 0)-(500, 500), Picture1.BackColor, BF
    4. End Sub

    http://www.vbforums.com/showthread.p...hreadid=132356
    Regards
    Stuart
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

  7. #7

    Thread Starter
    Addicted Member chander's Avatar
    Join Date
    Nov 2000
    Location
    New Delhi , India
    Posts
    225
    ya hack its right i asked for clearing a portion only and it is best with rectangle . The code is same as beachbum wrote just instead of x,y and x1,y1 u can give ur own co-ordinates . My code use a Shape rectangle and when mouse is up its co-ordinates are trapped and rectable is made by same code as beachbum wrote.

    In mouse down of pic

    tX = x
    tY = y

    in mouse up

    picMain.Line (tX, tY)-(tX + w, tY + h), ForeCol, B

    where w and h are width and height calculated from size of rectangle and it forms the ending co-ordinates . thats it .. or u can take x1,y1 in mouse up and draw . Use forecolor and fill color white so that portion can be seen as clear.
    Chander
    Email:[email protected]

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