def __init__(self, points, tol=0.1): super(Inspector, self).__init__() self.mouse = Mouse() self.points = points self.tol = tol self.dotcolor = Color.FromArgb(255, 0, 0) self.textcolor = Color.FromArgb(0, 0, 0)
def __init__(self, contents): self.Contents = contents self.BackColor = Color.FromArgb(25, 25, 25) self.ForeColor = Color.FromArgb(231, 231, 231) self.Size = Size(500, 400) self.Text = '{0} - v{1}'.format(self.ScriptName, self.CurVer) self.DataGridSetup() self.cbHide = CheckBox() self.cbHide.Text = 'Hide' self.cbHide.Checked = True self.cbHide.BackColor = Color.FromArgb(25, 25, 25) self.cbHide.Location = Point(342, 326) self.cbHide.Size = Size(50, 30) self.btnGet = Button() self.btnGet.Text = 'Get' self.btnGet.BackColor = Color.FromArgb(50, 50, 50) self.btnGet.Location = Point(422, 324) self.btnGet.Size = Size(50, 30) self.btnGet.FlatStyle = FlatStyle.Flat self.btnGet.FlatAppearance.BorderSize = 1 self.btnGet.Click += self.btnGetPressed self.Controls.Add(self.DataGrid) self.Controls.Add(self.cbHide) self.Controls.Add(self.btnGet)
def __init__(self, RB_print): self.RB_print = RB_print self.Text = 'RedBim' self.Name = 'RedBimPrinter' self.Height = 500 self.Width = 700 self.AutoScroll = True self.AutoScaleMode = AutoScaleMode.Font self.BackColor = Color.FromArgb(67, 67, 67) # self.BackgroundImage = Image.FromFile(os.path.join(STATIC_IMAGE, "bg.png")) # self.BackgroundImageLayout = ImageLayout.Center self.Icon = Icon(os.path.join(STATIC_IMAGE, "icon.ico"), 16, 16) self.StartPosition = FormStartPosition.CenterScreen self.label = Label() self.label.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right) self.label.BackColor = Color.FromArgb(0, 0, 0, 0) self.label.Font = Font("ISOCPEUR", 12, FontStyle.Italic) self.label.ForeColor = Color.White self.label.Location = Point(0, 0) self.label.Name = "text" self.label.Dock = DockStyle.Top self.label.AutoSize = True self.Controls.Add(self.label) self.label.Click += self.add_to_clipboard
def __init__(self, bag): self.SOSBag = bag self.MapCatalogue() self.BackColor = Color.FromArgb(25, 25, 25) self.ForeColor = Color.FromArgb(231, 231, 231) self.Size = Size(270, 444) self.Text = '{0} - v{1}'.format(self.ScriptName, self.CurVer) self.DataGridSetup() # used to reload SOSes to sort them in the new right order (by distance) self.btnReload = self.init_btn(2, 1, 'Reload', self.btnReloadPressed) # used to fish on the coordinates self.btnFish = self.init_btn(1, 1, 'Fish', self.btnFishPressed) # this types in the command for UO Enhanced Map self.btnMarker = self.init_btn(0, 1, 'Marker', self.btnMarkerPressed) # remove SOS from grid self.btnRemove = self.init_btn(2, 0, 'Remove', self.btnRemovePressed) # target a container to move the SOS into self.btnMove = self.init_btn(1, 0, 'Move', self.btnMovePressed) # open the SOS gump self.btnOpen = self.init_btn(0, 0, 'Open', self.btnOpenPressed) self.Controls.Add(self.DataGrid) self.Controls.Add(self.btnOpen) self.Controls.Add(self.btnMove) self.Controls.Add(self.btnRemove) self.Controls.Add(self.btnMarker) self.Controls.Add(self.btnFish) self.Controls.Add(self.btnReload) self.TopMost = True
def __init__(self, t1): self.Text = "SpringNodes: Expandable Watch Window" self.BackColor = Color.FromArgb(40, 40, 40) self.ControlBox = False self.TopMost = True self.FormBorderStyle = FormBorderStyle.Sizable self.StartPosition = FormStartPosition.CenterScreen self.Resize += self.resize1 self.text1 = None self.button1 = Button() self.button1.Text = 'Close' self.button1.Font = Font(IN[3], 10) self.button1.AutoSize = True self.button1.Width = 200 self.button1.ForeColor = Color.FromArgb(234, 234, 234) self.button1.Click += self.save self.Controls.Add(self.button1) self.box1 = RichTextBox() self.box1.Multiline = True self.box1.Location = Point(5, 5) self.box1.Font = Font(IN[3], 12) self.box1.BackColor = Color.FromArgb(53, 53, 53) self.box1.ForeColor = Color.FromArgb(234, 234, 234) self.box1.DetectUrls = True self.box1.Text = t1 self.Controls.Add(self.box1)
def init(self): # table table = make_table('main', False) table.Size = Size(580, 700) table.Location = Point(10, 10) table.ColumnCount = 2 table.Columns[0].Name = 'Key' table.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable table.Columns[0].ReadOnly = True table.Columns[0].DefaultCellStyle.SelectionBackColor = Color.FromArgb(238, 238, 238) table.Columns[0].DefaultCellStyle.BackColor = Color.FromArgb(238, 238, 238) table.Columns[1].Name = 'Value' table.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable keys = sorted(self.settings.keys()) for key in keys: table.Rows.Add(key, self.settings[key]) self.table = table # buttons ok = Button() ok.Text = 'OK' ok.DialogResult = DialogResult.OK cancel = Button() cancel.Text = 'Cancel' cancel.DialogResult = DialogResult.Cancel buttons = FlowLayoutPanel() buttons.FlowDirection = FlowDirection.RightToLeft # buttons.BorderStyle = BorderStyle.None buttons.Controls.Add(cancel) buttons.Controls.Add(ok) buttons.Size = Size(580, 30) buttons.Location = Point(10, 720) # layout self.ClientSize = Size(600, 800) self.Controls.Add(table) self.Controls.Add(buttons)
def __init__(self, network, tol=0.1): super(NetworkInspector, self).__init__() self.mouse = Mouse() self.network = network self.tol = tol self.dotcolor = Color.FromArgb(255, 0, 0) self.textcolor = Color.FromArgb(0, 0, 0)
def make_table(name, autosize=True): table = DataGridView() # allow user table.AllowUserToResizeColumns = False table.AllowUserToResizeRows = False table.AllowUserToAddRows = False table.AllowUserToDeleteRows = False # auto size table.AutoSize = autosize table.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill table.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells # back table.BackColor = Color.White table.BackgroundColor = Color.White # border table.BorderStyle = BorderStyle.None table.CellBorderStyle = DataGridViewCellBorderStyle.Single # column header table.ColumnHeadersVisible = True table.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb( 238, 238, 238) table.ColumnHeadersDefaultCellStyle.Font = Font(table.Font, FontStyle.Bold) table.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black table.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single # default cell table.DefaultCellStyle.SelectionBackColor = Color.White table.DefaultCellStyle.SelectionForeColor = Color.Black # dock if autosize: table.Dock = System.Windows.Forms.DockStyle.Fill # enable table.EnableHeadersVisualStyles = False # grid table.GridColor = Color.FromArgb(200, 200, 200) # select table.MultiSelect = False # name table.Name = name # row header table.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single table.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(240, 240, 240) table.RowHeadersDefaultCellStyle.ForeColor = Color.Empty table.RowHeadersDefaultCellStyle.SelectionBackColor = Color.Empty table.RowHeadersDefaultCellStyle.SelectionForeColor = Color.Empty table.RowHeadersVisible = False # scrolling # table.ScrollBars = ScrollBars.None # select table.SelectionMode = DataGridViewSelectionMode.FullRowSelect # top left header table.TopLeftHeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter return table
def setLayer(): # ---emblem if not rs.IsLayer("emblem"): ptsLayer = rs.AddLayer("emblem", Color.FromArgb(0, 0, 0), visible=True, locked=False, parent=None) # ---emblem.lineBlack if not rs.IsLayer("lineBlack"): ptsLayer = rs.AddLayer("lineBlack", Color.FromArgb(0, 0, 0), visible=True, locked=False, parent="emblem") # ---emblem.lineGray if not rs.IsLayer("lineGray"): ptsLayer = rs.AddLayer("lineGray", Color.FromArgb(200, 200, 200), visible=True, locked=False, parent="emblem") # ---emblem.rhomboidText if not rs.IsLayer("textRhomboid"): ptsLayer = rs.AddLayer("textRhomboid", Color.FromArgb(0, 0, 0), visible=True, locked=False, parent="emblem") # ---emblem.lineGray if not rs.IsLayer("srfRhomboid"): ptsLayer = rs.AddLayer("srfRhomboid", Color.FromArgb(200, 200, 200), visible=True, locked=False, parent="emblem") # ---emblem.line,srf for i in range(12): if not rs.IsLayer("line%s" % i): r = random.randint(0, 255) g = random.randint(0, 255) b = random.randint(0, 255) ptsLayer = rs.AddLayer("line%s" % i, Color.FromArgb(r, g, b), visible=True, locked=False, parent="emblem") ptsLayer = rs.AddLayer("srf%s" % i, Color.FromArgb(r, g, b), visible=True, locked=False, parent="emblem") # ---emblem.parallelLine.lineText if not rs.IsLayer("textLine"): ptsLayer = rs.AddLayer("textLine", Color.FromArgb(0, 0, 0), visible=True, locked=False, parent="emblem")
def change_view(self, value, is_bomb): if value != '0': self.Text = value else: self.Text = '' if is_bomb: self.BackColor = Color.FromArgb(250, 0, 0) else: self.BackColor = Color.FromArgb(192, 192, 192) self.Enabled = False self._checked = True self.FlatAppearance.BorderSize = 1 self.FlatAppearance.BorderColor = Color.FromArgb(128, 128, 128) self.FlatStyle = FlatStyle.Flat
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 DataGridSetup(self): self.DataGrid = DataGridView() self.DataGrid.RowHeadersVisible = False self.DataGrid.MultiSelect = False self.DataGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect self.DataGrid.BackgroundColor = Color.FromArgb(25, 25, 25) self.DataGrid.RowsDefaultCellStyle.BackColor = Color.Silver self.DataGrid.AlternatingRowsDefaultCellStyle.BackColor = Color.Gainsboro self.DataGrid.ForeColor = Color.FromArgb(25, 25, 25) self.DataGrid.Location = Point(20, 12) self.DataGrid.Size = Size(230, 306) self.DataGrid.DataSource = self.Data() self.DataGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells self.DataGrid.EditMode = DataGridViewEditMode.EditProgrammatically self.DataGrid.BorderStyle = BorderStyle.None
def color(*args): "accept : (gray), (gray,alphy), (r,g,b), (r,g,b,a)\ return : Color" length = len(args) if length == 1: if isinstance(args[0],Color): return args[0] else: return Color.FromArgb(args[0],args[0],args[0]) elif length == 2: return Color.FromArgb(args[1],args[0],args[0],args[0]) elif length == 3: return Color.FromArgb(*args) elif length == 4: return Color.FromArgb(args[3],args[0],args[1],args[2])
def __init__(self, origin=[0, 0, 0]): self._location = rg.Plane.WorldXY self._penDown = True self._lineweight = 0 self._color = Color.FromArgb(0, 0, 0) #self._shape = rs.AddSphere(self._location.Origin, 2) self._shape = rs.GetObject("Select the turtle")
def randomcolor(): red = int(255*random.random()) green = int(255*random.random()) blue = int(255*random.random()) return Color.FromArgb(red,green,blue)
def init(self): self.ClientSize = Size(820, 620) charting = Charting chart = charting.Chart() chart.Location = Point(10, 10) chart.Size = Size(800, 600) chart.ChartAreas.Add('iterations') area = chart.ChartAreas['iterations'] x = area.AxisX x.Minimum = self.xmin x.Maximum = self.xmax x.Interval = self.xstp x.MajorGrid.LineColor = Color.White x.MajorGrid.LineDashStyle = charting.ChartDashStyle.NotSet y = area.AxisY y.Minimum = self.ymin y.Maximum = self.ymax y.Interval = self.ystp y.MajorGrid.LineColor = Color.Black y.MajorGrid.LineDashStyle = charting.ChartDashStyle.Dash for name, attr in self.series.iteritems(): color = attr['color'] linewidth = attr['linewidth'] chart.Series.Add(name) series = chart.Series[name] series.ChartType = charting.SeriesChartType.Line series.Color = Color.FromArgb(*color) series.BorderWidth = linewidth keys = sorted(attr['data'].keys(), key=int) for key in keys: value = attr['data'][key] series.Points.AddXY(int(key), value) area.BackColor = Color.White self.Controls.Add(chart)
def merge(ndoc, odoc, opts={}): if opts.get('flip'): bbox = get_global_extremas(ndoc) flip_cad(odoc, bbox, opts['flip']) # create a single layer nlayer = Layer() if 'layer_name' in opts: nlayer.Name = opts['layer_name'] if 'layer_color' in opts: nlayer.Color = Color.FromArgb(*opts['layer_color']) ndoc.Layers.Add(nlayer) idmap = {} # copy cad data for layer in odoc.Layers: for e in layer.Entities: ne = e.Clone() nlayer.Entities.Add(ne) idmap[e.ID] = ne.ID # create a single part npart = CAMPart() if 'part_name' in opts: npart.Name = opts['part_name'] ndoc.Parts.Add(npart) # copy cam data for part in odoc.Parts: for mop in part.MachineOps: m = mop.Clone() # remap mop.PrimitiveIds = List[int]( [idmap[pid] for pid in mop.PrimitiveIds]).ToArray() npart.MachineOps.Add(mop)
def RGB(r, g, b): import clr clr.AddReference("System.Drawing") from System.Drawing import Color, ColorTranslator ourColor = Color.FromArgb(r, g, b) return ColorTranslator.ToOle(ourColor)
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
def draw_cloud(self, colormap='viridis', points=None): """Returns the points and colors to create a point cloud. The colors are calculated on the score at the respective frame. If the frames are a 2D list, the point of the first frame of the list is used. Parameters ---------- colormap : str, optional The colormap for the point cloud. points : list of :class:`compas.geometry.Points`, optional Points to override the points from the reachability map. """ from System.Drawing import Color points = points or self.reachability_map.points xpoints = [PrimitiveArtist(pt).draw() for pt in points] colors = [] cmap = ColorMap.from_mpl(colormap) score = self.reachability_map.score minv, maxv = min(score), max(score) for num in score: color = cmap(num, minv, maxv) r, g, b, a = color.rgba255 rcolor = Color.FromArgb(a, r, g, b) colors.append(rcolor) return xpoints, colors
def LoadRecord(self, sender, e): rbd = RowBorderDecoration() rbd.BorderPen = Pen(Color.FromArgb(128, Color.LightSeaGreen), 2) rbd.BoundsPadding = Size(1, 1) rbd.CornerRounding = 4.0 self._objectListView1.FullRowSelect = True self._objectListView1.minimumWidth = 100 datag = self.create_interval_record_table() for data in Database.user.all(): datag.Rows.Add(data.user_id, data.username, data.firstname, data.lastname) #self._dataGrid1.DataSource = datag.DefaultView self._objectListView1.DataSource = datag.DefaultView self._objectListView1.UseCustomSelectionColors = True self._objectListView1.AlternateRowBackColor = System.Drawing.Color.Green self._objectListView1.HighlightBackgroundColor = System.Drawing.Color.Orange #for col in self._objectListView1.Columns: # col.Width = 100 self._objectListView1.Columns[0].Width = 70 self._objectListView1.Columns[1].Width = 100 self._objectListView1.Columns[2].Width = 100 self._objectListView1.Columns[3].Width = 100 self._objectListView1.SelectionChanged += self.MouseUp #self._objectListView1.HotItemStyle = HotItemStyle() #self._objectListView1.Decoration = rbd; self._objectListView1.Refresh()
def init(self): # tabs tabs = TabControl() tabs.Size = Size(580, 700) tabs.Location = Point(10, 10) # buttons ok = Button() ok.Text = 'OK' ok.DialogResult = DialogResult.OK cancel = Button() cancel.Text = 'Cancel' cancel.DialogResult = DialogResult.Cancel buttons = FlowLayoutPanel() buttons.FlowDirection = FlowDirection.RightToLeft buttons.BorderStyle = BorderStyle.None buttons.Controls.Add(cancel) buttons.Controls.Add(ok) buttons.Size = Size(580, 30) buttons.Location = Point(10, 720) self.ClientSize = Size(600, 800) self.Controls.Add(tabs) self.Controls.Add(buttons) # pages and tables index = 0 for name in self.settings: page = make_page(name, name, index) page.TabIndex = index settings = self.settings[name] table = make_table(name) table.ColumnCount = 2 table.Columns[0].Name = 'Key' table.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable table.Columns[0].ReadOnly = True table.Columns[ 0].DefaultCellStyle.SelectionBackColor = Color.FromArgb( 238, 238, 238) table.Columns[0].DefaultCellStyle.BackColor = Color.FromArgb( 238, 238, 238) table.Columns[1].Name = 'Value' table.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable keys = sorted(settings.keys()) for key in keys: table.Rows.Add(key, settings[key]) page.Controls.Add(table) tabs.Controls.Add(page) self.tables[name] = table index += 1
def main(): assert hasattr(_solution, 'residualFile'), \ '{} is not a valid Solution.'.format(_solution) p = ResidualParser(_solution.residualFile) if not _fields_: try: fields = _solution.residualFields except: raise ValueError('Failed to load fields from solution {}.'.format(_solution)) else: fields = _fields_ for f in fields: print f timeRange = '{} To {}'.format(*p.timeRange) # calculate curves crvs = tuple(rc.Geometry.PolylineCurve(rc.Geometry.Point3d(c, float(i), 0) for c, i in enumerate(p.getResiduals(field, timeRange_))) for field in fields) # find bounding box for curves bbox = crvs[0].GetBoundingBox(True) for crv in crvs[1:]: bbox = rc.Geometry.BoundingBox.Union(bbox, crv.GetBoundingBox(True)) # create residual line startPt = rc.Geometry.Point3d(0, _targetRes_, 0) length = bbox.Max[0] - bbox.Min[0] resLine = rc.Geometry.Line(startPt, rc.Geometry.Vector3d(length, 0, 0)).ToNurbsCurve() bbox = rc.Geometry.BoundingBox.Union(bbox, resLine.GetBoundingBox(True)) # scale curves curves = rectToRectMapping(crvs, rectFromBoundingBox(bbox), rectFromBoundingBox(_rect.GetBoundingBox(True))) resLine = rectToRectMapping((resLine,), rectFromBoundingBox(bbox), rectFromBoundingBox(_rect.GetBoundingBox(True))) # create colored meshes cs3 = ((102,194,165), (252,141,98), (141,160,203), (231,138,195), (166,216,84), (255,217,47), (229,196,148)) colors = tuple(Color.FromArgb(*rgb) for rgb in cs3) if method_ % 2: residualLine = coloredMeshFromCurve(resLine, width=_lineWidth_, colors=[Color.Black]) meshes = coloredMeshFromCurve(curves, width=_lineWidth_, colors= colors) return timeRange, curves, meshes, residualLine, colors[:len(curves)] return timeRange, curves, [], resLine, colors[:len(curves)]
def init(self): # table table = make_table('main', False) table.Size = Size(980, 700) table.Location = Point(10, 10) table.ColumnCount = len(self.names) + 1 table.Columns[0].Name = 'Key' table.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable table.Columns[0].ReadOnly = True table.Columns[0].DefaultCellStyle.SelectionBackColor = Color.FromArgb( 238, 238, 238) table.Columns[0].DefaultCellStyle.BackColor = Color.FromArgb( 238, 238, 238) for i in range(len(self.names)): column = table.Columns[i + 1] column.Name = self.names[i] column.SortMode = DataGridViewColumnSortMode.NotSortable if self.types: if self.types[i] == 'f': column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill else: column.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells keys = sorted(self.attributes.keys(), key=int) for key in keys: values = [self.attributes[key][name] for name in self.names] objects = [key] + values table.Rows.Add(*objects) self.table = table # buttons ok = Button() ok.Text = 'OK' ok.DialogResult = DialogResult.OK cancel = Button() cancel.Text = 'Cancel' cancel.DialogResult = DialogResult.Cancel buttons = FlowLayoutPanel() buttons.FlowDirection = FlowDirection.RightToLeft # buttons.BorderStyle = BorderStyle.None buttons.Controls.Add(cancel) buttons.Controls.Add(ok) buttons.Size = Size(980, 30) buttons.Location = Point(10, 720) # layout self.ClientSize = Size(1000, 800) self.Controls.Add(table) self.Controls.Add(buttons)
def _add_frames_layer(): layer_name = f.Frame.layer_name dark_gray = Color.FromArgb(105, 105, 105) rs.AddLayer(layer_name, dark_gray) layer_name_list_name = l.Layer.layer_name_list_name layer_name = f.Frame.layer_name layer_value = ll.Llist.dummy_value rs.SetDocumentData(layer_name_list_name, layer_name, layer_value)
def colorTocolor(colors): """Convert a ladybug color into Dynamo color.""" if not hasattr(colors, '__iter__'): colors = (colors, ) try: return tuple( Color.FromArgb(255, col.r, col.g, col.b) for col in colors) except AttributeError as e: raise AttributeError('Inputs must be of type of Color:\n{}'.format(e))
def RGB(r, g, b): """Convert RGB values to ColorTranslator value for PowerPoint.""" import clr clr.AddReference("System.Drawing") from System.Drawing import Color, ColorTranslator ourColor = Color.FromArgb(r, g, b) return ColorTranslator.ToOle(ourColor)
def __init__(self, slider): super(Pipe, self).__init__() self.slider = slider self.base = Point3d(0, 0, 0) self.normal = Point3d(0, 0, 1) - self.base self.height = 30 self.plane = Plane(self.base, self.normal) self.color = Color.FromArgb(255, 0, 0) self.material = DisplayMaterial(self.color)
def init_btn(self, x, y, text, handler): btn = Button() btn.Text = text btn.BackColor = Color.FromArgb(50, 50, 50) btn.Location = self.btn_pos(x, y) btn.Size = Size(60, 30) btn.FlatStyle = FlatStyle.Flat btn.FlatAppearance.BorderSize = 1 btn.Click += handler return btn
def color_to_color(color, alpha=255): """Convert a ladybug color into .NET color. Args: alpha: Optional integer betwen 1 and 255 for the alpha value of the color. """ try: return Color.FromArgb(alpha, color.r, color.g, color.b) except AttributeError as e: raise AttributeError('Input must be of type of Color:\n{}'.format(e))