Valhalla Legends Forums Archive | General Programming | Resizing Form

AuthorMessageTime
WiLD
Ok i didnt know where to post this but im posting it here!
Im having a little trouble with a form. i want it so when you resize it everything else adjusts to the new size so you can see all the extra black stuff.
Thank you in advance.
October 15, 2003, 10:23 AM
Grok
I've posted resize code for a form. Search the forum and search bnetdocs.
October 15, 2003, 11:56 AM
WiLD
ok, iv tried searching but it only comes up with this topic, if you could provide a link and copy and paste the code it would be greatly appreciated.
October 16, 2003, 11:37 PM
St0rm.iD
Basically, you want to pull out your algebra hat.

Make a ratio of the old size to the new size and adjust your coords/sizes accordingly.
October 17, 2003, 12:23 AM
Grok
[quote author=WiLD link=board=5;threadid=3098;start=0#msg24399 date=1066347459]
ok, iv tried searching but it only comes up with this topic, if you could provide a link and copy and paste the code it would be greatly appreciated.
[/quote]

Click Advanced Search, put "Form_Resize" as the phrase to search for, and change the number of days to 800. You'll find enough useful code to ignore for a month. Especially the resize stuff from st0rm.
October 17, 2003, 12:57 AM
Seven
[quote author=St0rm.iD link=board=5;threadid=3098;start=0#msg24404 date=1066350194]
Basically, you want to pull out your algebra hat.

Make a ratio of the old size to the new size and adjust your coords/sizes accordingly.
[/quote]

As he said, just calculate the subtraction (in my case) to however many objects you have. Yes, Form_Resize can be a bitch, but once you get a few objects down to resizing, the rest is a peice of cake
October 18, 2003, 10:43 AM
iago
If you make everything a control array it's easy!
October 18, 2003, 12:38 PM
UserLoser
[quote author=Grok link=board=5;threadid=3098;start=0#msg24239 date=1066219003]
I've posted resize code for a form. Search the forum and search bnetdocs.
[/quote]

AFAIK BnetDocs doesnt have anything on resizing
October 18, 2003, 1:44 PM
St0rm.iD
[quote author=iago link=board=5;threadid=3098;start=0#msg24502 date=1066480715]
If you make everything a control array it's easy!
[/quote]

Form.controls iirc
October 20, 2003, 12:53 AM
Adron
Was the language specified yet?
October 20, 2003, 10:49 AM
iago
[quote author=Adron link=board=5;threadid=3098;start=0#msg24719 date=1066646952]
Was the language specified yet?
[/quote]

Nope!
October 20, 2003, 1:07 PM
hismajesty
[quote author=Adron link=board=5;threadid=3098;start=0#msg24719 date=1066646952]
Was the language specified yet?
[/quote]

No, but it is VB.
October 20, 2003, 7:29 PM
Adron
[quote author=hismajesty link=board=5;threadid=3098;start=0#msg24750 date=1066678143]

No, but it is VB.
[/quote]

Why do you say that?
October 20, 2003, 7:34 PM
St0rm.iD
omfg omfg wrong forum flame flame flame
October 20, 2003, 11:43 PM
hismajesty
[quote author=Adron link=board=5;threadid=3098;start=0#msg24755 date=1066678462]
[quote author=hismajesty link=board=5;threadid=3098;start=0#msg24750 date=1066678143]

No, but it is VB.
[/quote]

Why do you say that?
[/quote]

Well, I assumed it is VB because every other post he has posted here has been about VB. ;)
October 21, 2003, 12:27 AM
Adron
Ah, OK. Well, forms exist in many languages, and it seems for example VB.NET has much better features for looping through all controls on a form to resize them.
October 21, 2003, 8:34 AM
Fr0z3N
[code]
Public Function ResizeAll(FormName As Form)
Dim tmpControl As Control
On Error Resume Next
'Ignores errors in case the control does
' n't
'have a width, height, etc.


If PrevResizeX = 0 Then
'If the previous form width was 0
'Which means that this function wasn't r
' un before
'then change prevresizex and y and exit


' function
PrevResizeX = FormName.ScaleWidth
PrevResizeY = FormName.ScaleHeight
Exit Function
End If


For Each tmpControl In FormName
'A loop to make tmpControl equal to ever
' y
'control on the form


If TypeOf tmpControl Is Line Then
'Checks the type of control, if its a
'Line, change its X1, X2, Y1, Y2 values
tmpControl.X1 = tmpControl.X1 / PrevResizeX * FormName.ScaleWidth
tmpControl.X2 = tmpControl.X2 / PrevResizeX * FormName.ScaleWidth
tmpControl.Y1 = tmpControl.Y1 / PrevResizeY * FormName.ScaleHeight
tmpControl.Y2 = tmpControl.Y2 / PrevResizeY * FormName.ScaleHeight
'These four lines see the previous ratio
'
'Of the control to the form, and change
' they're
'current ratios to the same thing
Else
'Changes everything elses left, top
'Width, and height
tmpControl.Left = tmpControl.Left / PrevResizeX * FormName.ScaleWidth
tmpControl.Top = tmpControl.Top / PrevResizeY * FormName.ScaleHeight
tmpControl.Width = tmpControl.Width / PrevResizeX * FormName.ScaleWidth
tmpControl.Height = tmpControl.Height / PrevResizeY * FormName.ScaleHeight
'These four lines see the previous ratio
'
'Of the control to the form, and change
' they're
'current ratios to the same thing
End If
Next tmpControl
PrevResizeX = FormName.ScaleWidth
PrevResizeY = FormName.ScaleHeight
'Changes prevresize x and y to current w
' idth
'and height
End Function
[/code]

[code]
Private Sub Form_Resize()
If WindowState = vbMinimized Then Exit Sub
ResizeAll Me
End Sub
[/code]
October 21, 2003, 11:51 AM
Archonist
[code]Private Sub Form_Resize()
Chat.Width = Me.ScaleWidth - lvUsers.Width
Chat.Height = Me.ScaleHeight - txtSend.Height
lvUsers.Height = Me.ScaleHeight - lChan.Height - txtSend.Height
lChan.Left = Chat.Width
lvUsers.Left = Chat.Width
txtSend.Top = Chat.Height
txtSend.Width = Me.ScaleWidth
End Sub[/code]

It works perfectly for my needs.
November 6, 2003, 1:00 AM
kamakazie
[quote author=Archonist link=board=5;threadid=3098;start=15#msg27625 date=1068080438]
[code]Private Sub Form_Resize()
Chat.Width = Me.ScaleWidth - lvUsers.Width
Chat.Height = Me.ScaleHeight - txtSend.Height
lvUsers.Height = Me.ScaleHeight - lChan.Height - txtSend.Height
lChan.Left = Chat.Width
lvUsers.Left = Chat.Width
txtSend.Top = Chat.Height
txtSend.Width = Me.ScaleWidth
End Sub[/code]

It works perfectly for my needs.
[/quote]


What about when you resize the form really small? Negative values? Also, it's better to use the Move() property of controls.
November 6, 2003, 6:02 PM
Fr0z3N
Therefor

Mine > Archon's
November 6, 2003, 8:18 PM
kamakazie
[quote author=Fr0z3N link=board=5;threadid=3098;start=15#msg27773 date=1068149921]
Therefor

Mine > Archon's
[/quote]

Except that you don't use the Move() property.
November 6, 2003, 9:20 PM
St0rm.iD
Except that Move() isn't a VB property.
November 6, 2003, 11:29 PM
kamakazie
[quote author=St0rm.iD link=board=5;threadid=3098;start=15#msg27795 date=1068161395]
Except that Move() isn't a VB property.
[/quote]

Huh?
November 7, 2003, 1:29 AM
Adron
[quote author=kamakazie link=board=5;threadid=3098;start=15#msg27823 date=1068168559]
[quote author=St0rm.iD link=board=5;threadid=3098;start=15#msg27795 date=1068161395]
Except that Move() isn't a VB property.
[/quote]

Huh?
[/quote]

It's a method?
November 8, 2003, 1:56 AM
Fr0z3N
....meh
November 8, 2003, 4:33 AM
kamakazie
[quote author=Adron link=board=5;threadid=3098;start=15#msg28027 date=1068256613]
[quote author=kamakazie link=board=5;threadid=3098;start=15#msg27823 date=1068168559]
[quote author=St0rm.iD link=board=5;threadid=3098;start=15#msg27795 date=1068161395]
Except that Move() isn't a VB property.
[/quote]

Huh?
[/quote]

It's a method?
[/quote]

The line between method and property in VB is thin. I think of the Move() property/method as something that assigns values, not something that does work on those values.
November 8, 2003, 6:22 PM

Search