Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
TitleSet the drawing origin in a PictureBox
Keywordsorigin, drawing, ScaleMode
CategoriesGraphics
 
Set ScaleHeight to -ScaleHeight to make the Y coordinates increase from bottom to top. Then set ScaleLeft and ScaleTop to position the origin where you want it. This example places the origin 1440 twips in and upp from the lower left corner. Change the values of X0 and Y0 to put the origin someplace else.
 
Private Sub picCanvas_Resize()
Const X0 = 1440
Const Y0 = 1440

    picCanvas.Cls

    ' Set scale mode to twips.
    picCanvas.ScaleMode = vbTwips

    ' Set ScaleHeight to make Y increase upwards.
    picCanvas.ScaleHeight = -picCanvas.ScaleHeight

    ' Make the origin 1 inch (1440 twips)
    ' from the lower left corner.
    picCanvas.ScaleLeft = -X0
    picCanvas.ScaleTop = -picCanvas.ScaleHeight - Y0

    ' Draw a box at the origin.
    picCanvas.Line (0, 0)-Step(360, 360), , BF

    ' Draw a diamond centered at the origin.,
    picCanvas.Line (-720, 0)-Step(720, 720)
    picCanvas.Line -Step(720, -720)
    picCanvas.Line -Step(-720, -720)
    picCanvas.Line -Step(-720, 720)
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated