Hi!
I have a question about dialog box.
Why in this example the form is in the background in relation to Rhino?
How do I make it stay in the foreground?
import scriptcontext as sc
import rhinoscriptsyntax as rs
import Rhino
from System.Drawing import Bitmap
import System
import System.Windows.Forms
import System.Drawing
import Rhino.RhinoApp as Rapp
class Form1(System.Windows.Forms.Form):
def __init__(self):
self.InitializeComponent()
self.ClientSize = System.Drawing.Size(100, 100)
self.CenterToScreen()
self.MaximizeBox = False
self.MinimizeBox = False
def InitializeComponent(self):
self.SuspendLayout()
################## LABELS ##################
self._button = System.Windows.Forms.Button()
self._button.Text = "Create"
self._button.Click += self.ClickButton
self.Controls.Add(self._button)
self.KeyPreview = True
self.Text = "Test"
self.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
self.KeyDown += self.OnKeyDownEvent
self.Closing += self.OnClosingEvent
self.ResumeLayout(False)
# Linkbutton click handler
def ClickButton(self, sender, e):
Rhino.RhinoApp.RunScript("-_Line 0,0,0 10,10,10 _Sellast", False)
print rs.SelectedObjects()
rs.UnselectAllObjects()
def OnKeyDownEvent(self, sender, e):
finish = e.KeyCode == System.Windows.Forms.Keys.Escape
if finish:
self.Close()
e.Handled = True
def OnClosingEvent(self, sender, e):
Rhino.Input.Custom.GetBaseClass.PostCustomMessage("exit")
def Test():
f = Form1()
f.Show()
if __name__ == "__main__":
Test()