Valhalla Legends Forums Archive | Battle.net Bot Development | Maximizing a Program Window

AuthorMessageTime
Lord[KL]
How do you maximize a visual basic program, where the windows grow/shrink with the resize of the program? ::)
June 28, 2003, 6:06 AM
OcTaViuS
dunno wut this has to do with b.net but

[code]
me.minimize 'to minimize

me.maximize 'to maximize
[/code]

oh oh oh, i get to be the first to say it... read a vb b-b-b... aww now i forget what i was gonna say...blast it!! blast it to heck!!
June 28, 2003, 6:28 AM
LoRd[KL]
No.. the textfield (as used in a battle.net bot, WHERE THE TEXT IS DISPLAYED :) have to grow as the said program window does
June 28, 2003, 6:37 AM
Camel
You'll have to dynamicly adjust the top, left, height, and width properties of the controls on your form when the Form_Resize event is called. Here's what I use in my bot:
[code]Private Sub Form_Resize()
...
Const Padding As Integer = 3 * 15 '3 pixels of space between objects; 15 twips per pixel
Const ChanBoxHeight = 20 * 15
...
txtChan.Height = ChanBoxHeight
txtChan.Width = ulWidth
txtChan.Left = Me.ScaleWidth - txtChan.Width
txtChan.Top = 0

UL.Width = ulWidth
UL.Top = txtChan.Top + txtChan.Height + Padding
UL.Left = Me.ScaleWidth - UL.Width
UL.Height = Me.ScaleHeight - UL.Top

txtSend.Left = 0
txtSend.Width = txtChan.Left - txtSend.Left - Padding
txtSend.Height = sndHeight
txtSend.Top = Me.ScaleHeight - txtSend.Height
...
txtChat.Top = 0
txtChat.Left = 0
txtChat.Width = txtSend.Width
txtChat.Height = Me.ScaleHeight - txtSend.Height - Padding
...
End Sub[/code]

[edit] added a comment! ;D
June 28, 2003, 7:13 AM
CupHead
Just so you know, Camel, TwipsPerPixel is not always 15, and the number of twips per pixel up and down can be different from the number of twips per pixel side to side. You should use the Screen object and the TwipsPerPixelX/TwipsPerPixelY properties to do this more accurately.
June 28, 2003, 5:24 PM
Camel
[quote author=CupHead link=board=17;threadid=1721;start=0#msg13131 date=1056821098]
Just so you know, Camel, TwipsPerPixel is not always 15, and the number of twips per pixel up and down can be different from the number of twips per pixel side to side. You should use the Screen object and the TwipsPerPixelX/TwipsPerPixelY properties to do this more accurately.
[/quote]

I'm aware, but there's no real reason to compensate that way unless you're changing the property. In my *actual* code it checks, but I removed because by default TwipsPerPixelX and Y are both 15. :P
June 28, 2003, 7:16 PM
kamakazie
[quote author=Grok link=board=5;threadid=242;start=0#msg1337 date=1047785595]
Should also use Obj.Move instead of setting the properties directly.
[/quote]

Except comboboxes! For some reason one of the properties (Top?) doesn't work when setting via .Move.
June 28, 2003, 10:03 PM
CupHead
Maybe your default. Lord[KL]'s may be different. Also, the reason to compensate would be to have a dynamically changing height/width based on the screen itself rather than some possibly inaccurate calculation given by a frequently inaccurate forum-poster. ;)
June 28, 2003, 10:05 PM
Camel
[quote author=CupHead link=board=17;threadid=1721;start=0#msg13151 date=1056837918]
Maybe your default. Lord[KL]'s may be different. Also, the reason to compensate would be to have a dynamically changing height/width based on the screen itself rather than some possibly inaccurate calculation given by a frequently inaccurate forum-poster. ;)[/quote]
AFAIK, the value of TwipsPerPixelX and TwipsPerPixelY is dependant solely upon a property of the form. It would however, if I am correct in my previous statement, make sense that the default setting of said property is dependant on some system-wide variable, and not some constant. Even if it is, it's irrelivant: The value of said property will be static from system-to-system as it will be whatever the programmer sets it to, or it already is, when he compiles.
June 29, 2003, 5:01 AM
kamakazie
[quote author=Camel link=board=17;threadid=1721;start=0#msg13142 date=1056827816]
I'm aware, but there's no real reason to compensate that way unless you're changing the property. In my *actual* code it checks, but I removed because by default TwipsPerPixelX and Y are both 15. :P
[/quote]

Care to tell us what property this is?
June 29, 2003, 6:14 AM
Camel
[form].ScaleMode
June 29, 2003, 4:01 PM
kamakazie
[quote author=Camel link=board=17;threadid=1721;start=0#msg13186 date=1056902467]
[form].ScaleMode
[/quote]

Ok, so if I change the ScaleMode of a form, and then Print out Screen.TwipsPerPixelX/Y, I should get different values right? Well this isn't the case. There is a slight flaw in your logic (as usual). You see, TwipsPerPixelX/Y are dependent on the monitor or printer or whatever object you're referencing, not a property of a form (no property even exists for forms!). To change values from one ScaleMode to another, you'd use ScaleX() and ScaleY(). For example:
[code]
Form1.ScaleX(3, vbPixels, Form1.ScaleMode) ' 3 is arbitrary, this will convert 3 Pixels to what ever ScaleMode the form is set for, thus allowing us to use this number for resizing.
[/code]
June 29, 2003, 11:58 PM
Camel
[quote author=kamakazie link=board=17;threadid=1721;start=0#msg13222 date=1056931091]
[quote author=Camel link=board=17;threadid=1721;start=0#msg13186 date=1056902467]
[form].ScaleMode
[/quote]

Ok, so if I change the ScaleMode of a form, and then Print out Screen.TwipsPerPixelX/Y, I should get different values right? Well this isn't the case. There is a slight flaw in your logic (as usual). You see, TwipsPerPixelX/Y are dependent on the monitor or printer or whatever object you're referencing, not a property of a form (no property even exists for forms!). To change values from one ScaleMode to another, you'd use ScaleX() and ScaleY(). For example:
[code]
Form1.ScaleX(3, vbPixels, Form1.ScaleMode) ' 3 is arbitrary, this will convert 3 Pixels to what ever ScaleMode the form is set for, thus allowing us to use this number for resizing.
[/code]
[/quote]

I'm not the one who suggested using Screen.TwipsPerPixel*! My code uses ScaleX and ScaleY! I really dont see why this is such a big fucking deal; I didn't think that it was worth pointing out that it's possible to do such a conversion dynamicly because it would just be one more thing to confuse him. But then again I must go easy on you; sometimes I forget that you were never new to VB.
There was no flaw in my logic: I openly admited that I was unsure of how Screen.TwipsPerPixel* was determined and offered only a guess. I went on to say -- apparantly not clear enough for you to understand -- that it is irrelivant because, so long as the value of [form].ScaleMode is not being changed at runtime, there is no reason to compensate for a change and the value [of Padding] can be constant. This is why I replaced my code with constants.

[edit] value [of Padding]
June 30, 2003, 4:00 AM
kamakazie
My point is that you openly convey wrong information to people intentional and unintentional and it's extremely annoying. If you're unsure, then go figure it out. I took the time to, surely you could.
June 30, 2003, 4:33 AM
Camel
[quote author=kamakazie link=board=17;threadid=1721;start=0#msg13258 date=1056947621]
My point is that you openly convey wrong information to people intentional and unintentional and it's extremely annoying. If you're unsure, then go figure it out. I took the time to, surely you could.
[/quote]
Let me translate what I said for you: "I'm not sure what Feature X does, but it's irrelivant because it's totally useless anyways. Use Feature Y instead."
June 30, 2003, 11:08 PM
DarkMinion
He's not just talking about this time, sweetheart.
July 1, 2003, 12:00 AM

Search