/// <summary> /// Checks to see if discs have moved and updates stacks /// </summary> /// <param name="source"></param> /// <param name="sourceStack"></param> /// <param name="dest"></param> /// <param name="destStack"></param> /// <param name="alt"></param> /// <param name="altStack"></param> /// <returns></returns> private bool UpdatePanelHelper(FlowLayoutPanel source, Stack <int> sourceStack, FlowLayoutPanel dest, Stack <int> destStack, FlowLayoutPanel alt, Stack <int> altStack) { if (source.Controls.Count > sourceStack.Count) { if (dest.Controls.Count < destStack.Count) { DrawDisc(destStack.Peek(), dest); source.Controls.RemoveAt(source.Controls.Count - 1); dest.Update(); } else { DrawDisc(altStack.Peek(), alt); source.Controls.RemoveAt(source.Controls.Count - 1); alt.Update(); } return(false); } else { return(true); } }
/// <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(); }
/// <summary> /// TODO /// </summary> /// <param name="panel"></param> /// <param name="text"></param> private void AddCheckBox(FlowLayoutPanel panel, string text) { var cBox = new CheckBox(); cBox.AutoSize = true; cBox.Text = text; cBox.ForeColor = Colors.GetCadTextColor(); var contents = text.Split('='); var propName = contents[0].Replace(" ", string.Empty); cBox.Checked = _lastChecked.Contains(propName); cBox.CheckStateChanged += (sender, e) => { if (cBox.Checked) { return; } if (showOnlySelected) { cBox.Visible = false; } panel.Update(); }; panel.Controls.Add(cBox); }
protected void RemoveLabelFromFlowPanel(FlowLayoutPanel flowPanel) { if (flowPanel.Controls.Count > 0) { flowPanel.Controls.RemoveAt(flowPanel.Controls.Count - 1); } flowPanel.Update(); }
private void AddControlAsync(FlowLayoutPanel flow, Control control) { if (InvokeRequired) { Invoke((Action <FlowLayoutPanel, Control>)AddControlAsync, flow, control); } else { flow.Controls.Add(control); flow.Update(); this.Update(); } }
private void JkDataGridView_Scroll(object sender, ScrollEventArgs e) { HScrollBar hScrollBar = this.Controls.OfType <HScrollBar>().First(); foreach (Control control in this.Controls) { if (control is DateTimePicker) { control.Visible = false; } } //GridFooter will scroll depending on scroll of the grid if (hScrollBar.Visible && e.ScrollOrientation == ScrollOrientation.HorizontalScroll) { GridFooter.HorizontalScroll.Maximum = hScrollBar.Maximum; GridFooter.HorizontalScroll.Minimum = hScrollBar.Minimum; GridFooter.HorizontalScroll.LargeChange = hScrollBar.LargeChange; GridFooter.HorizontalScroll.SmallChange = hScrollBar.SmallChange; GridFooter.HorizontalScroll.Value = e.NewValue; GridFooter.Update(); this.Update(); } }