|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
If Statement, Please Helpcan not seem to get this statement to work. Thanks in advance Perry Private Sub MenuItem16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem16.Click Dim Width As Integer Width = Screen.PrimaryScreen.WorkingArea.Width If Width = 1024 Then SetSmallAFont() ElseIf Width = 1280 Then SetSmallBFont() Else SetSmallCFont() End If End Sub
Show quote
"plangla" <plan***@hotmail.com> schrieb I don't know which problem exactly you have. Generally spoken, a Font's size > I am trying change the font size of text based on the menu item > clicked. I can not seem to get this statement to work. > > Thanks in advance Perry > > > > Private Sub MenuItem16_Click(ByVal sender As System.Object, ByVal e > As System.EventArgs) Handles MenuItem16.Click > > Dim Width As Integer > > Width = Screen.PrimaryScreen.WorkingArea.Width > > If Width = 1024 Then SetSmallAFont() > > ElseIf Width = 1280 Then SetSmallBFont() > > Else > > SetSmallCFont() > > End If > > End Sub can not be changed. You have to create a new Font and pass the new size. See the constructors of the Font class. Armin plangla wrote:
> I am trying change the font size of text based on the menu item clicked. The code you've posted doesn't show us /how/ you're trying to "change the font size" - we have no idea what's in those three Set*Font() routines - but, essentially, you can't change the font size anyway. Annoyingly, you have to create a whole /new/ Font object, based on one that you already have, and pass the new size into its constructor. Dim basicFont as Font = Me.Font Dim bigFont as Font = New Font( basicFont.FontFamily, 99 ) Also, your code doesn't take any notice of the menuitem at all - it's all based on the screen size. Is that what you intended? Or did you want a number of menu items, each of which would choose a different font size? HTH, Phill W. |
|||||||||||||||||||||||