auto zooming the drawing result

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • agpkd2001
    New Member
    • Feb 2008
    • 2

    auto zooming the drawing result

    Hi

    I wrote a program in VB and after runnig ,it draw a shape ,now i wonder to know how i can zoom this drawing because sometimes it become very tiny and i can not see it ,so is there any way to define auto zoom for my drawing resualt?

    Regards

    Ali
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Where are you drawing the shape ?

    I mean which control ? And what version of VB you are using ?

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Yes, the answer would depend on how/where you are drawing the image, and in what version of VB.

      For instance, in VB6, if the image is in a picturebox (with AutoRedraw turned on), it might be as simple as copying it to an image control with the Stretch property turned on.

      Comment

      • agpkd2001
        New Member
        • Feb 2008
        • 2

        #4
        Hi

        Thank you for considering me,actually,i wrote my code in VB 2008 as follows:

        [CODE=vbnet]Private Sub Form4_Paint(ByV al sender As Object, ByVal e As System.Windows. Forms.PaintEven tArgs) Handles Me.Paint
        Dim ElemNo As Integer
        Dim a As Integer
        ElemNo = Form3.TB_Elemen tDataGridView.R owCount - 1
        Dim ElemID(ElemNo - 1) As Integer
        Dim ElNode1(ElemNo - 1) As Integer
        Dim ElNode2(ElemNo - 1) As Integer
        Dim ElArea(ElemNo - 1) As Decimal
        Dim MatID(ElemNo - 1) As Integer
        For a = 0 To ElemNo - 1
        ElemID(a) = a + 1
        ElNode1(a) = Form3.TB_Elemen tDataGridView.R ows(a).Cells(1) .Value
        ElNode2(a) = Form3.TB_Elemen tDataGridView.R ows(a).Cells(2) .Value
        ElArea(a) = Form3.TB_Elemen tDataGridView.R ows(a).Cells(3) .Value
        MatID(a) = Form3.TB_Elemen tDataGridView.R ows(a).Cells(4) .Value
        ' MessageBox.Show ("ElemID( " & (a + 1) & ")=" & ElemID(a))
        'MessageBox.Sho w("ElNode1( " & (a + 1) & ")=" & ElNode1(a))
        'MessageBox.Sho w("ElNode2( " & (a + 1) & ")=" & ElNode2(a))
        'MessageBox.Sho w("ElArea( " & (a + 1) & ")=" & ElArea(a))
        'MessageBox.Sho w("MatID( " & (a + 1) & ")=" & MatID(a))
        Next










        '"Starting Calculation"




        Dim Nodeno As Integer
        Nodeno = Form1.TB_NodeDa taGridView.RowC ount - 1
        Dim Xcoordinate(Nod eno - 1) As Decimal
        Dim Ycoordinate(Nod eno - 1) As Decimal


        For a = 0 To Nodeno - 1
        Xcoordinate(a) = Form1.TB_NodeDa taGridView.Rows (a).Cells(1).Va lue
        Ycoordinate(a) = Form1.TB_NodeDa taGridView.Rows (a).Cells(2).Va lue
        Next


        Dim redpen As New Pen(Color.Blue, 10)
        For a = 0 To ElemNo - 1

        Me.CreateGraphi cs.DrawLine(Pen s.Red, Xcoordinate(ElN ode1(a) - 1), -Ycoordinate(ElN ode1(a) - 1), Xcoordinate(ElN ode2(a) - 1), Ycoordinate(ElN ode2(a) - 1))
        Me.CreateGraphi cs.TranslateTra nsform(200, 250)
        'MessageBox.Sho w(L(a))

        Next
        End Sub[/CODE]

        Regards,

        Ali
        Last edited by Killer42; Feb 28 '08, 02:26 AM. Reason: Added CODE=vbnet tag

        Comment

        • daniel aristidou
          Contributor
          • Aug 2007
          • 494

          #5
          Hmmmmm.....vb20 08 (my favorite so far)

          Well .... you could try instead using:
          Use a print previeiw dialog box
          Create the graphic on print-document control
          open the print dialog box and then zoom on that.....


          However i'm certain there is a better way of doing it and i'll get back after some research

          Comment

          Working...