RunTime Control Anchor & Font Scaling

J

Joseph Gruber

Hi all -- I have two questions.

First, I'm adding a control to my form at runtime and the control/form
seems to ignore the anchor property of the runtime control. Any idea
how I can get a runtime control to anchor properly?

Second -- the program I'm writting is supposed to look like a dos
application (long story). When the application is "Normal" aka a
small window then everything looks great. But when I resize the
window to Maximize (going full screen w/o a toolbar) it doesn't look
right. What I'd like to have happen is the font's to rescale based
upon the window size. Any suggestions on how to accomplish this?

Thanks!

Joseph
 
R

rowe_newsgroups

Hi all -- I have two questions.

First, I'm adding a control to my form at runtime and the control/form
seems to ignore the anchor property of the runtime control. Any idea
how I can get a runtime control to anchor properly?

Second -- the program I'm writting is supposed to look like a dos
application (long story). When the application is "Normal" aka a
small window then everything looks great. But when I resize the
window to Maximize (going full screen w/o a toolbar) it doesn't look
right. What I'd like to have happen is the font's to rescale based
upon the window size. Any suggestions on how to accomplish this?

Thanks!

Joseph

First, I'm adding a control to my form at runtime and the control/form
seems to ignore the anchor property of the runtime control. Any idea
how I can get a runtime control to anchor properly?

Something like:

MyControl.Anchor = Anchor.Top Or Anchor.Left
Second -- the program I'm writting is supposed to look like a dos
application (long story).

And I'm sure an interesting one :)
When the application is "Normal" aka a
small window then everything looks great. But when I resize the
window to Maximize (going full screen w/o a toolbar) it doesn't look
right. What I'd like to have happen is the font's to rescale based
upon the window size. Any suggestions on how to accomplish this?'

Any screen shots? Since your not doing a standard app (I assume your
not using textboxes et all since you're going for a DOS look), it's a
bit difficult to tell you how you could resize your fonts since I
don't know how you're using them.

Thanks,

Seth Rowe
 
J

Joseph Gruber

Something like:

MyControl.Anchor = Anchor.Top Or Anchor.Left


And I'm sure an interesting one :)


Any screen shots? Since your not doing a standard app (I assume your
not using textboxes et all since you're going for a DOS look), it's a
bit difficult to tell you how you could resize your fonts since I
don't know how you're using them.

Thanks,

Seth Rowe

Regarding the anchor property -- I've set that (on a label) but it
doesn't seem to get configured at runtime. It doesn't anchor.

Can upload a screenshot in a bit -- basically though it's a lot of
labels. Some stretched to the size of the form while other "rows" may
have 2 or 3 labels in a panel.
 
R

rowe_newsgroups

Regarding the anchor property -- I've set that (on a label) but it
doesn't seem to get configured at runtime. It doesn't anchor.

Can upload a screenshot in a bit -- basically though it's a lot of
labels. Some stretched to the size of the form while other "rows" may
have 2 or 3 labels in a panel.

Regarding the anchor property -- I've set that (on a label) but it
doesn't seem to get configured at runtime. It doesn't anchor.

On a new form the following works fine:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim l As New Label()
l.Text = "My Label"
l.Anchor = AnchorStyles.Bottom Or AnchorStyles.Right
Me.Controls.Add(l)
l.Location = New Point(150, 150)
End Sub

After you add that code drag out the bottom left corner of the form to
see the anchor property reposition the label. If you replace that code
with the following it will demonstrate how the anchor property can be
used to stretch a label:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim l As New Label()
l.Text = "My Label"
' Since the font won't increase, I changed
' the backcolor to demonstrate the effect better
l.BackColor = Color.Red
l.Anchor = AnchorStyles.Bottom Or AnchorStyles.Right Or
AnchorStyles.Top Or AnchorStyles.Left
Me.Controls.Add(l)
l.Location = New Point(150, 150)
End Sub

Thanks,

Seth Rowe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top