AVAX-software.com Forums: Resizing Drawing Area - AVAX-software.com Forums

Jump to content

Page 1 of 1

Resizing Drawing Area

#1 User is offline   MichaelBaker Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 27-October 08

Posted 05 November 2008 - 03:35 PM

Hi Gardos,

What I am attempting (and failing) to do seems simple, but I cannot figure it out.

I have an Avax drawing window with a width of 2500. I want to change the width to 5000, and move objects to their correct locations.

For example, I have a horizontal line that draws from the left edge of the drawing area to the middle (1250) originally. I want this line to now draw from the left edge to the new middle (2500).

I have tried various commands to do this, but have not gotten consistent behaviour (likely because of my code). I've attached before and after screen shots of my drawing area.

Any assistance would be appreciated.

Regards,
Bill Hojecki

Attached thumbnail(s)

  • Attached Image
  • Attached Image


#2 User is offline   Athanasios Gardos Icon

  • Administrator
  • Icon
  • Group: Admin
  • Posts: 333
  • Joined: 21-March 05
  • Gender:Male

Posted 06 November 2008 - 11:40 AM

Can you please send a screenshot of how would like to be the final image?
Athanasios Gardos
Avax-Software.com

#3 User is offline   MichaelBaker Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 27-October 08

Posted 06 November 2008 - 04:55 PM

I didn't refine the image as much as I would normally, but you can see what I'm trying to do.

I want to keep the text size the same, but essentially re-center the lines we are drawing in code. You can ignore the buttons and text box. Those are for my own debugging of other code.

Thanks,

Attached thumbnail(s)

  • Attached Image


#4 User is offline   Athanasios Gardos Icon

  • Administrator
  • Icon
  • Group: Admin
  • Posts: 333
  • Joined: 21-March 05
  • Gender:Male

Posted 06 November 2008 - 09:02 PM

It is an interesting problem. I will see it.
Athanasios Gardos
Avax-Software.com

#5 User is offline   Athanasios Gardos Icon

  • Administrator
  • Icon
  • Group: Admin
  • Posts: 333
  • Joined: 21-March 05
  • Gender:Male

Posted 10 November 2008 - 01:55 PM

You can do something like this:
Option Explicit

Dim hLine1 As Long
Dim hLine2 As Long

Private Sub Command1_Click()
    cAvax1.Move 0, 0, cAvax1.Width * 1.2, cAvax1.Height * 1.2
    Call RedrawAvax
End Sub

Private Sub RedrawAvax()
    Dim h() As Long
    Dim xMin As Single, yMin As Single, zMin As Single
    Dim xMax As Single, yMax As Single, zMax As Single
    Dim iType() As AvaxItemType, vProp() As Variant, vData() As Variant
    Dim xyz() As Single
    If cAvax1.GetBoundsAvax(xMin, yMin, zMin, xMax, yMax, zMax) = True Then
       If cAvax1.GetHandlesByKey("Line1", h()) <> 0 Then
          If cAvax1.GetProperties(h(), iType(), vProp(), vData()) = True Then
             If iType(1) = Line_i Then
                xyz() = vData(1)
                xyz(1) = xMin
                xyz(2) = yMin + (yMax - yMin) / 2
                xyz(4) = xMax
                xyz(5) = xyz(2)
                vData(1) = xyz()
                Call cAvax1.SetProperties(h(), iType(), vProp(), vData())
             End If
          End If
       End If
       If cAvax1.GetHandlesByKey("Line2", h()) <> 0 Then
          If cAvax1.GetProperties(h(), iType(), vProp(), vData()) = True Then
             If iType(1) = Line_i Then
                xyz() = vData(1)
                xyz(1) = xMin + (xMax - xMin) / 2
                xyz(2) = yMin
                xyz(4) = xyz(1)
                xyz(5) = yMax
                vData(1) = xyz()
                Call cAvax1.SetProperties(h(), iType(), vProp(), vData())
             End If
          End If
       End If
    End If
End Sub

Private Sub Form_Load()
    Command1.Caption = "Resize avax * 1.2"
    Call cAvax1.StartAvax
    hLine1 = cAvax1.Add_Line(0, 0, 0, 10, 10, 0)
    Call cAvax1.SetHandleKey(hLine1, "Line1")
    hLine2 = cAvax1.Add_Line(0, 10, 0, 10, 0, 0)
    Call cAvax1.SetHandleKey(hLine2, "Line2")
    Call RedrawAvax
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Call cAvax1.EndAvax
End Sub

Athanasios Gardos
Avax-Software.com

Page 1 of 1


Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users