Click to See Complete Forum and Search --> : Font Size


vchapran
April 24th, 2002, 12:05 PM
How to change the size of font of control?
Thank you
Vlad

vchapran
May 2nd, 2002, 08:16 AM
sngFontSize=12
ToolBar1.Font = new System.Drawing.Font("Microsoft Sans Serif", sngFontSize)




Vlad

Iouri
May 4th, 2002, 08:45 AM
change the size of font as well as resize and move all controls on the form depending on Screen resolution.
public Sub AdjustSize(byref frm as Form)
Dim ctl as Control
Dim sngFontSize as Single
sngFontSize = frm.Font.Size
sngFontSize = sngFontSize * sngSizeMultiplier
frm.Font = new System.Drawing.Font("Microsoft Sans Serif", _
sngFontSize, System.Drawing.FontStyle.Regular, _
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
for Each ctl In frm.Controls
If (TypeOf ctl is TextBox) Or (TypeOf ctl is ComboBox) _
Or (TypeOf ctl is CheckBox) Or (TypeOf ctl is Label) Or _
(TypeOf ctl is DateTimePicker) Or (TypeOf ctl is Button) Or _
(TypeOf ctl is DataGrid) Or _
(TypeOf ctl is ToolBar) then
ctl.Left = ctl.Left * sngSizeMultiplier
ctl.Width = ctl.Width * sngSizeMultiplier
ctl.Top = ctl.Top * sngSizeMultiplier
ctl.Height = ctl.Height * sngSizeMultiplier
End If
next

End Sub


on Form_Load event this public procedure call:

Call AdjustSize(me)




Iouri Boutchkine
iouri@hotsheet.com