Notifications
Clear all
[Closed] dotNet Label Control – font style
Jan 22, 2010 11:29 pm
Hi!
How can I change the font properties of a label dotNet control?
it’s declared in a rollout as:
dotNetControl dn_labelPR “System.Windows.Forms.Label” pos:[269,12] width:317 height:36
in the open handler of the rollout I’ve tried to execute this:
dn_labelPR.font.size = 36 – pretty straightforward, isn’t it?
but I get this error: “Attempt to set read-only property: #size”
what I am doing wrong?
thanks in advance folks ,
ml
2 Replies
Jan 22, 2010 11:29 pm
TheForm = dotnetobject "maxCustomControls.MaxForm"
--Creating the Font
--make an object from the Font Class
--give a fontfamily name and then put the size
TheFont = dotnetobject "System.Drawing.Font" "Impact" 30
lab1 = dotnetobject "System.Windows.Forms.label"
lab1.autosize = true
lab1.text = "Hello MaxScript !"
lab1.font = TheFont
TheForm.controls.add(lab1)
TheForm.showmodeless()
Jan 22, 2010 11:29 pm
worked like a charm. Thank you very much. I was trying to change the properties instead of creating a new font object…