Example #1
0
def test_cp13405():
    from System.Windows.Forms import PropertyGrid, DockStyle, Form
    grid = PropertyGrid()
    grid.Dock = DockStyle.Fill
    form = Form()
    form.Controls.Add(grid)
    form.Show()
    class PropertyExample(object):
        def __init__(self, X):
            self._X = X
        def _getX(self): return self._X
        def _setX(self, value): self._X = value
        X = property(_getX, _setX)

    example = PropertyExample(3)
    grid.SelectedObject = example
    
    def close_form():
        while not form.Visible:
            System.Threading.Thread.Sleep(100)
        System.Threading.Thread.Sleep(3000)
        form.Close()
        
    th = System.Threading.Thread(System.Threading.ThreadStart(close_form))
    th.Start()
    SWF.Application.Run(form)
Example #2
0
    def test_cp13405(self):
        import System.Windows.Forms as SWF
        from System.Windows.Forms import PropertyGrid, DockStyle, Form
        grid = PropertyGrid()
        grid.Dock = DockStyle.Fill
        form = Form()
        form.Controls.Add(grid)
        form.Show()
        class PropertyExample(object):
            def __init__(self, X):
                self._X = X
            def _getX(self): return self._X
            def _setX(self, value): self._X = value
            X = property(_getX, _setX)

        example = PropertyExample(3)
        grid.SelectedObject = example
        
        def close_form():
            while not form.Visible:
                System.Threading.Thread.Sleep(100)
            System.Threading.Thread.Sleep(3000)
            form.Close()
            
        th = System.Threading.Thread(System.Threading.ThreadStart(close_form))
        th.Start()
        SWF.Application.Run(form)
Example #3
0
    def __init__(self):
        """PropertyGridSample class init function."""
        self.count = 0

        # setup title
        self.Text = "PropertyGrid control"
        self.Height = 500

        # setup text
        self.text = TextBox()
        #self.text.AutoSize = True
        self.text.Height = 100
        self.text.Dock = DockStyle.Top
        self.text.Text = "The Property Grid of text control"

        # setup propertygrid
        self.propertygrid = PropertyGrid()
        self.propertygrid.CommandsVisibleIfAvailable = True
        self.propertygrid.Dock = DockStyle.Top
        self.propertygrid.TabIndex = 1
        self.propertygrid.Text = "Property Grid"
        self.propertygrid.SelectedObject = self.text
        self.propertygrid.PropertyValueChanged += self.color_change

        # add controls
        self.Controls.Add(self.propertygrid)
        self.Controls.Add(self.text)