Results 1 to 6 of 6

Thread: picturebox should work in 1st quadrant

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Location
    Mumbai
    Posts
    206

    picturebox should work in 1st quadrant

    Hii


    How can an image be drawn & played in first quadrant of the picture box in vb6


    since the left top of picturebox is 0

    what i wnat is left bottom to be 0

    I.e leftmin =0
    bottomin=0
    topmin=maxheight valve of picturebox
    topmax=0
    rightmin=0
    rightmax=max width of picturebox

    how can i do this & play with it

    pls help me

  2. #2
    Addicted Member cheesebrother's Avatar
    Join Date
    Jul 2011
    Posts
    153

    Re: picturebox should work in 1st quadrant

    You can change the whole thing by doing this:

    Code:
    Private Sub Form_Load()
      Picture1.ScaleTop = Picture1.ScaleHeight
      Picture1.ScaleWidth = Picture1.ScaleWidth
      Picture1.ScaleHeight = -Picture1.ScaleHeight
    End Sub
    You just need to make a picture box on a form for that to work. You can test to see if it works by putting this in:


    Code:
    Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
      Cls
      Print X, Y
    End Sub
    Now you will see that 0,0 is the bottom left and that when you go up, so will the Y value.
    Hooked for good.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Location
    Mumbai
    Posts
    206

    Re: picturebox should work in 1st quadrant

    Cheesebrother


    Thanks for your prompt reply

    I ve tested it in sample test it works

    but i will make it in used in my project & i fproblem occur i will get back to u

    thanks once again

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Location
    Mumbai
    Posts
    206

    Re: picturebox should work in 1st quadrant

    Cheesebrother


    Thanks for your prompt reply

    I ve tested it in sample test it works

    but i will make it in used in my project & if problem occur i will get back to u

    thanks once again

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Location
    Mumbai
    Posts
    206

    Re: picturebox should work in 1st quadrant

    Cheesebrother

    when a file image i.e dxf image is uploaded in picture box then can the image points(0,0) coincide with the points(0,0) on picture box & when the image is zoom in zoom out the uploaede image on picturebox remain in first quadrant

    How can this be done

    I have put hte above line in form load
    but when i load the image it showz x,y in -ve also

    ARe u getting it pls reply

  6. #6
    Addicted Member cheesebrother's Avatar
    Join Date
    Jul 2011
    Posts
    153

    Re: picturebox should work in 1st quadrant

    So I take it that you want to draw a picture so that the X, Y is the bottom left corner of the picture. I've made a simple function to do so.

    Code:
    Private Sub DrawPicture(Destination As PictureBox, Pic As Picture, X1, Y1)
      Destination.PaintPicture Pic, X1, Y1 - ScaleY(Pic.Height, vbHimetric, Destination.ScaleMode)
    End Sub
    This sub should do the job.

    I'm not sure what you're going to be drawing this way but unless is makes sense in your case this isn't the best way. For drawing graphics, going from top,left corner is the easiest way of doing it and besides that it is the way everything works from vb's simple paintpicture to the bitblt api to directX to windows.
    Last edited by cheesebrother; Nov 23rd, 2011 at 07:03 AM.
    Hooked for good.

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