Hi;
I am new in class and winforms, how cant I close the windows in this sample? and if I add many button in the windows, how cant I get the result of them to continue my script? For example: I add button “A” and button “B”, if I click in button “A”, I will cant add a line, if I click in button “B”, I will cant add a cricle.
Sorry for my english.Think you.
import rhinoscriptsyntax as rs
import Rhino
import System.Drawing
import System.Windows.Forms
from System.Drawing import *
from System.Windows.Forms import *
class CirForm(Form):
def __init__(self):
self.Name = "Form"
self.ShowIcon = True
self.Text = "Draw Circle Test"
self.ClientSize = System.Drawing.Size(200, 90)
self.BackColor = System.Drawing.SystemColors.Menu
self.CenterToScreen()
self._Label1 = System.Windows.Forms.Label()
self._RadVal = System.Windows.Forms.NumericUpDown()
self._Ok = System.Windows.Forms.Button()
self._Cancel = System.Windows.Forms.Button()
#
self.radius = 18
#
# label1
#
self._Label1.Location = System.Drawing.Point(6, 23)
self._Label1.Name = "label1"
self._Label1.Size = System.Drawing.Size(100, 17)
self._Label1.TabIndex = 0
self._Label1.Text = "Radius for Circle"
#
# radius
#
self._RadVal.Location = System.Drawing.Point(112, 20)
self._RadVal.Name = "radius"
self._RadVal.Size = System.Drawing.Size(41, 20)
self._RadVal.TabIndex = 1
self._RadVal.ReadOnly = False
self._RadVal.Value = 18
self._RadVal.Increment = 3
self._RadVal.Minimum = 9
self._RadVal.Maximum = 48
#self._RadVal.ValueChanged = self.Radius_OnValueChange
#
# Ok
#
self._Ok.DialogResult = System.Windows.Forms.DialogResult.OK
self._Ok.Location = System.Drawing.Point(6, 56)
self._Ok.Name = "Ok"
self._Ok.Size = System.Drawing.Size(70, 26)
self._Ok.TabIndex = 2
self._Ok.Text = "OK"
self._Ok.UseVisualStyleBackColor = True
#
# Cancel
#
self._Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
self._Cancel.Location = System.Drawing.Point(84, 56)
self._Cancel.Name = "Cancel"
self._Cancel.Size = System.Drawing.Size(70, 26)
self._Cancel.TabIndex = 3
self._Cancel.Text = "Cancel"
self._Cancel.UseVisualStyleBackColor = True
#
# Form1
#
self.AcceptButton = self._Ok
self.CancelButton = self._Cancel
self.Controls.Add(self._Label1)
self.Controls.Add(self._RadVal)
self.Controls.Add(self._Ok)
self.Controls.Add(self._Cancel)
self.SuspendLayout()
def Radius_OnValueChange(self, sender, e):
self.radius = sender.Value
if __name__ == "__main__":
form = CirForm()
form.Show(Rhino.RhinoApp.MainWindow())
rs.AddCircle(rs.GetPoint(), form.radius)