public void AddButton(MainApp ma){ Button b = new Button(); b.Text = "C# Rocks"; b.Click += ma.ButtonClickHandler; _panel.SuspendLayout(); _panel.Controls.Add(b); _panel.ResumeLayout(); }
void LoopThroughFlyContentItems(Action <Views.UserControls.BeanUI> action) { flyContent.SuspendLayout(); var controls = flyContent.Controls.OfType <Views.UserControls.BeanUI>().ToList(); foreach (Views.UserControls.BeanUI control in controls) { action(control); } flyContent.ResumeLayout(); }
/// <summary> /// Rebuilds all the controls in panel Strategy /// </summary> public void RebuildStrategyControls(Strategy strategy) { this.strategy = strategy; slots = strategy.Slots; flowLayoutStrategy.SuspendLayout(); flowLayoutStrategy.Controls.Clear(); InitializeStrategySlots(); ArrangeStrategyControls(); SetAddSlotButtons(); flowLayoutStrategy.ResumeLayout(); }
public void RemoveAllServersConrol() { Action worker = () => { var controlList = GetAllServerControls(); flyPanel.SuspendLayout(); flyPanel.Controls.Clear(); flyPanel.ResumeLayout(); VgcApis.Misc.Utils.RunInBackground( () => DisposeFlyPanelControlByList(controlList)); }; VgcApis.Misc.UI.Invoke(worker); }
/// <summary> /// Rebuilds all the controls in panel Strategy /// </summary> public void RebuildStrategyControls(Strategy newStrategy) { strategy = newStrategy; slots = newStrategy.Slots; pnlStrategy.SuspendLayout(); pnlStrategy.Controls.Clear(); InitializeStrategySlots(); ArrangeStrategyControls(); if (ShowAddSlotButtons) { SetAddSlotButtons(); } pnlStrategy.ResumeLayout(); }
public static FlowLayoutPanel RadioButtonFlow(IXsdPart part, string defaultSelected = "", ToolTip tooltip = null) { try { if (String.IsNullOrWhiteSpace(part.Name)) { throw new ArgumentNullException(); } var panel = Container(part, tooltip); panel.SuspendLayout(); var container = new FlowLayoutPanel(); container.SuspendLayout(); container.FlowDirection = FlowDirection.LeftToRight; container.AutoSize = true; container.Font = Methods.BaseFont; container.Name = "container" + part.Name; container.Size = new System.Drawing.Size(208, 53); //true false string selected = !String.IsNullOrWhiteSpace(part.Value) ? part.Value : defaultSelected; container.Controls.Add(Controls.RadioButton(part, "True", selected, tooltip)); container.Controls.Add(Controls.RadioButton(part, "False", selected, tooltip)); container.ResumeLayout(); panel.Controls.Add(container); panel.ResumeLayout(); return(panel); } catch (Exception ex) { log.Debug(ex); return(null); } }
private FlowLayoutPanel CreateButtons(EntrySettings settings) { var flow = new FlowLayoutPanel(); flow.Width = this.notesCtrl.Width + 10; flow.Height = 50; flow.AutoSize = false; flow.FlowDirection = FlowDirection.LeftToRight; flow.WrapContents = true; flow.Margin = new Padding(0); int index = 0; foreach (var entry in settings.entries) { flow.Controls.Add(CreateSSHButton(index, entry.title)); index += 1; } var btnAdd = CreateNormalButton("Add"); btnAdd.Click += OnAddButtonClick; flow.Controls.Add(btnAdd); flow.ResumeLayout(false); flow.PerformLayout(); return(flow); }
private void UpdateNavBar() { _pNavBar.SuspendLayout(); _pNavBar.Controls.Clear(); if (manager.DrillDownLevel > 0) { for (int i = 0; i < _paths.Count; i++) { var path = _paths.ElementAt(i); if (i == _paths.Count - 1) { AddToNavBar(typeof(Label), path.Value); AddToNavBar(typeof(Label), "-"); } else { AddToNavBar(typeof(LinkLabel), path.Value, path.Key); AddToNavBar(typeof(Label), "\\"); } } } string tail = null; string aggregate = manager.AggregateType.ToString(); string currentPath = manager.GroupNames[manager.DrillDownLevel]; tail = string.Format("{0} By {1}", aggregate, currentPath); AddToNavBar(typeof(Label), tail); _pNavBar.ResumeLayout(); }
/// <summary> /// TODO /// </summary> /// <param name="panel"></param> /// <param name="showAll"></param> private void RunPanel(FlowLayoutPanel panel, Label divider, bool showAll) { panel.SuspendLayout(); var hiddenCount = 0; foreach (Control c in panel.Controls) { if (!(c is CheckBox cBox)) { continue; } if (!showAll) { if (cBox.Checked) { continue; } cBox.Visible = false; hiddenCount++; } else { cBox.Visible = true; } } divider.Visible = hiddenCount != panel.Controls.Count - 1; panel.ResumeLayout(); panel.Update(); }
private void InitializeComponent() { components = new Container(); panel1 = new FlowLayoutPanel(); picker1 = new DateTimePicker(); monthCal1 = new MonthCalendar(); // panel1 panel1.SuspendLayout(); panel1.FlowDirection = FlowDirection.TopDown; panel1.AutoSize = true; panel1.BorderStyle = BorderStyle.FixedSingle; panel1.Dock = DockStyle.Fill; panel1.Location = new Point(6, 6); panel1.Name = "panel1"; panel1.Padding = new Padding(1); panel1.Size = new Size(600, 249); panel1.TabIndex = 0; // picker1 picker1.AutoSize = true; picker1.Size = new Size(180, 27); picker1.ShowUpDown = false; picker1.Format = DateTimePickerFormat.Short; picker1.DropDownAlign = LeftRightAlignment.Left; //monthCal1 monthCal1.AutoSize = true; monthCal1.Size = new Size(100, 27); monthCal1.Padding = new Padding(2); monthCal1.CalendarDimensions = new Size(1, 1); monthCal1.MaxSelectionCount = 1; monthCal1.Margin = Padding.Empty; monthCal1.MaxSelectionCount = 10; //monthCal1.Font = calendarFont; //monthCal1.BackColor = monthCalendar.BackColor = calendarBackColor; //monthCal1.TitleBackColor = calendarTitleBackColor; //monthCal1.TitleForeColor = calendarTitleForeColor; //monthCal1.TrailingForeColor = calendarTrailingForeColor; panel1.Controls.Add(picker1); panel1.Controls.Add(monthCal1); // DateTimeForm MinimumSize = new Size(100, 100); AutoScaleDimensions = new SizeF(96F, 96F); AutoScaleMode = AutoScaleMode.Dpi; ClientSize = new Size(480, 320); Controls.Add(panel1); FormBorderStyle = FormBorderStyle.Sizable; SizeGripStyle = SizeGripStyle.Show; Name = "DateTimeForm"; Padding = new Padding(6); Text = "DateTimeForm"; panel1.ResumeLayout(true); ResumeLayout(false); PerformLayout(); }
/// <summary> /// Applies the search filter to the list of tiles. Should be called after the filter was changed. /// </summary> protected virtual void RefilterTiles() { _scrollPanel.SuspendLayout(); _flowLayout.SuspendLayout(); bool needsRecolor = false; foreach (var tile in _tileDictionary.Values) { // Check if new filter changes visibility bool shouldBeVisible = tile.AppName.ContainsIgnoreCase(TextSearch.Text); if (tile.Visible != shouldBeVisible) { // Update list length if (shouldBeVisible) _flowLayout.Height += tile.Height; else _flowLayout.Height -= tile.Height; tile.Visible = shouldBeVisible; needsRecolor = true; } } if (needsRecolor) RecolorTiles(); _scrollPanel.ResumeLayout(); _flowLayout.ResumeLayout(); }
public void InitializeComponents(MainApp ma) { _flowLayoutPanel = new FlowLayoutPanel(); _flowLayoutPanel.SuspendLayout(); _flowLayoutPanel.Height = 56; _flowLayoutPanel.Width = 20; _flowLayoutPanel.AutoSize = true; _flowLayoutPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink; _flowLayoutPanel.WrapContents = true; _flowLayoutPanel.Dock = DockStyle.Top; _tb1 = new TextBox(); _tb1.Multiline = true; _tb1.Height = 150; _tb1.Width = 200; _tb1.DoubleClick += ma.DoubleClickHandler; _tb2 = new TextBox(); _flowLayoutPanel.Controls.Add(_tb1); _flowLayoutPanel.Controls.Add(_tb2); this.SuspendLayout(); this.Controls.Add(_flowLayoutPanel); _flowLayoutPanel.ResumeLayout(); this.ResumeLayout(); }
public static Size MeasureFlowLayout(FlowLayoutPanel panel) { panel.ResumeLayout(false); panel.PerformLayout(); var count = panel.Controls.Count; Control lastItem; if (count != 0) { switch (panel.FlowDirection) { case FlowDirection.TopDown: case FlowDirection.BottomUp: lastItem = panel.Controls[count - 1]; return(new Size(panel.Width, lastItem.Location.Y + lastItem.Height)); case FlowDirection.LeftToRight: case FlowDirection.RightToLeft: lastItem = panel.Controls[count - 1]; return(new Size(lastItem.Location.X + lastItem.Width, panel.Height)); } } return(new Size(panel.Width, panel.Height)); }
public void Notify(string text, Schedule record) { Show(); foreach (Control ctrl in fLayoutPanel.Controls) { if (ctrl.Tag == record) { return; } } fLayoutPanel.SuspendLayout(); var lbl = new Label(); lbl.BorderStyle = BorderStyle.FixedSingle; lbl.TextAlign = ContentAlignment.MiddleCenter; lbl.Margin = new Padding(0, 0, 0, LayoutPadding); lbl.Dock = DockStyle.Top; lbl.Anchor = AnchorStyles.Left; lbl.Text = text; lbl.Tag = record; lbl.Font = fTextFont; lbl.Width = fLayoutPanel.ClientSize.Width - LayoutPadding * 2; lbl.Click += Label_Click; fLayoutPanel.Controls.Add(lbl); fLayoutPanel.ResumeLayout(); }
private void CreateUI() { var fp = new FlowLayoutPanel(); fp.SuspendLayout(); SuspendLayout(); foreach (var entry in config.Entries) { var button = new Button { Text = entry.Description, Width = config.ButtonWidth, Height = config.ButtonHeight, Tag = entry.Name }; button.Click += Button_Click; buttons.Add(button); } fp.Controls.AddRange(buttons.ToArray()); fp.Dock = DockStyle.Fill; Icon = IconExtractor.Extract("shell32.dll", 9, true); Location = Properties.Settings.Default.WindowLocation; Size = Properties.Settings.Default.WindowSize; Controls.Add(fp); fp.ResumeLayout(false); ResumeLayout(false); }
// Populates FlowLayoutPanel with given values private void UpdateFlowPanel(FlowLayoutPanel flowPanel, string[] listOfValues) { flowPanel.SuspendLayout(); flowPanel.Controls.Clear(); if (listOfValues != null) { foreach (string s in listOfValues) { Label label = new Label(); //label.AutoSize = true; // label.Name = "label"; label.AutoEllipsis = true; // Highlight every other row of labels if (flowPanel.Controls.Count != 0 && flowPanel.Controls[flowPanel.Controls.Count - 1].BackColor != _labelColor) { label.BackColor = _labelColor; } label.Size = new Size(flowPanel.ClientSize.Width - label.Margin.Horizontal, 17); label.TabIndex = flowPanel.Controls.Count; label.Text = s; label.TextAlign = ContentAlignment.MiddleLeft; flowPanel.Controls.Add(label); } } flowPanel.ResumeLayout(); //if (flowPanel.Parent != null) // flowPanel.Parent.Update(); //else // flowPanel.Update(); }
private void InitializeComponents(MainApp ma){ MenuStrip ms = new MenuStrip(); ToolStripMenuItem addMenu = new ToolStripMenuItem("Add"); ToolStripMenuItem addButtonItem = new ToolStripMenuItem("Button", null, ma.AddButtonItemHandler); ToolStripMenuItem addTextBoxItem = new ToolStripMenuItem("TextBox", null, ma.AddTextBoxItemHandler); ToolStripMenuItem addExitItem = new ToolStripMenuItem("Exit", null, ma.AddExitItemHandler); addMenu.DropDownItems.Add(addButtonItem); addMenu.DropDownItems.Add(addTextBoxItem); addMenu.DropDownItems.Add("-"); // <---- use a dash to add menu item separators addMenu.DropDownItems.Add(addExitItem); ms.Items.Add(addMenu); ms.Dock = DockStyle.Top; this.MainMenuStrip = ms; _panel = new FlowLayoutPanel(); _panel.SuspendLayout(); _panel.AutoSize = true; _panel.AutoSizeMode = AutoSizeMode.GrowAndShrink; _panel.WrapContents = true; _panel.Dock = DockStyle.Fill; //_panel.BackColor = Color.Blue; this.SuspendLayout(); this.Controls.Add(_panel); this.Controls.Add(ms); // IMPORTANT: Add the MenuStrip last!! _panel.ResumeLayout(); this.ResumeLayout(); }
Panel CreateTabPanel(GuiLayout gl) { Panel pnl = new Panel(); pnl.SuspendLayout(); pnl.Dock = DockStyle.Fill; FlowLayoutPanel flp = new FlowLayoutPanel(); flp.SuspendLayout(); flp.Dock = DockStyle.Top; flp.FlowDirection = FlowDirection.LeftToRight; flp.Size = new Size(50, 50); flp.BackColor = Color.Aqua; foreach (GuiLayout subgl in gl.subLayouts) { Control ctl = null; if (subgl.type == GuiLayout.LayoutType.TabItem) { ctl = CreateTabItem(subgl, flp); } if (ctl != null) { pnl.Controls.Add(ctl); } } FillCommonLayoutParameters(gl, pnl); pnl.Controls.Add(flp); flp.ResumeLayout(); pnl.BackColor = Color.Bisque; return(pnl); }
private void UpdateFlowPanel(FlowLayoutPanel flowPanel, string[] listOfValues) { flowPanel.SuspendLayout(); flowPanel.Controls.Clear(); if (listOfValues != null) { foreach (var s in listOfValues) { var label = new Label(); label.AutoEllipsis = true; if (flowPanel.Controls.Count != 0 && flowPanel.Controls[flowPanel.Controls.Count - 1].BackColor != _labelColor) { label.BackColor = _labelColor; } label.Size = new Size(flowPanel.ClientSize.Width - label.Margin.Horizontal, 17); label.TabIndex = flowPanel.Controls.Count; label.Text = s; label.TextAlign = ContentAlignment.MiddleLeft; flowPanel.Controls.Add(label); } } flowPanel.ResumeLayout(); }
/// <summary> /// Arranges the indicators in the layout. /// </summary> private void ArrangeIndicatorsSlots() { var currentIndicators = new List <string>(); switch (currentSlotType) { case SlotTypes.Open: currentIndicators = IndicatorManager.OpenPointIndicators; break; case SlotTypes.OpenFilter: currentIndicators = IndicatorManager.OpenFilterIndicators; break; case SlotTypes.Close: currentIndicators = IndicatorManager.ClosePointIndicators; break; case SlotTypes.CloseFilter: currentIndicators = IndicatorManager.CloseFilterIndicators; break; } flowLayoutIndicators.SuspendLayout(); flowLayoutIndicators.Controls.Clear(); flowLayoutIndicators.Height = 0; foreach (string indicatorName in currentIndicators) { var chbxIndicator = new CheckBox { AutoSize = true, Checked = true }; switch (currentSlotType) { case SlotTypes.Open: chbxIndicator.Checked = !bannedEntryIndicators.Contains(indicatorName); break; case SlotTypes.OpenFilter: chbxIndicator.Checked = !bannedEntryFilterIndicators.Contains(indicatorName); break; case SlotTypes.Close: chbxIndicator.Checked = !bannedExitIndicators.Contains(indicatorName); break; case SlotTypes.CloseFilter: chbxIndicator.Checked = !bannedExitFilterIndicators.Contains(indicatorName); break; } chbxIndicator.Margin = new Padding(Space, Space, 0, 0); chbxIndicator.Text = indicatorName; chbxIndicator.Enabled = !isBlocked; chbxIndicator.ForeColor = LayoutColors.ColorControlText; chbxIndicator.BackColor = Color.Transparent; chbxIndicator.CheckedChanged += ChbxIndicatorCheckedChanged; flowLayoutIndicators.Controls.Add(chbxIndicator); } flowLayoutIndicators.ResumeLayout(); }
//create an tabpage private bool CreateDWGThumnailCollection(ref TabPage Page) { string PathStr = Page.Tag as string; FlowLayoutPanel FlowPanel = new FlowLayoutPanel(); if (Directory.Exists(PathStr)) { List <string> DwgFiles = Directory.GetFiles(PathStr, "*.dwg", SearchOption.AllDirectories).ToList(); BlockingCollection <DwgThumnail> DwgItemList = new BlockingCollection <DwgThumnail>(); FlowPanel.Dock = DockStyle.Fill; FlowPanel.BackColor = System.Drawing.SystemColors.ButtonHighlight; FlowPanel.AutoScroll = true; int type = 0; if (Regex.Match(PathStr, @"StdBlock").Success) { type = 0; } else { type = 1; } Parallel.ForEach(DwgFiles, item => { DwgThumnail DwgItem = new DwgThumnail(item, type); DwgItemList.Add(DwgItem); }); if (DwgItemList.Count == 0) { Label lb = new Label(); lb.Text = "该路径下不包含任何DWG文件"; lb.Dock = DockStyle.Top; lb.AutoSize = true; FlowPanel.Padding = new Padding(30); FlowPanel.Controls.Add(lb); Page.Controls.Add(FlowPanel); return(false); } else { FlowPanel.SuspendLayout(); List <DwgThumnail> DwgList = DwgItemList.ToList(); DwgList.Sort(); FlowPanel.Controls.AddRange(DwgList.ToArray()); FlowPanel.ResumeLayout(); Page.Controls.Add(FlowPanel); return(true); } } else { AcadApp.ShowAlertDialog(string.Format("路径:{0} 不存在", PathStr)); return(false); } }
public void RemoveAllConrols(bool blocking = false) { var controlList = GetAllControls(); flyPanel.SuspendLayout(); flyPanel.Controls.Clear(); flyPanel.ResumeLayout(); if (blocking) { DisposeFlyPanelControlByList(controlList); } else { Task.Factory.StartNew( () => DisposeFlyPanelControlByList( controlList)); } }
/// <summary> /// Sets up The Buttons /// </summary> void Buttons_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { ButtonPanel.SuspendLayout(); ButtonPanel.Controls.Clear(); if (Buttons.Count > 0) { ButtonPanel.Controls.AddRange(Buttons.ToArray()); // ButtonPanel.Height = Buttons.First().Height; } ButtonPanel.ResumeLayout(); }
public static void SetChildHeight(this FlowLayoutPanel flowLayoutPanel, int height) { flowLayoutPanel.SuspendLayout(); foreach (Control child in flowLayoutPanel.Controls.Cast <Control>()) { child.Height = height; } flowLayoutPanel.ResumeLayout(true); }
private void ResumeSuspendHelper(FlowLayoutPanel flp, bool isSuspend) { if (isSuspend) { flp.SuspendLayout(); } else { flp.ResumeLayout(); } }
/// <summary> /// Load a profile FlowLayoutPanel with checked items from this profile /// </summary> /// <param name="flp">The FLPanel</param> /// <param name="hudBar">The HudBar</param> public void LoadFlp(HudBar hudBar) { m_flp.Controls.Clear( ); List <CheckBox> tmp = new List <CheckBox>();// temp list of checkboxes in native sequence (not yet user ordered) // Fill a temp panel foreach (LItem i in Enum.GetValues(typeof(LItem))) { var cb = new CheckBox() { Name = Key(i), Text = hudBar.CfgName(i), Tag = BreakTagFromEnum(m_flowBreak[i]), Margin = new Padding(3, 0, 3, 0), Anchor = AnchorStyles.Left, AutoSize = true, AllowDrop = true, Enabled = i != LItem.MSFS, // Disable unckecking of MSFS Status // Cursor = Cursors.NoMoveVert, }; cb.Checked = m_profile[i]; cb.BackColor = BreakColorFromEnum(m_flowBreak[i]); // Mouse Handlers cb.MouseDown += Cb_MouseDown; cb.MouseUp += Cb_MouseUp; cb.MouseMove += Cb_MouseMove; cb.DragOver += Cb_DragOver; cb.DragDrop += Cb_DragDrop; cb.GiveFeedback += Cb_GiveFeedback; tmp.Add(cb); } // now load the real panel accordingly from display position 0... m_flp.SuspendLayout( ); // avoid performance issued while loading all checkboxes foreach (LItem i in Enum.GetValues(typeof(LItem))) { // we use the Enum only as position index 0... max here int idx = (int)i; // find the item to be shown at this position (find the pos value in m_sequence and get the item with it's Key) if (m_sequence.ContainsValue(idx)) { // the item to put as next one / Add sequentially to the layout panel m_flp.Controls.Add(tmp.ElementAt((int)ItemKeyFromPos(idx))); } else { // no such item ???? ; } } // only now layout the FLPanel m_flp.ResumeLayout( ); }
/// <summary> /// Arranges the indicators in the layout. /// </summary> void ArrangeIndicatorsSlots() { List <string> currentIndicators = new List <string>(); if (currentSlotType == SlotTypes.Open) { currentIndicators = Indicator_Store.OpenPointIndicators; } else if (currentSlotType == SlotTypes.OpenFilter) { currentIndicators = Indicator_Store.OpenFilterIndicators; } else if (currentSlotType == SlotTypes.Close) { currentIndicators = Indicator_Store.ClosePointIndicators; } else if (currentSlotType == SlotTypes.CloseFilter) { currentIndicators = Indicator_Store.CloseFilterIndicators; } flowLayoutIndicators.SuspendLayout(); flowLayoutIndicators.Controls.Clear(); flowLayoutIndicators.Height = 0; foreach (string indicatorName in currentIndicators) { CheckBox chbxIndicator = new CheckBox(); chbxIndicator.AutoSize = true; chbxIndicator.Checked = true; if (currentSlotType == SlotTypes.Open) { chbxIndicator.Checked = !bannedEntryIndicators.Contains(indicatorName); } else if (currentSlotType == SlotTypes.OpenFilter) { chbxIndicator.Checked = !bannedEntryFilterIndicators.Contains(indicatorName); } else if (currentSlotType == SlotTypes.Close) { chbxIndicator.Checked = !bannedExitIndicators.Contains(indicatorName); } else if (currentSlotType == SlotTypes.CloseFilter) { chbxIndicator.Checked = !bannedExitFilterIndicators.Contains(indicatorName); } chbxIndicator.Margin = new Padding(margin, margin, 0, 0); chbxIndicator.Text = indicatorName; chbxIndicator.Enabled = !isBlocked; chbxIndicator.CheckedChanged += new EventHandler(ChbxIndicator_CheckedChanged); flowLayoutIndicators.Controls.Add(chbxIndicator); } flowLayoutIndicators.ResumeLayout(); }
private void DoFlowLayout(List <PropertyCtrlInfo> secionList, FlowLayoutPanel container) { container.SuspendLayout(); container.Padding = new Padding(3, 0, 0, 0); foreach (PropertyCtrlInfo ci in secionList) { container.Controls.Add(ci.Binder.Control); } container.ResumeLayout(false); }
private void setLayoutFLPCatBottom() { createButtonsCat(); fLPCatBottom.SuspendLayout(); fLPCatBottom.Controls.Add(bCatNext); fLPCatBottom.Controls.Add(bCatCancel); fLPCatBottom.ResumeLayout(); fLPCatBottom.Refresh(); }
public void AddControls(FlowLayoutPanel flowLayoutPanel1) { flowLayoutPanel1.SuspendLayout(); if (Selectors != null) { for (int i = 1; i < Columns.Count; i++) { flowLayoutPanel1.Controls.Add(Selectors[Columns[i].Key]); } } flowLayoutPanel1.ResumeLayout(); }