Revit dynamo simple dialog with wrapping and vertical scroll



import clr import sys clr.AddReference("System.Windows.Forms") clr.AddReference("System.Drawing") import System from System import Drawing import System.Drawing import System.Windows.Forms from System.Drawing import * from System.Windows.Forms import * import math ##https://forum.dynamobim.com/t/reporting-to-user-at-the-end-of-dynamo-player-script/37421/6 from System.Windows.Forms import Form,Label,Button,FormBorderStyle,FormStartPosition ################################################################################# class popup(Form): ## def __init__(self,text): self.InitializeComponent(text) def InitializeComponent(self,text): #form = Form() self.ClientSize = System.Drawing.Size(300, 200) ##Height self.Text = "Result:" ##Form Title self.FormBorderStyle = FormBorderStyle.FixedDialog ##Remove the maximize box. self.MaximizeBox = False ## Set the MinimizeBox to false to remove the minimize box. self.MinimizeBox = False ## Set the accept button of the form to button1. self.StartPosition = FormStartPosition.CenterScreen self.AutoScroll = True self.ScrollBars = ScrollBars.Vertical ########Label for text##### self.label = Label() self.label.Parent = self self.label.Text = text self.label.TextAlign = ContentAlignment.TopLeft self.label.Font = System.Drawing.Font("Tahoma", 10, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0) self.label.AutoSize = True ##This was the key to wrapping hte text inside the lable on the form: ##https://stackoverflow.com/questions/1204804/word-wrap-for-a-label-in-windows-forms self.label.MaximumSize = System.Drawing.Size(self.Width-40,0) self.label.WordWrap=True self.label.Left=10 self.label.Top=10 self.ResumeLayout(False) text="".join(IN[0]) oForm=popup("FOObar" + text) ##Set the form with the text value oForm.ShowDialog() ##Show the form

Comments

Popular posts from this blog

Powerpoint countdown and current time in slides VBA

Revit area plans adding new types and references (Gross and rentable)