Insane question... i want to place a preview in a windows form

That pretty much sums it up.

I am making a tool builder.

The user builds the multicams tool list from my form, then it inserts my generic tool list block and modifies it with the correct tools. Pretty easy stuff…

But now I want to get fancy with it and I have no idea where to begin.

How would one make a preview inside a formUI? I am thinking spreadsheet with 2 columns max and I’ll put in a loop to keep stacking the tools in the rows.

Any ideas? I know it’s a tall order

Thanks for any input :slight_smile:

You can create dialogs and form using WinForms, which is a Microsoft .NET UI architecture. You might Google “IronPython and WinForms” to see what samples you can find.

Here is a cheezy sample to get you thinking:

import sys
import clr
from System.Drawing import Point
from System.Windows.Forms import Application, Form, Button, Label

class HelloRhinoForm(Form):
    def __init__(self):
        self.Text = "Hello Rhino!"
        self.Name = "Hello Rhino!"
        self.Height = 200
        self.Width = 300
        self.count = 0
        self.label = Label()
        self.label.Text = "Here is a label."
        self.label.Location = Point(50, 50)
        self.label.Height = 30
        self.label.Width = 200
        button = Button()
        button.Text = "Click Here"
        button.Location = Point(50, 100)
        button.Click += self.buttonPressed
    def buttonPressed(self, sender, args):
        if self.count >= 20: self.count = 0
        self.count += 1
        self.label.Text = "You have clicked me %s times." % self.count
myform = HelloRhinoForm()
1 Like

Thanks for your help!

I have my entire form already built, but I cant find a method to use in System.Windows.Forms to show a simple 2 column multiple row form.

Any pointers?

Thanks again!

You might look into using a ListView control.

IronPython… wait wait wait…

Can I use VS to make forms, program, and use them in rhino???

Well I am all set up in VB now and loving life…

I mean… i like the ease of using the built in script editor for small stuff, but now that I can use VB I can’t be anymore happier :slight_smile: