How to fit a rollout to a dotnet labels contents and show tabs correctly
My end goal here is to make a custom messagebox as I want to gain control over its position.
I want to get two things figured out here.
1. How do I fit the dialog to the size of the contents like the attached maxscript messagebox.png for this dialog?
2. Is it possible to have the \t characters line up like the messagebox also?
Here's the label inside a basic rollout.
clearlistener() ( try destroyDialog rolloutName catch() rollout rolloutName "rolloutName" ( dotNetControl lbl_msg "Label" --width:(rolloutName.width-20) height:100 fn dotNetControlsInt = ( show lbl_msg -- TheFont = dotnetobject "System.Drawing.Font" "Arial" 10 -- lbl_msg.font = TheFont lbl_msg.BackColor = (dotNetClass "System.Drawing.Color").fromARGB (((colorMan.getColor #background) * 255)[1] as integer) (((colorMan.getColor #background) * 255)[2] as integer) (((colorMan.getColor #background) * 255)[3] as integer) lbl_msg.ForeColor = (dotNetClass "System.Drawing.Color").fromARGB (((colorMan.getColor #text) * 255)[1] as integer) (((colorMan.getColor #text) * 255)[2] as integer) (((colorMan.getColor #text) * 255)[3] as integer) lbl_msg.UseCompatibleTextRendering = true lbl_msg.AutoSize = true lbl_msg.TabIndex = 4 lbl_msg.TabStop = true lbl_msg.Size = dotnetObject "System.Drawing.Size" 500 600 labelText = "This\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\nThis\t\tis\n_a_\t\ttest.\n" -- My effort to get the tabs to line up. Yes, its really useless. lbl_msg.Text = substituteString labelText "\t" "\x0009" -- A Unicode attempt. lbl_msg.Text = substituteString labelText "\t" " " -- The more useless attempt. ) on rolloutName open do dotNetControlsInt() ) createDialog rolloutName 500 250 )
Attachment | Size |
---|---|
maxscript_messagebox.png | 10.88 KB |
Comments
.
Try this:
Tools and Scripts for Autodesk 3dsMax
.
Thanks, I was trying to create my own message box but wanted to have control over the position of it.
My main obstacle is to get tabbing to work for the label and the auto sizing of it which in turn will help me resize the main dialog.
Meant tab in this screenshot text below.