Library tutorials & articles
Windows Forms and Controls
A Closer Look at the Properties
Lets look at some of the properties you might not be familiar with.
Anchor: Relating to the controls this is how you can set the
controls to anchor themselves to a given area. If you start the project (F5 or
click the Video-like play button) and maximize the form you will see the label
moving over to the top-left of the form, the textbox to the top-right and the
two buttons to the bottom-right. The Accept button will not overlap the other
button just get as close as it can keeping any distance between itself and any
controls nearer to that anchor position.
Font: A familiar property but setting it on the form only (in this case) automatically sets all the controls on it to the same font. Of course you can set different fonts for the controls if you wish (not a good idea).
GridSize: A very handy one. With the above settings you will see more lines on the form and have more room to work with controls and the snapping effect you get by default. In VB6 I always used to turn off snapping for more accuracy but this new option means you can improve accuracy and keep the snapping which is very desirable.
Location: Applicable to forms and controls but you would normally just be setting controls. When using the designer it won’t be of much significance but worth noting if you ever want to set it in code.
MinimumSize: Try resizing your form as small as possible while running it. Because of the MinimumSize setting you can’t get it any smaller than 200x 200. Useful for ensuring certain parts of your form won’t disappear. I won’t describe Size as it’s a similar format but describes the size of the form/controls at runtime and again is more pertinent in code.
Opacity: If you start the project (F5 or click the Video-like play button) and look at your lovely creation. Whats this? It’s almost see through. Well I’m sure you’ve guessed that this is related to the opacity percentage we set. Not much use but hey it looks cool. Be careful not to overuse properties you think are cool but that you’re intended user might find very annoying given time. One possible use would be to increment the opacity gradually in code to give the form a fade-in effect as it loads.
TextAlign: Hardly an unfamiliar term but you’ll notice that
setting it for the label and button controls it allows you to click on a visual
position which again is a nice little touch.
Related articles
Related discussion
-
How to write the category attribut in a class dynamically
by converter2009 (1 replies)
-
VB.NET: Hide and show table using radio buttons
by converter2009 (1 replies)
-
VB.Net Button Problem
by pysdex (0 replies)
-
Unable to access AxInterop.AcoPdflib.dll on 64 bit OS
by Shaila14041981 (0 replies)
-
Very Urgent regarding deleting the images from a folder
by Nanosteps (6 replies)
Related podcasts
-
xpert to Expert: Inside Concurrent Basic (CB)
"Concurrent Basic extends Visual Basic with stylish asynchronous concurrency constructs derived from the join calculus. Our design advances earlier MSRC work on Polyphonic C#, Comega and the Joins Library. Unlike its C# based predecessors, CB adopts a simple event-like syntax familiar to VB progr...
Only 5 years after the last post eh :) Anyway because things may have changed I recommend you look at the microsoft docs on this - http://msdn.microsoft.com/en-us/library/ms229597(VS.80).aspx
It may not work with mdi children.
I use VB.Net (framework 1.0.3705) on Windows 2000, and I noticed the 'MinimumSize' property doesn't seem to have any effect on my forms (MDIChildren). Does that property really prevent users from resizing a form to a smaller size than the MinimumSize? Any other experiences?
Thank you,
This thread is for discussions of Windows Forms and Controls.