The following defines the creation of a CheckBox in a Panel or Form
derived class.# Create the checkBox
self.checkBox = WinForms.CheckBox()
self.checkBox.Parent = self
self.checkBox.Size = Size(80,30)
self.checkBox.Location = Point(120,10)
self.checkBox.Text = "Enable"
self.checkBox.Checked = 1
# Register event handler for checkBox.CheckedChanged
self.checkBox.CheckedChanged += self.checkBox_CheckedChangedHandler
def checkBox_CheckedChangedHandler(self, sender, args):
# Handles the checkBox CheckedChanged event
if self.checkBox.Checked == 1:
self.button.Enabled = 1
elif self.checkBox.Checked == 0:
self.button.Enabled = 0
|