Grasshopper

algorithmic modeling for Rhino

Hi,
I created a window that the user will modify the size and position, and I don't know how to access to this window after show it. That is, the window goes with determined properties, which will be modified with the mouse by dragging and resizing the window.

What I want to do is always have data from size and position though have been modified after executing the script.

I searched a lot on the internet before posting here, but without success, I am new in scripting.

Could anyone guide me or tell me how?

Thank you.

Code:

Dim form As New Windows.Forms.Form
form.Text = "Forma1"
form.StartPosition = FormStartPosition.CenterParent
form.ClientSize = New System.Drawing.Size(500, 350)
form.TopMost = True
form.Show()

.

Views: 307

Replies to This Discussion

How to declare the resizeBegin event?

when I do like in the example of msdn, I get this error:

Error (BC30506): The Handles clause requires a WithEvents variable defined in the containing type or one of its basic types. (line 110)

There's two ways to register a handler for an event in VB. You can either use the Handles keyword with the method signature (which is what you've been trying to do) or you can use the AddHandler keyword. When you're using the Form Editor in Visual Studio, the Handles approach works best. However if you're making a form at runtime then I recommend AddHandler. It will look something like this:

Dim form As New Form()

form.XXXX()

form.YYYY = ZZZZ

AddHandler form.SizeChanged, FormSizeChanged

where FormSizeChanged must be the name of a method that has the correct signature for the event.

Almost all events will be accessible using the signature below, but note that often you can use a more derived EventArgs type which gives you more information about the event.

Private Sub FormSizeChanged(sender As Object, e As EventArgs)

End Sub

Good, thank you, now I know how to declare. But not how to access event data, for example, I put this in the custom code:

   Dim form As New Windows.Forms.Form
   Private Sub FormSizeChanged (sender As Object, e As EventArgs)
     print (form.Bounds.Size.ToString ())
   End Sub

The script runs but does not receive any message. How do I access the data for a specific event?

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service