I'm just writing a module to handle the resizing of forms, and scale them accurately for different screen resolutions, and for maximising small forms.
The idea is to prevent 'whitespace' when a user clicks the maximise button, or more to the point, when screen res'es differ from design machine -> user machine.
Can yous have a squiz at the attached module?
Just whack it in a project, and from your Form_Load event :
Call InitSize(Me)
Then in the Form_Resize event:
Call ScaleControls(Me)
Obviously, there's a time and a place for the use of this thing, but I want input on what needs fixing - I kinda hacked this out with no real direction, so feedback is good.
I have a suggestion though. Can you attach the code module to the next post?
PS: OK, we have had enough fun at the expense of your oversight, so if you really post the code or attach the code to the next post, I promise to give it a try.
And don't mind the sarcasm, I thought I would be the first to do that, but then I found that others had already done it and so there was no point in stressing the point further.
.
Last edited by honeybee; Feb 1st, 2002 at 04:57 AM.
I am not a complete idiot. Some parts are still missing. Check out the rtf-help tutorial General VB Faq Thread Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink! Get more power for your floppy disks. ; View honeybee's Elite Club: Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
And if that response was mine, please think about giving me a rep. I like to collect them!
OK, rj probably forgot to attach the module here, but he did so in Chit Chat, and so if any of you are serious about the testing, please visit Chit Chat.
rj, the code seems to work alright, but I don't like the change of font in the labels. I think you did it on purpose, but if the font is changed, the label caption is completely distorted.
Yeah, and this happens only after the form has been resized once or more times. Not on Form_Load().
.
I am not a complete idiot. Some parts are still missing. Check out the rtf-help tutorial General VB Faq Thread Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink! Get more power for your floppy disks. ; View honeybee's Elite Club: Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
And if that response was mine, please think about giving me a rep. I like to collect them!
i agree with honeybee regarding the fonts on the label caption though.
just an idea, what about if you could specify what it does with the controls, i.e. resizes proportionally, moves propertionally or both (you've got "both" at the mo), that would be good.
You could also get it to check the Tag property for each control etc for strings, that you could then add functionality for in your main resizing module.
i.e. if the control has the Tag "ignore" then just ignore that control.
stuff like that...
keep it up.
Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."
And since .NET includes the anchor and other features (or so I have learnt) such code would be rendered useless in .Net (or so I suspect).
Good attempt, all the same.
.
I am not a complete idiot. Some parts are still missing. Check out the rtf-help tutorial General VB Faq Thread Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink! Get more power for your floppy disks. ; View honeybee's Elite Club: Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
And if that response was mine, please think about giving me a rep. I like to collect them!
Originally posted by honeybee And since .NET includes the anchor and other features (or so I have learnt) such code would be rendered useless in .Net (or so I suspect).
Good attempt, all the same.
.
what's this "anchor" feature???
Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."
Check out Karl Moore's articles on VB.Net. It has a feature, a couple of properties to all controls I think, which lets you 'stick' a control on the form, and it is automaticall resized/moved if you resize the form.
This would work with simple resizing, and I don't think it provides for different resolutions.
.
I am not a complete idiot. Some parts are still missing. Check out the rtf-help tutorial General VB Faq Thread Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink! Get more power for your floppy disks. ; View honeybee's Elite Club: Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
And if that response was mine, please think about giving me a rep. I like to collect them!
I don't have .Net, so this is still useful to me at the moment.
The label font doesn't actually change, it just resizes to a 'scaled' size, based on the new width/height of said label. Same with combo boxes.
just an idea, what about if you could specify what it does with the controls, i.e. resizes proportionally, moves propertionally or both (you've got "both" at the mo), that would be good.
Not sure what you mean. The controls will resize according to the size of said controls and the form they're in, as specified at design time. So if a button takes up 10% of the form at d-t, when you resize the form, it will still be 10%.
At least, that's what I wanted it to do...