Yes it can be a solution.
Here is a way of creating a .Net form containing a TextBox that looks visually similar to a a MAXScript dialog. One of the main difference is that the form cannot get messages when the main Max window is minimized, maximized, resized etc. It’s always displayed even if Max is minimized for example.You can set the parent if you create this form in C++/CLI in a plugin but not in MAXScript (it would be interesting to create a small patch to the dotNet bridge…).
Here is the code:
(
-- Create TextBox
hTextBox = dotNetObject "System.Windows.Forms.TextBox"
hTextBox.Location = dotNetObject "System.Drawing.Point" 10 10
hTextBox.Width = 280
hTextBox.Height = 280
hTextBox.Visible = true
hTextBox.MultiLine = true
ScrollBars = dotNetClass "System.Windows.Forms.ScrollBars"
hTextBox.ScrollBars = ScrollBars.Vertical
hTextBox.AcceptsReturn = true
hTextBox.AcceptsTab = true
hTextBox.WordWrap = true
-- Create Form
hForm = dotNetObject "System.Windows.Forms.Form"
hForm.Size = dotNetObject "System.Drawing.Size" 310 335
hForm.Text = ".Net 2.0 Form with TextBox"
hForm.Controls.Add(hTextBox)
hForm.TopMost = true
FormBorderStyle = dotNetClass "System.Windows.Forms.FormBorderStyle"
hForm.FormBorderStyle = FormBorderStyle.FixedDialog
hForm.ShowInTaskbar = false
hForm.MinimizeBox = false
hForm.MaximizeBox = false
-- Set appropriate Form background color
maxBackColor = colorMan.getColor #background
Color = dotNetClass "System.Drawing.Color"
hForm.BackColor = Color.FromArgb (maxBackColor[1] * 255.0f) (maxBackColor[2] * 255.0f) (maxBackColor[3] * 255.0f)
-- Show application Form
hApp = dotNetClass "System.Windows.Forms.Application"
hApp.Run hForm
)
Also, App.Run() is better than Form.Show() because it initializes well the dialog and the keyboard handling. With Form.Show(), Max intercepts all the keyboard messages when writting in the TextBox…