import clr clr.AddReference('System.Drawing') clr.AddReference('System.Windows.Forms') clr.AddReference('Microsoft.Ink, Version=1.7.2600.2180, Culture=neutral, PublicKeyToken=31bf3856ad364e35') from System.Drawing import Font, Color from System.Windows.Forms import (Form, DockStyle, Panel, TextBox, Button, SplitContainer, Orientation) from Microsoft.Ink import InkOverlay f = Form() f.Text = 'InkOverlay Example' btn = Button() btn.Text = 'Erase' pnl = Panel() pnl.BackColor = Color.Khaki overlay = InkOverlay(pnl) overlay.Enabled = True tb = TextBox() tb.Font = Font('serif', 20) tb.Multiline = True sc = SplitContainer() sc.SplitterWidth = 10 sc.Orientation = Orientation.Horizontal # Layout f.Width = 600 f.Height = 400
def __init__(self): ''' Creates a _PictureBoxPanel. Call set_image after initialization. ''' # the left and right arrow Image objects self.__left_arrow = Resources.createArrowIcon(True, False) self.__full_left_arrow = Resources.createArrowIcon(True, True) self.__right_arrow = Resources.createArrowIcon(False, False) self.__full_right_arrow = Resources.createArrowIcon(False, True) # the vertical line boundary between the full_left and left arrow's # 'clickable columns' and the full_right and right arrow's. self.__left_bound = 0; self.__right_bound = 0; # the image attributes to use for drawing non-alpha blended images self.__hovered_image_atts = None # the image attributes to use for drawing alpha blended images self.__normal_image_atts = None # a string indicating whether the mouse is hovered over the full # left ('FL'), left ('L'), right ('R'), or full right ('FR') side of # this panel, or None if the mouse isn't over the panel at all. self.__mouse_hovered_state = None # our PictureBox object, which we center and stretch as needed self._picbox = None Panel.__init__(self) self.__build_gui()
def __init__(self, watcher=None): # self.__watcher = watcher self.Text = "FileWatcher configuration" self.__table = TableLayoutPanel() self.MinimumSize = Size(520, 360) self.Size = Size(640, 360) self.MaximizeBox = False self.Icon = Icon("watcher.ico") p = Panel() p.Padding = Padding(10, 0, 10, 10) exitBut = Button(Text="E&xit") p.Height = exitBut.Height + 10 p.Controls.Add(exitBut) exitBut.Dock = DockStyle.Right p.Dock = DockStyle.Bottom def exit(s, e): self.Dispose() exitBut.Click += exit self.Controls.Add(p) self.Controls.Add(self.__table) label = Label(Text="Watch Directories") self.__table.Controls.Add(label) self.__list = ListBox() self.__list.Width = 500 self.__table.Dock = DockStyle.Fill try: for wd in watcher.controller.watchDirectories.itervalues(): self.__list.Items.Add(wd) except Exception, e: self.__list.Items.Add(str(e))
def __init__(self): self.Text = 'Buttons' self.Size = Size(WIDTH, HEIGHT) ok = Button() PANEL_HEIGHT = ok.Height + PANEL_SPACE panel = Panel() panel.Height = PANEL_HEIGHT panel.Dock = DockStyle.Bottom panel.Parent = self x = ok.Width * 2 + BUTTONS_SPACE y = (PANEL_HEIGHT - ok.Height) / 2 ok.Text = "Ok" ok.Parent = panel ok.Location = Point(WIDTH-x, y) ok.Anchor = AnchorStyles.Right close = Button() x = close.Width close.Text = "Close" close.Parent = panel close.Location = Point(WIDTH-x-CLOSE_SPACE, y) close.Anchor = AnchorStyles.Right self.CenterToScreen()
def __init__(self, modules): Panel.__init__(self) self.modules = modules self.Dock = DockStyle.Fill self.moduleActivatedHandler = None # The infoPane contents is initialised through AfterSelect event # from ModuleTree self.infoPane = ModuleInfoPane() self.moduleTree = ModuleTree() for m in self.modules.ListOfNames(): self.moduleTree.AddModuleName(m) self.moduleTree.ExpandAll() self.moduleTree.SetSelectedHandler(self.TreeNodeSelected) self.splitContainer1 = SplitContainer() self.splitContainer1.Dock = DockStyle.Fill self.splitContainer1.TabIndex = 1 self.splitContainer1.SplitterWidth = UIGlobal.SPLITTER_WIDTH self.splitContainer1.SplitterDistance = 70 self.splitContainer1.Orientation = Orientation.Vertical self.splitContainer1.Panel1.Controls.Add(self.moduleTree) self.splitContainer1.Panel2.Controls.Add(self.infoPane) ## Add the main SplitContainer control to the panel. self.Controls.Add(self.splitContainer1)
def __init__(self, config, issue_num_hint_s=None): ''' Initializes this panel. 'config' -> the shared global Configuration object 'issue_num_hint_s' -> issue number to use for figuring out which cover art to display when the currently set ref is a SeriesRef. ''' # the shared global configuration self.__config = config # the issue number to use when finding cover art for a SeriesRef self.__issue_num_hint_s = issue_num_hint_s # a PictureBox that displays the cover art for the current selected issue self.__coverpanel = None # a linklabel describing the currently displayed cover image self.__label = None # the function that gets called if a link on self.__label gets clicked self.__link_callback = None # the "next" button for seeing a ref's next available cover self.__nextbutton = None # the "prev" button for seeing a ref's previous cover self.__prevbutton = None # the IssueRef or SeriesRef whose cover we are currently displaying self.__ref = None # a mapping of refs to _ButtonModels. Basically caches the # next/prev button state for each ref. self.__button_cache = {} # a mapping of SeriesRefs to IssueRefs (or SeriesRefs). this cache lets # us avoid querying the database twice for the same SeriesRef. self.__series_cache = {} # a scheduler (thread) for finding cover images... self.__finder_scheduler = Scheduler() # a scheduler (thread) for setting new refs... self.__setter_scheduler = Scheduler() # a tuple containing the user's alternate cover art choice (a url) for # a specific IssueRef i.e. (IssuRef, url). none if no alt choice was made. self.__alt_cover_choice = None Panel.__init__(self) self.__build_gui()
def __init__(self, pictureBox): Panel.__init__(self) # This makes the panel selectable, and therefore scrollable # with the mouse wheel self.SetStyle(ControlStyles.Selectable, True) self.Dock = DockStyle.Fill self.AutoScroll = True self.image = pictureBox.Image self.sizeMode = pictureBox.SizeMode pictureBox.Parent = self pictureBox.Click += lambda *_: self.Focus() self.Click += lambda *_: self.Focus()
def __init__(self): startX = 30 self.Text = "Program2 (Page1)" self.Width = 440 self.Height = 620 self.databaseContainer = Panel() self.databaseContainer.Width = 360 self.databaseContainer.Height = 225 self.databaseContainer.Location = Point(30, 30) self.databaseContainer.BorderStyle = BorderStyle.FixedSingle self.listContainer = Panel() self.listContainer.Width = 360 self.listContainer.Height = 225 self.listContainer.Location = Point(30, 295) self.listContainer.BorderStyle = BorderStyle.FixedSingle self.btnNextPage = Button() self.btnNextPage.Width = 360 self.btnNextPage.Height = 30 self.btnNextPage.Location = Point(30, 530) self.btnNextPage.Text = "Next to Page 2" self.btnNextPage.Enabled = True self.btnNextPage.Click += self.btnNextPage_Clicked self.initHeaderForDatabasePanel() self.initDatabasePanel() self.initHeaderForListPanel() self.initListPanel() for x in range(10): databaseRow = TBL_Generator.DatabaseRow(self, x, "Chatchawan", str(12345 + x)) self.DatabasePanel.Controls.Add(databaseRow) self.databaseContainer.Controls.Add(self.headerDBPanel) self.databaseContainer.Controls.Add(self.DatabasePanel) self.listContainer.Controls.Add(self.ListPanel) self.listContainer.Controls.Add(self.headerListPanel) self.Controls.Add(self.databaseContainer) self.Controls.Add(self.listContainer) self.Controls.Add(self.btnNextPage)
class ShowTextFile(Form): def __init__(self, fName): fContent="" try: with open(fName, 'r') as f: for line in f: fContent += line + "\r\n" #print line f.close() except Exception,e : fContent="No content " self.Text = "SolverStudio pyCMPL Viewer: "+fName self.FormBorderStyle = FormBorderStyle.Sizable # SizableToolWindow # FixedDialog self.Height=500 self.Width = 600 self.Content = TextBox() self.Content.Text=fContent self.Content.ReadOnly=True self.Content.SelectionStart = 0 self.Content.Multiline = True self.Content.WordWrap = False self.Content.ScrollBars = ScrollBars.Both self.Content.Dock = DockStyle.Fill self.Content.Font=Font("Courier New",10) self.bOK=Button() self.bOK.Text = "OK" self.bOK.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right); # self.bOK.Dock = DockStyle.Right # self.bOK.Width = 75 AJM: Go with the default height/width to be more Windows-like # self.bOK.Height = 25 self.bOK.Click += self.OK self.AcceptButton = self.bOK self.buttonPanel=Panel() self.buttonPanel.Dock=DockStyle.Bottom self.buttonPanel.Height=35 self.buttonPanel.Controls.Add(self.bOK) self.bOK.Left = self.buttonPanel.Width - self.bOK.Width - 20 # AJM: Position button nicely self.bOK.Top = 7 # AJM: Position button nicely self.Controls.Add(self.Content) self.Controls.Add(self.buttonPanel) self.CenterToScreen()
def miniPanel(self, x, y): panel = Panel() panel.Width = 750 panel.Height = 150 panel.Location = Point(x, y) panel.BorderStyle = BorderStyle.None return panel
def medPanel(self, x, y): panel = Panel() panel.Width = 300 panel.Height = 300 panel.Location = Point(x, y) panel.BorderStyle = BorderStyle.FixedSingle return panel
def showBox(self): ''' set the remaining box controls and launch ''' self.buttonpanel = Panel() self.buttonpanel.Parent = self self.buttonpanel.Location = Point(0, self.panel.Bottom) self.buttonpanel.Size = Size(Fconfig.smwidth, 2 * Fconfig.unitline) self.buttonpanel.Dock = DockStyle.Bottom self.warning = Label() self.warning.Parent = self.buttonpanel self.warning.Location = Point(Fconfig.margin, 0) self.warning.Size = Size(Fconfig.smwidth, Fconfig.unitline) self.warning.Font = Font(Fconfig.basefont, Fconfig.sizefont, FontStyle.Bold) self.warning.ForeColor = Color.Coral self.warning.TextAlign = ContentAlignment.MiddleCenter okay = Button() okay.Parent = self.buttonpanel okay.Text = Fconfig.buttonOK okay.Location = Point(50, Fconfig.unitline) okay.Width = 140 okay.Click += self.onValidate okay.Anchor = AnchorStyles.Right cancel = Button() cancel.Text = Fconfig.buttonCANCEL cancel.Parent = self.buttonpanel cancel.Location = Point(okay.Right, Fconfig.unitline) cancel.Click += self.onCancel cancel.Anchor = AnchorStyles.Right self.Width = Fconfig.width self.Height = self.panel.Bottom + 105 self.CenterToScreen() ModeDBG.say('\npanel top :{0}, bottom :{1}'.format( self.panel.Top, self.panel.Bottom)) ModeDBG.say('\n\nPanel loaded with {0} items\n'.format( len(self.panelparams))) # Display the form try: if Application.MessageLoop: TaskDialog.Show('UserForm', 'Another window is running...') else: Application.Run(self) except: TaskDialog.Show('UserForm', 'Loading failed...')
def __init__(self, tweet): Panel.__init__(self) self.tweet = tweet self.Height = HEIGHT self.imageBox = imageBox = PictureBox(Height=HEIGHT, Width=HEIGHT) imageBox.Image = getImage(tweet) imageBox.Anchor = AnchorStyles.Left imageBox.Parent = self halfway = (self.ClientSize.Width - imageBox.Width) / 2 self.friendLabel = friendLabel = Label(Text=tweet['screen_name'], TextAlign=ContentAlignment.MiddleLeft) friendLabel.Font = Font(friendLabel.Font, friendLabel.Font.Style | FontStyle.Bold) friendLabel.Left = imageBox.Width friendLabel.Anchor = AnchorStyles.Left | AnchorStyles.Right friendLabel.Width = halfway friendLabel.Parent = self self.dateLabel = dateLabel = Label(Text=str(tweet['created']), TextAlign=ContentAlignment.MiddleRight) dateLabel.Width = halfway dateLabel.Left = self.Width - dateLabel.Width - 10 # scrollbar dateLabel.Anchor = AnchorStyles.Left | AnchorStyles.Right dateLabel.Parent = self dateLabel.BringToFront() self.tweetLabel = tweetLabel = Label(Text=tweet['text']) tweetLabel.Left = self.imageBox.Width tweetLabel.Top = friendLabel.Height tweetLabel.Width = self.Width - self.imageBox.Width tweetLabel.Height = self.Height - friendLabel.Height tweetLabel.Anchor = (AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom) tweetLabel.Parent = self
def newPanel(self, x, y): panel = Panel() panel.Width = 5120 panel.Height = 256*(len(self.roi_names)/2.) panel.Location = Point(x, y) panel.BorderStyle = BorderStyle.Fixed3D return panel
def initialiseButtons(self): buttonPanel = Panel() buttonPanel.Height = 23 buttonPanel.Dock = DockStyle.Bottom buttonPanel.Width = 170 acceptButton = Button() acceptButton.Text = "OK" acceptButton.DialogResult = DialogResult.OK acceptButton.Width = 75 acceptButton.Dock = DockStyle.Left self.AcceptButton = acceptButton buttonPanel.Controls.Add(acceptButton) cancelButton = Button() cancelButton.Text = "Cancel" cancelButton.DialogResult = DialogResult.Cancel cancelButton.Width = 75 cancelButton.Dock = DockStyle.Right self.CancelButton = cancelButton buttonPanel.Controls.Add(cancelButton) self.Controls.Add(buttonPanel)
def header(self, x, y): style = FontStyle.Bold levels_selected = '-' objects_selected = '-' self.sublabel = Label() self.sublabel.Text = "Number of Levels Selected: " + str( levels_selected) self.sublabel.Location = Point(x + 40, y + 10) self.sublabel.Width = width - 200 self.sublabel.Font = Font("Calibri Light", 12) #self.sublabel.ForeColor = Color.White #self.sublabel.ForeColor = Color.FromArgb(242, 112, 108) #self.sublabel.ForeColor = Color.Black self.sublabel_objects = Label() self.sublabel_objects.Text = "Number of Objects Current Selection: " + str( objects_selected) self.sublabel_objects.Location = Point(x + 40, y + 30) self.sublabel_objects.Width = width - 200 self.sublabel_objects.Font = Font("Calibri Light", 12) #self.sublabel_objects.ForeColor = Color.White self.sublabel_objects.ForeColor = Color.FromArgb(242, 112, 108) self.sublabel_objects.ForeColor = Color.Black self.sublabel_no_selection = Label() self.sublabel_no_selection.Text = "" self.sublabel_no_selection.Location = Point(x + 40, y + 50) self.sublabel_no_selection.Width = width - 200 self.sublabel_no_selection.Font = Font("Calibri Light", 12) #self.sublabel_no_selection.ForeColor = Color.White self.sublabel_no_selection.ForeColor = Color.FromArgb(242, 112, 108) self.sublabel_no_selection.ForeColor = Color.Black self.header = Panel() self.header.Width = width self.header.Height = 80 self.header.AutoSize = True self.header.Font = Font("Calibri", 12) self.header.Location = Point(x, y) self.header.BackColor = Color.FromArgb(145, 201, 213) self.header.Controls.Add(self.sublabel) self.header.Controls.Add(self.sublabel_objects) self.header.Controls.Add(self.sublabel_no_selection) self.header.AutoScroll = True return self.header
def header(self, x, y): style = FontStyle.Bold assembly_codes_selected = '-' objects_selected = '-' self.sublabel = Label() self.sublabel.Text = "ProjectBasePoint (E/W, N/S, Elev)" self.sublabel.Location = Point(x+40, y+10) self.sublabel.Width = width-200 self.sublabel.Font = Font("Calibri Light", 12) self.sublabel.Width = 400 #self.sublabel.ForeColor = Color.White self.sublabel.ForeColor = Color.Black self.sublabel_objects = Label() self.sublabel_objects.Text = "SharedBasePoint (E/W, N/S, Elev)" self.sublabel_objects.Location = Point(x+40, y+30) self.sublabel_objects.Width = width-200 self.sublabel_objects.Font = Font("Calibri Light", 12) self.sublabel_objects.Width = 400 #self.sublabel_objects.ForeColor = Color.White self.sublabel.ForeColor = Color.Black self.sublabel_no_selection = Label() self.sublabel_no_selection.Text = "" self.sublabel_no_selection.Location = Point(x+40, y+50) self.sublabel_no_selection.Width = width-200 self.sublabel_no_selection.Font = Font("Calibri Light", 12, style) #self.sublabel_no_selection.ForeColor = Color.White self.sublabel.ForeColor = Color.Black self.header = Panel() self.header.Width = width self.header.Height = 80 self.header.AutoSize = True self.header.Font = Font("Calibri", 12) self.header.Location = Point(x,y) #self.header.BackColor = Color.FromArgb(0, 0, 0) self.header.BackColor = Color.FromArgb(145, 201, 213) self.header.Controls.Add(self.sublabel) self.header.Controls.Add(self.sublabel_objects) self.header.Controls.Add(self.sublabel_no_selection) self.header.AutoScroll = True return self.header
def setupPanel2(self): self.panel2 = Panel() # self.panel2.Text = "Panel" self.panel2.Width = self.Width self.panel2.Height = 120 self.panel2.Location = Point(0, 120) self.panel2.BorderStyle = BorderStyle.FixedSingle self.p2title1 = Label() self.p2title1.Text = "Create Lumped Port" self.p2title1.Location = Point(25, 22) self.p2title1.Height = 25 self.p2title1.AutoSize = True self.p2label1 = Label() self.p2label1.Text = "Ground Metal Name: " self.p2label1.Location = Point(25, 50) self.p2label1.Height = 25 self.p2label1.Width = 150 self.p2button1 = Button() self.p2button1.Text = 'Create' self.p2button1.Location = Point(25, 75) self.p2button1.Width = 100 self.p2button1.Click += self.p2update self.p2button2 = Button() self.p2button2.Text = 'Reset' self.p2button2.Location = Point(180, 75) self.p2button2.Width = 100 self.p2button2.Click += self.p2reset self.p2list1 = ComboBox() self.p2list1.Text = '——Select' self.p2list1.Location = Point(180, 47) self.p2list1.Width = 100 self.p2list1.Height = 35 self.DropDownHeight = 50 self.p2list1.Click += self.p2listUpdate self.AcceptButton = self.p2button1 self.CancelButton = self.p2button2 self.panel2.Controls.Add(self.p2title1) self.panel2.Controls.Add(self.p2label1) self.panel2.Controls.Add(self.p2button1) self.panel2.Controls.Add(self.p2button2) self.panel2.Controls.Add(self.p2list1)
def setupPanel1(self): self.panel1 = Panel() self.panel1.Width = self.Width self.panel1.Height = 120 self.panel1.Location = Point(0, 0) self.panel1.BorderStyle = BorderStyle.FixedSingle self.title1 = Label() self.title1.Text = "ReAssign Terminal" self.title1.Location = Point(25, 22) self.title1.Height = 25 self.title1.AutoSize = True self.label2 = Label() self.label2.Text = "Ground Metal Name: " self.label2.Location = Point(25, 50) self.label2.Height = 25 self.label2.Width = 150 self.button1 = Button() self.button1.Text = 'Assign' self.button1.Location = Point(25, 75) self.button1.Width = 100 self.button1.Click += self.update self.button2 = Button() self.button2.Text = 'Reset' self.button2.Location = Point(180, 75) self.button2.Width = 100 self.button2.Click += self.reset self.list1 = ComboBox() self.list1.Text = '——Select' self.list1.Location = Point(180, 47) self.list1.Width = 100 self.list1.Height = 35 self.DropDownHeight = 50 self.list1.Click += self.listUpdate self.AcceptButton = self.button1 self.CancelButton = self.button2 self.panel1.Controls.Add(self.label2) self.panel1.Controls.Add(self.title1) self.panel1.Controls.Add(self.button1) self.panel1.Controls.Add(self.button2) self.panel1.Controls.Add(self.list1)
def header(self, x, y): style = FontStyle.Bold assembly_codes_selected = '-' objects_selected = '-' self.sublabel = Label() self.sublabel.Text = "Number of Assembly Codes Selected: " + str(assembly_codes_selected) self.sublabel.Location = Point(x+40, y+10) self.sublabel.Width = width-200 self.sublabel.Font = Font("Calibri Light", 12) self.sublabel.ForeColor = Color.White self.sublabel_objects = Label() self.sublabel_objects.Text = "Number of Objects Current Selection: " + str(objects_selected) self.sublabel_objects.Location = Point(x+40, y+30) self.sublabel_objects.Width = width-200 self.sublabel_objects.Font = Font("Calibri Light", 12) self.sublabel_objects.ForeColor = Color.White self.sublabel_no_selection = Label() self.sublabel_no_selection.Text = "" self.sublabel_no_selection.Location = Point(x+40, y+50) self.sublabel_no_selection.Width = width-200 self.sublabel_no_selection.Font = Font("Calibri Light", 12, style) self.sublabel_no_selection.ForeColor = Color.White self.header = Panel() self.header.Width = width self.header.Height = 80 self.header.AutoSize = True self.header.Font = Font("Calibri", 12) self.header.Location = Point(x,y) self.header.BackColor = Color.FromArgb(0, 0, 0) self.header.Controls.Add(self.sublabel) self.header.Controls.Add(self.sublabel_objects) self.header.Controls.Add(self.sublabel_no_selection) self.header.AutoScroll = True return self.header
def initHeaderForStatusPanel(self): self.headerStatusPanel = Panel() self.headerStatusPanel.BackColor = Color.White self.headerStatusPanel.Width = 310 self.headerStatusPanel.Height = 20 self.headerStatusPanel.Location = Point(0, 0) self.lblName = Label() self.lblName.Width = 70 self.lblName.Height = 20 self.lblName.Location = Point(6, 0) self.lblName.TextAlign = ContentAlignment.MiddleCenter self.lblName.Text = "Name" self.lblID = Label() self.lblID.Width = 70 self.lblID.Height = 20 self.lblID.Location = Point(82, 0) self.lblID.TextAlign = ContentAlignment.MiddleCenter self.lblID.Text = "ID" self.lblNumber = Label() self.lblNumber.Width = 70 self.lblNumber.Height = 20 self.lblNumber.Location = Point(158, 0) self.lblNumber.TextAlign = ContentAlignment.MiddleCenter self.lblNumber.Text = "Number" self.lblStatus = Label() self.lblStatus.Width = 70 self.lblStatus.Height = 20 self.lblStatus.Location = Point(225, 0) self.lblStatus.TextAlign = ContentAlignment.MiddleCenter self.lblStatus.Text = "Status" self.headerStatusPanel.Controls.Add(self.lblName) self.headerStatusPanel.Controls.Add(self.lblID) self.headerStatusPanel.Controls.Add(self.lblNumber) self.headerStatusPanel.Controls.Add(self.lblStatus)
def footer(self, x, y): button_width = (500/3)-6 self.button_filter_selection = Button() self.button_filter_selection.Text = 'Filter Selection' self.button_filter_selection.Location = Point(2*(button_width),0) self.button_filter_selection.Click += self.update self.button_filter_selection.Width = button_width self.button_filter_selection.Height = 50 self.button_clear_selection = Button() self.button_clear_selection.Text = 'Clear Selection' self.button_clear_selection.Location = Point(0,0) self.button_clear_selection.Width = button_width self.button_clear_selection.Height = 50 self.button_clear_selection.Font = Font("Calibri Light",12) self.button_clear_selection.Click += self.uncheck_checkboxes self.button_objects_without_code = Button() self.button_objects_without_code.Text = 'Objects Without Assembly Code' self.button_objects_without_code.Location = Point(button_width,0) self.button_objects_without_code.Width = button_width self.button_objects_without_code.Height = 50 self.button_objects_without_code.Click += self.check_pushbutton_empty_assembly_code self.footer = Panel() self.footer.Width = width-15 self.footer.Height = 50 self.footer.Font = Font("Calibri", 12) self.footer.Location = Point(x,y-50) #self.footer.BackColor = Color.FromArgb(232, 52, 38) self.footer.Controls.Add(self.button_filter_selection) self.footer.Controls.Add(self.button_clear_selection) self.footer.Controls.Add(self.button_objects_without_code) return self.footer
def initHeaderForDatabasePanel(self): self.headerDBPanel = Panel() self.headerDBPanel.BackColor = Color.White self.headerDBPanel.Width = 360 self.headerDBPanel.Height = 30 self.headerDBPanel.Location = Point(0, 0) self.lblName = Label() self.lblName.Width = 133 self.lblName.Height = 30 self.lblName.Location = Point(49, 0) self.lblName.TextAlign = ContentAlignment.MiddleCenter self.lblName.Text = "Name" self.lblID = Label() self.lblID.Width = 133 self.lblID.Height = 30 self.lblID.Location = Point(188, 0) self.lblID.TextAlign = ContentAlignment.MiddleCenter self.lblID.Text = "ID" self.headerDBPanel.Controls.Add(self.lblName) self.headerDBPanel.Controls.Add(self.lblID)
def panel(self, x, y): self.panel = Panel() self.panel.Width = width - 15 self.panel.Height = 800 self.panel.Location = Point(x, y) self.panel.BorderStyle = BorderStyle.Fixed3D self.panel.BackColor = Color.White self.panel.AutoScroll = True j = 30 for x in sorted_material_list: self.checkbox = Label() self.checkbox.Text = str(x.Name) self.checkbox.Location = Point(35, j) j += 25 self.checkbox.Width = width - 95 self.checkbox.Font = Font("Calibri Light", 10) self.panel.Controls.Add(self.checkbox) return self.panel
def panel(self, x, y): self.panel = Panel() self.panel.Width = width - 15 self.panel.Height = 800 self.panel.Location = Point(x, y) self.panel.BorderStyle = BorderStyle.Fixed3D self.panel.BackColor = Color.White self.panel.AutoScroll = True j = 30 for i in range(0, len(sorted_level_list)): self.checkbox = CheckBox() self.checkbox.Text = str(sorted_level_list[i]) self.checkbox.Location = Point(35, j) j += 25 self.checkbox.Width = width - 95 self.checkbox.Font = Font("Calibri Light", 10) self.panel.Controls.Add(self.checkbox) self.check_value.append(self.checkbox) return self.panel
def _layout(self): upperPanel = Panel() upperPanel.Top = self.menuStrip.Height + self.PADDING upperPanel.Left = self.PADDING upperPanel.Width = self.ClientSize.Width - (2 * self.PADDING) upperPanel.Anchor = (AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right) upperPanel.Controls.Add(self.postTextBox) upperPanel.Controls.Add(self.postButton) self.postTextBox.Left = 0 self.postTextBox.Top = 0 self.postTextBox.Width = (upperPanel.ClientSize.Width - self.postButton.Width - self.PADDING) self.postTextBox.Height *= 2 self.postTextBox.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right) self.postButton.Left = self.postTextBox.Width + self.PADDING self.postButton.Top = 0 self.postButton.Anchor = (AnchorStyles.Top | AnchorStyles.Right) upperPanel.Height = self.postTextBox.Height self.Controls.Add(upperPanel) lowerPanel = Panel() lowerPanel.Width = upperPanel.Width lowerPanel.Top = upperPanel.Top + upperPanel.Height + self.PADDING lowerPanel.Left = self.PADDING lowerPanel.Height = (self.ClientSize.Height - lowerPanel.Top - self.PADDING) lowerPanel.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom) self.friendsListBox.Top = 0 self.friendsListBox.Left = 0 self.friendsListBox.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom) self.friendsListBox.Height = lowerPanel.ClientSize.Height lowerPanel.Controls.Add(self.friendsListBox) self.tweetsPanel = Panel() self.tweetsPanel.BorderStyle = BorderStyle.FixedSingle self.tweetsPanel.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom) self.tweetsPanel.AutoScroll = True self.tweetsPanel.Top = 0 self.tweetsPanel.Left = self.friendsListBox.Width + self.PADDING self.tweetsPanel.Width = (lowerPanel.ClientSize.Width - self.tweetsPanel.Left) self.tweetsPanel.Height = lowerPanel.ClientSize.Height lowerPanel.Controls.Add(self.tweetsPanel) self.Controls.Add(lowerPanel)
def __init__(self, collectionsManager, moduleManager, currentCollection): Panel.__init__(self) self.collections = collectionsManager self.Dock = DockStyle.Fill self.Font = UIGlobal.normalFont # -- Collections and module lists self.collectionsList = CollectionsList() self.modulesList = CollectionsModuleList() self.currentCollection = currentCollection # -- Load the collections list self.itemToSetAsSelected = None for c in self.collections.Names(): item = self.collectionsList.AddCollection(c) if c == currentCollection: self.itemToSetAsSelected = item # -- Handlers self.collectionsList.SetSelectedHandler(self.__OnCollectionSelected) self.collectionsList.AfterLabelEdit += self.__OnCollectionRenamed # -- Modules list and info self.moduleBrowser = ModuleBrowser(moduleManager) self.moduleBrowser.SetActivatedHandler(self.__OnModuleActivated) # -- Toolbar self.toolbar = CollectionsToolbar() self.toolbar.ButtonClick += self.__ToolbarButtonHandler self.collectionsList.GotFocus += self.__ChangeOfFocusHandler self.collectionsList.LostFocus += self.__ChangeOfFocusHandler self.modulesList.GotFocus += self.__ChangeOfFocusHandler self.modulesList.LostFocus += self.__ChangeOfFocusHandler self.moduleBrowser.moduleTree.GotFocus += self.__ChangeOfFocusHandler self.moduleBrowser.moduleTree.LostFocus += self.__ChangeOfFocusHandler # -- Put it all together self.splitContainer1 = SplitContainer() self.splitContainer1.Dock = DockStyle.Fill self.splitContainer1.TabIndex = 1 self.splitContainer1.SplitterWidth = UIGlobal.SPLITTER_WIDTH self.splitContainer1.SplitterDistance = 50 self.splitContainer1.Orientation = Orientation.Vertical self.splitContainer1.Panel1.Controls.Add(self.collectionsList) self.splitContainer1.Panel2.Controls.Add(self.modulesList) self.collectionsTabPage = TabPage() self.collectionsTabPage.Controls.Add(self.splitContainer1) self.collectionsTabPage.Text = "Collections" self.collectionsTabControl = TabControl() self.collectionsTabControl.Dock = DockStyle.Fill self.collectionsTabControl.Alignment = TabAlignment.Left self.collectionsTabControl.TabStop = False self.collectionsTabControl.TabPages.Add(self.collectionsTabPage) self.modulesTabPage = TabPage() self.modulesTabPage.Controls.Add(self.moduleBrowser) self.modulesTabPage.Text = "Modules" self.modulesTabControl = TabControl() self.modulesTabControl.Dock = DockStyle.Fill self.modulesTabControl.Alignment = TabAlignment.Left self.modulesTabControl.TabStop = False self.modulesTabControl.TabPages.Add(self.modulesTabPage) self.splitContainer2 = SplitContainer() self.splitContainer2.Dock = DockStyle.Fill self.splitContainer2.TabIndex = 2 self.splitContainer2.SplitterWidth = UIGlobal.SPLITTER_WIDTH self.splitContainer2.SplitterDistance = 30 self.splitContainer2.Orientation = Orientation.Horizontal self.splitContainer2.Panel1.Controls.Add(self.collectionsTabControl) self.splitContainer2.Panel2.Controls.Add(self.modulesTabControl) ## Add the main SplitContainer control to the panel. self.Controls.Add(self.splitContainer2) self.Controls.Add(self.toolbar) # Last in takes space priority
from FileInterface import FileInterface LOGGER = create_logger('Viewport') FORMBOXES = {} FI = None LOGGER.info("Booting viewport.") window = Form() window.Text = "tagme" window.Name = "tagme" window.Size = Size(500, 300) window.FormBorderStyle = FormBorderStyle.FixedDialog # TOP LEVEL CONTROLS ################### LOAD_AREA = Panel() #LOAD_AREA.BorderStyle = BorderStyle.FixedSingle LOAD_AREA.Width = window.ClientRectangle.Width LOAD_AREA.Height = 20 LOAD_AREA.Dock = DockStyle.Top window.Controls.Add(LOAD_AREA) MUTATION_AREA = Panel() MUTATION_AREA.Width = LOAD_AREA.Width MUTATION_AREA.Height = LOAD_AREA.Height #MUTATION_AREA.BorderStyle = BorderStyle.FixedSingle MUTATION_AREA.Dock = DockStyle.Fill #MUTATION_AREA.BackColor = Color.Red window.Controls.Add(MUTATION_AREA) #########################################
def _layout(self): upperPanel = Panel() upperPanel.Top = self.menuStrip.Height + self.PADDING upperPanel.Left = self.PADDING upperPanel.Width = self.ClientSize.Width - (2 * self.PADDING) # Practical 1: add the Post button to the form's upper panel # Practical 2: uncomment each of the commented lines # below, and observe the effect of each on the application form # upperPanel.Anchor = (AnchorStyles.Left | # AnchorStyles.Top | # AnchorStyles.Right) upperPanel.Controls.Add(self.postTextBox) self.postTextBox.Left = 0 self.postTextBox.Top = 0 self.postTextBox.Width = (upperPanel.ClientSize.Width - # self.postButton.Width - self.PADDING) self.postTextBox.Height *= 2 # self.postTextBox.Anchor = (AnchorStyles.Top | # AnchorStyles.Left | # AnchorStyles.Right) # self.postButton.Left = self.postTextBox.Width + self.PADDING # self.postButton.Top = 0 # self.postButton.Anchor = (AnchorStyles.Top | # AnchorStyles.Right) upperPanel.Height = self.postTextBox.Height self.Controls.Add(upperPanel) lowerPanel = Panel() lowerPanel.Width = upperPanel.Width lowerPanel.Top = upperPanel.Top + upperPanel.Height + self.PADDING lowerPanel.Left = self.PADDING lowerPanel.Height = (self.ClientSize.Height - lowerPanel.Top - self.PADDING) lowerPanel.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom) self.friendsListBox.Top = 0 self.friendsListBox.Left = 0 self.friendsListBox.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom) self.friendsListBox.Height = lowerPanel.ClientSize.Height lowerPanel.Controls.Add(self.friendsListBox) self.tweetsPanel = Panel() self.tweetsPanel.BorderStyle = BorderStyle.FixedSingle self.tweetsPanel.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom) self.tweetsPanel.AutoScroll = True self.tweetsPanel.Top = 0 self.tweetsPanel.Left = self.friendsListBox.Width + self.PADDING self.tweetsPanel.Width = (lowerPanel.ClientSize.Width - self.tweetsPanel.Left) self.tweetsPanel.Height = lowerPanel.ClientSize.Height lowerPanel.Controls.Add(self.tweetsPanel) self.Controls.Add(lowerPanel)
def __init__(self, moduleManager, projectName, listOfModules, reloadFunction, progressFunction): Panel.__init__(self) self.Dock = DockStyle.Fill self.Font = UIGlobal.normalFont # -- Toolbar self.toolbar = self.__InitToolBar() self.__EditCollectionsHandler = None # -- Module list and Report window self.moduleManager = moduleManager self.projectName = projectName self.listOfModules = listOfModules self.reloadFunction = reloadFunction self.modulesList = UIModulesList.ModulesList(self.moduleManager, self.listOfModules) self.modulesList.SetActivatedHandler(self.RunOne) self.reportWindow = UIReport.ReportWindow() startupTips = [] if projectName: self.UpdateProjectName(projectName) else: msg = "Choose a project by clicking the Choose Project button in the toolbar." startupTips.append(msg) if not self.listOfModules: msg = "Choose or create a collection by clicking the collections button in the toolbar." startupTips.append(msg) for msg in startupTips: self.reportWindow.Report(msg) self.reportWindow.Report("Use the Run buttons to run modules.") if startupTips: self.startupTip = ToolTip() self.startupTip.IsBalloon = True self.startupTip.ToolTipTitle = "Getting started" self.startupTip.InitialDelay = 0 self.startupTip.AutoPopDelay = 20000 self.startupTip.SetToolTip(self.modulesList, "\n".join(startupTips)) else: self.startupTip = None self.reportWindow.Reporter.RegisterProgressHandler(progressFunction) # -- Put it all together self.splitContainer1 = SplitContainer() self.splitContainer1.Dock = DockStyle.Fill self.splitContainer1.TabIndex = 1 self.splitContainer1.SplitterWidth = UIGlobal.SPLITTER_WIDTH self.splitContainer1.SplitterDistance = 50 self.splitContainer1.Orientation = Orientation.Horizontal self.splitContainer1.Panel1.Controls.Add(self.modulesList) self.splitContainer1.Panel2.Controls.Add(self.reportWindow) ## Add the main SplitContainer control to the panel. self.Controls.Add(self.splitContainer1) self.Controls.Add(self.toolbar) # Last in takes space priority
def setupPanel3(self): self.panel3 = Panel() self.panel3.Width = self.Width self.panel3.Height = 125 self.panel3.Location = Point(0, 170) self.panel3.BorderStyle = BorderStyle.FixedSingle self.checkLabel1 = Label() self.checkLabel1.Text = "选择以下金属层材料进行创建:" self.checkLabel1.Location = Point(25, 25) self.checkLabel1.AutoSize = True self.P3button1 = Button() self.P3button1.Text = 'ok' self.P3button1.Location = Point(200, 20) self.P3button1.Width = 40 self.P3button1.Click += self.P3_update1 self.check1 = CheckBox() self.check1.Text = "M1" self.check1.Location = Point(25, 50) self.check1.Width = 90 self.check2 = CheckBox() self.check2.Text = "M2-8" self.check2.Location = Point(115, 50) self.check2.Width = 90 self.check3 = CheckBox() self.check3.Text = "M9" self.check3.Location = Point(205, 50) self.check3.Width = 90 self.check4 = CheckBox() self.check4.Text = "M10(UTM)" self.check4.Location = Point(295, 50) self.check4.Width = 90 self.check5 = CheckBox() self.check5.Text = "Via1-7" self.check5.Location = Point(25, 75) self.check5.Width = 90 self.check6 = CheckBox() self.check6.Text = "Via8" self.check6.Location = Point(115, 75) self.check6.Width = 90 self.check7 = CheckBox() self.check7.Text = "Via9" self.check7.Location = Point(205, 75) self.check7.Width = 90 self.check8 = CheckBox() self.check8.Text = "全选" self.check8.Location = Point(295, 75) self.check8.Width = 90 self.check8.CheckedChanged += self.P3C8_update self.panel3.Controls.Add(self.checkLabel1) self.panel3.Controls.Add(self.P3button1) self.panel3.Controls.Add(self.check1) self.panel3.Controls.Add(self.check2) self.panel3.Controls.Add(self.check3) self.panel3.Controls.Add(self.check4) self.panel3.Controls.Add(self.check5) self.panel3.Controls.Add(self.check6) self.panel3.Controls.Add(self.check7) self.panel3.Controls.Add(self.check8)
def __init__(self): #the __init__ method inside a class is its constructor self.Text = "AU London" #text that appears in the GUI titlebar self.Icon = Icon.FromHandle( icon.GetHicon() ) #takes a bitmap image and converts to a file that can be used as a Icon for the titlebar self.BackColor = Color.FromArgb(255, 255, 255) self.WindowState = FormWindowState.Normal # set maximised minimised or normal size GUI self.CenterToScreen() # centres GUI to the middle of your screen self.BringToFront() #brings the GUI to the front of all opens windows. self.Topmost = True # true to display the GUI infront of any other active forms screenSize = Screen.GetWorkingArea( self ) #get the size of the computers main screen, as the form will scale differently to different sized screens self.Width = screenSize.Width / 4 #set the size of the form based on the size of the users screen. this helps to ensure consistant look across different res screens. self.Height = screenSize.Height / 4 uiWidth = self.DisplayRectangle.Width #get the size of the form to use to scale form elements uiHeight = self.DisplayRectangle.Height self.FormBorderStyle = FormBorderStyle.FixedDialog # fixed dialog stops the user from adjusting the form size. Recomended disabling this when testing to see if elements are in the wrong place. self.userOutput = userOutputDefaultStr #create a container to store the output from the form self.runNextOutput = False #set these default values #############-------------\-------------############# spacing = 10 #spacing size for GUI elements to form a consistent border # creates the text box for a info message userMessage = Label() #label displays texts font = Font("Helvetica ", 10) userMessage.Text = message userMessage.Font = font userMessage.Location = Point( spacing, spacing ) #all location require a point object from system.Drawing to set the location. userMessage.Size = Size( uiWidth - (spacing * 2), (uiHeight / 4) ) #size the control with the width of the GUI to ensure it scales with different screen self.Controls.Add(userMessage) #this adds control element to the GUI #############-------------\-------------############# #logo file logo = PictureBox() logo.Image = logoFile ratio = float(logo.Height) / float( logo.Width ) #needs to be a float as int will round to the nearest whole number logo.Size = Size( uiWidth / 4, (uiHeight / 4) * ratio ) #scale the image by the ratio between the images height & width logo.Location = Point(spacing, (uiHeight - logo.Height) - spacing) logo.SizeMode = PictureBoxSizeMode.Zoom # zooms the image to fit the extent logo.Anchor = ( AnchorStyles.Bottom | AnchorStyles.Left ) #anchor styles lock elements to a given corner of the GUI if you allow users change size self.Controls.Add(logo) #logo.BorderStyle = BorderStyle.Fixed3D #gives a border to the panel to test its location #############-------------\-------------############# #combox drop down cBox = ComboBox() #dropdown control form cBox.Location = Point(spacing, uiHeight / 3) cBox.Width = uiWidth - (spacing * 2) cBox.Items.AddRange( listInput ) # Adds an array of items to the list of items for a ComboBox. cBox.DropDownStyle = ComboBoxStyle.DropDownList #setting to dropdown list prevents users from being able to add aditional text values cBox.SelectedIndexChanged += self.dropDownOutput #.Click+= registers the press of the button to register the event handler and determine what action takes place when button clicked self.Controls.Add(cBox) #############-------------\-------------############# #Create ok button btnOk = Button() #create a button control btnOk.Text = "Next" btnOk.Location = Point(uiWidth - ((btnOk.Width * 2) + spacing), uiHeight - (btnOk.Height + spacing)) btnOk.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right) btnOk.Click += self.okButtonPressed #Register the event on the button bress to trigger the def okButtonPressed self.Controls.Add(btnOk) #Create Cancel Button btnCancel = Button() #btnCancel.Parent = self btnCancel.Text = "Cancel" btnCancel.Location = Point(uiWidth - (btnOk.Width + spacing), uiHeight - (btnOk.Height + spacing)) btnCancel.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right) btnCancel.Click += self.CnlButtonPressed self.Controls.Add(btnCancel) #############-------------\-------------############# #Create a weblink helplink = LinkLabel() helplink.Text = "User Guide" helplink.Tag = linkaddress #tag is the web address helplink.Click += self.openLink #register click event with event handler helplink.Location = Point(uiWidth - ((btnOk.Width * 3) + spacing), uiHeight - (btnOk.Height + 5)) self.Controls.Add(helplink) helplink.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left) colourPanel = Panel() colourPanel.Height = cBox.Height + spacing #locate the panel behind the combo box. colourPanel.Width = uiWidth colourPanel.Location = Point(0, (uiHeight / 3) - 5) colourPanel.BorderStyle = BorderStyle.Fixed3D # graphical style to pronounce the edge of the panel colourPanel.BackColor = Color.FromArgb( 1, 125, 199) #set background colour by RGB value self.Controls.Add(colourPanel)
def __init__(self, moduleManager, dbName, listOfModules, reloadFunction, progressFunction): Panel.__init__(self) self.Dock = DockStyle.Fill self.Font = UIGlobal.normalFont # -- Toolbar self.toolbar = self.__InitToolBar() self.__EditCollectionsHandler = None # -- Module list and Report window self.moduleManager = moduleManager self.dbName = dbName self.listOfModules = listOfModules self.reloadFunction = reloadFunction self.modulesList = UIModulesList.ModulesList(self.moduleManager, self.listOfModules) self.modulesList.SetActivatedHandler(self.RunOne) self.reportWindow = UIReport.ReportWindow() startupTips = [] if dbName: self.UpdateDatabaseName(dbName) else: msg = "Choose a database by clicking the Choose Database button in the toolbar." startupTips.append(msg) if not self.listOfModules: msg = "Choose or create a collection by clicking the Collections button in the toolbar." startupTips.append(msg) for msg in startupTips: self.reportWindow.Report(msg) self.reportWindow.Report("Use the Run buttons to run Modules.") if startupTips: self.startupTip = ToolTip() self.startupTip.IsBalloon = True self.startupTip.ToolTipTitle = "Getting started" self.startupTip.InitialDelay = 0 self.startupTip.AutoPopDelay = 20000 self.startupTip.SetToolTip(self.modulesList, "\n".join(startupTips)) else: self.startupTip = None self.reportWindow.Reporter.RegisterProgressHandler(progressFunction) # -- Put it all together self.splitContainer1 = SplitContainer() self.splitContainer1.Dock = DockStyle.Fill self.splitContainer1.TabIndex = 1 self.splitContainer1.SplitterWidth = UIGlobal.SPLITTER_WIDTH self.splitContainer1.SplitterDistance = 50 self.splitContainer1.Orientation = Orientation.Horizontal self.splitContainer1.Panel1.Controls.Add(self.modulesList) self.splitContainer1.Panel2.Controls.Add(self.reportWindow) ## Add the main SplitContainer control to the panel. self.Controls.Add(self.splitContainer1) self.Controls.Add(self.toolbar) # Last in takes space priority
def __init__(self): self.Text = 'Player' self.Size = Size(350, 280) mainMenu = MainMenu() filem = mainMenu.MenuItems.Add("&File") playm = mainMenu.MenuItems.Add("&Play") view = mainMenu.MenuItems.Add("&View") tools = mainMenu.MenuItems.Add("&Tools") favourites = mainMenu.MenuItems.Add("&Favourites") help = mainMenu.MenuItems.Add("&Help") filem.MenuItems.Add(MenuItem("E&xit", self.OnExit, Shortcut.CtrlX)) self.Menu = mainMenu panel = Panel() panel.Parent = self panel.BackColor = Color.Black panel.Dock = DockStyle.Fill buttonPanel = Panel() buttonPanel.Parent = self buttonPanel.Height = 40 buttonPanel.Dock = DockStyle.Bottom pause = Button() pause.FlatStyle = FlatStyle.Popup pause.Parent = buttonPanel pause.Location = Point(5, 10) pause.Size = Size(25, 25) pause.Image = Bitmap("pause.png") play = Button() play.FlatStyle = FlatStyle.Popup play.Parent = buttonPanel play.Location = Point(35, 10) play.Size = Size(25, 25) play.Image = Bitmap("play.png") forward = Button() forward.FlatStyle = FlatStyle.Popup forward.Parent = buttonPanel forward.Location = Point(80, 10) forward.Size = Size(25, 25) forward.Image = Bitmap("forward.png") backward = Button() backward.FlatStyle = FlatStyle.Popup backward.Parent = buttonPanel backward.Location = Point(110, 10) backward.Size = Size(25, 25) backward.Image = Bitmap("backward.png") tb = TrackBar() tb.Parent = buttonPanel tb.TickStyle = TickStyle.None tb.Size = Size(150, 25) tb.Location = Point(200, 10) tb.Anchor = AnchorStyles.Right audio = Button() audio.FlatStyle = FlatStyle.Popup audio.Parent = buttonPanel audio.Size = Size(25, 25) audio.Image = Bitmap("audio.png") audio.Location = Point(170, 10) audio.Anchor = AnchorStyles.Right sb = StatusBar() sb.Parent = self sb.Text = "Ready" self.CenterToScreen()
def setupPanel1(self): #介质层BOX Panel self.panel1 = Panel() self.panel1.Text = "Media_Box Panel" self.panel1.Width = self.Width self.panel1.Height = 120 self.panel1.Location = Point(0, 50) self.panel1.BorderStyle = BorderStyle.FixedSingle self.label1 = Label() self.label1.Text = "介质层宽度(X轴):" self.label1.Location = Point(25, 25) self.label1.Height = 25 self.label1.Width = 150 self.label2 = Label() self.label2.Text = "介质层长度(Y轴):" self.label2.Location = Point(25, 50) self.label2.Height = 25 self.label2.Width = 150 self.textbox1 = TextBox() self.textbox1.Text = "0" self.textbox1.Location = Point(200, 22) self.textbox1.Width = 80 self.textbox2 = TextBox() self.textbox2.Text = "0" self.textbox2.Location = Point(200, 47) self.textbox2.Width = 80 self.button1 = Button() self.button1.Text = 'Create' self.button1.Location = Point(25, 75) self.button1.Width = 100 self.button1.Click += self.update self.button2 = Button() self.button2.Text = 'Reset' self.button2.Location = Point(180, 75) self.button2.Width = 100 self.button2.Click += self.reset self.AcceptButton = self.button1 self.CancelButton = self.button2 self.radio1 = RadioButton() self.radio1.Text = "mm" self.radio1.Location = Point(300, 50) self.radio1.Width = 35 self.radio1.CheckedChanged += self.checkedChanged self.radio2 = RadioButton() self.radio2.Text = "um" self.radio2.Location = Point(300, 25) self.radio2.Width = 35 self.radio2.Checked = True self.radio2.CheckedChanged += self.checkedChanged self.panel1.Controls.Add(self.label1) self.panel1.Controls.Add(self.label2) self.panel1.Controls.Add(self.textbox1) self.panel1.Controls.Add(self.textbox2) self.panel1.Controls.Add(self.button1) self.panel1.Controls.Add(self.button2) self.panel1.Controls.Add(self.radio1) self.panel1.Controls.Add(self.radio2)
def header(self, x, y): style = FontStyle.Bold fire_rating_selected = '-' objects_selected = '-' self.sublabel = Label() self.sublabel.Text = "Number of Fire Rating Selected: " + str( fire_rating_selected) self.sublabel.Location = Point(x + 40, y + 10) self.sublabel.Width = width - 200 self.sublabel.Font = Font("Calibri Light", 12) #self.sublabel.ForeColor = Color.White self.sublabel.ForeColor = Color.Black self.sublabel_objects = Label() self.sublabel_objects.Text = "Number of Objects Current Selection: " + str( objects_selected) self.sublabel_objects.Location = Point(x + 40, y + 30) self.sublabel_objects.Width = width - 200 self.sublabel_objects.Height = 20 self.sublabel_objects.Font = Font("Calibri Light", 12) #self.sublabel_objects.ForeColor = Color.White self.sublabel.ForeColor = Color.Black self.sublabel_no_selection = Label() self.sublabel_no_selection.Text = "Parameters shown below include type and instance" self.sublabel_no_selection.Location = Point(x + 40, y + 63) self.sublabel_no_selection.Width = width - 200 self.sublabel_no_selection.Font = Font("Calibri Light", 8) #self.sublabel_no_selection.ForeColor = Color.White self.sublabel.Height = 20 self.sublabel.ForeColor = Color.Black self.warning_label = Label() self.warning_label.Text = "Please be aware there is a distinction between the standard Revit Fire Rating parameter" self.warning_label.Font = Font("Calibri", 8) self.warning_label.Width = width self.warning_label.Height = 12 self.warning_label.Location = Point(x + 40, y + 40) self.warning_label.ForeColor = Color.Black self.warning_sublabel = Label() self.warning_sublabel.Text = "(with space) and the BuildingSmart definition FireRating parameter (without space)" self.warning_sublabel.Font = Font("Calibri", 8) self.warning_sublabel.Width = width self.warning_sublabel.Location = Point(x + 40, y + 50) self.header = Panel() self.header.Width = width self.header.Height = 80 self.header.AutoSize = True self.header.Font = Font("Calibri", 12) self.header.Location = Point(x, y) #self.header.BackColor = Color.FromArgb(0, 0, 0) self.header.BackColor = Color.FromArgb(145, 201, 213) self.header.Controls.Add(self.sublabel) #self.header.Controls.Add(self.sublabel_objects) self.header.Controls.Add(self.sublabel_no_selection) self.header.Controls.Add(self.warning_label) self.header.Controls.Add(self.warning_sublabel) #self.header.Controls.Add(self.warning_parameters) self.header.AutoScroll = True return self.header