Grasshopper

algorithmic modeling for Rhino

how to display a waiting message using a form with a label - vb component

Hi,

I want to display a window saying "Please wait,..." while my vb script is running, using a form and a label. The form appears, but not the label inside. I dont understand why.

Here is my script :

Dim form1 As New Windows.Forms.Form
Dim label1 As New Windows.Forms.Label

label1.Autosize = True
label1.BackColor = System.Drawing.SystemColors.Control
label1.ForeColor = System.Drawing.SystemColors.ControlText
label1.Location = New System.Drawing.Point(0, 0)
label1.Name = "Label1"
label1.Size = New System.Drawing.Size(179, 13)
label1.TabIndex = 0
label1.Text = "Calcul en cours, merci de patienter..."
label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
label1.Visible = False

form1.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
form1.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
form1.ClientSize = New System.Drawing.Size(231, 61)
form1.ControlBox = False
form1.Controls.Add(label1)
form1.Name = "Dédé F."
form1.Text = "Dédé F."
form1.TransparencyKey = System.Drawing.Color.White
form1.StartPosition = FormStartPosition.CenterScreen
form1.Cursor = Cursors.WaitCursor

form1.Show()

Any idea ?

Views: 4145

Replies are closed for this discussion.

Replies to This Discussion

maybe that..

label1.Visible = True instead of label1.Visible = False

ah ah :)

label1.Visible = False determines whether the control is visible or hidden. So that is not the problem.

not sure...

label1.Visible = True 

 

It works with you, but not with me. If I change false to True, the label area is transparent, and I can't see the text...

 

And the script works on Visual Studio.

Did you test it with Grasshopper, or with Visual Studio or Excel ?

Could you send me your entire script ?

I got the solution on a vb.net forum, I have to add this line at the end of my script :

form1.Refresh()

Thanks anyway

 

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service