Treeview - Change Font Size

robinathome

Member
Licensed User
Longtime User
How can change the font size of a Treeview, the one in in ControlsEx.dll
I know the question has been asked before in early 2008 but can't find a suitable property. Has this been included?

Thanks
Robin
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use the door library to do it (source code is attached):
B4X:
Sub Globals
    'Declare the global variables here.

End Sub

Sub App_Start
    Form1.Show
    Node.New1
    tv.New1("form1", 10, 10, 200, 200)
    tv.AddNewNode("node1")
    Node.Value = tv.AddNewNode("node2")
    Node.AddNewNode("node3")
    SetTreeViewSize("tv", 15)
End Sub

Sub SetTreeViewSize(tree, size)
    obj.New1(False)
    obj.Value = Treeview(tree).ControlRef
    font.New1(False)
    font.Value = obj.GetProperty("Font")
    objArray.New1(3)
    objArray.SetValue(0, font.GetProperty("Name"), "System.String")
    objArray.SetValue(1, size, "System.Single")
    objArray.SetValue(2, "Regular", "System.Drawing.FontStyle" & font.System_Drawing)
    font.CreateNew2("System.Drawing.Font" & font.System_Drawing, objArray.Value)
    obj.SetProperty2("Font", font.Value)
End Sub
 

Attachments

  • 1.sbp
    1.2 KB · Views: 212
Top