Beispiel #1
0
	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();
	}
Beispiel #2
0
        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();
        }
Beispiel #3
0
 /// <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();
 }
Beispiel #4
0
        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);
        }
Beispiel #5
0
 /// <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();
 }
Beispiel #6
0
        public TableLayoutMainContentGeneral()
        {
            flowLayoutGeneralTopic = new FlowLayoutPanel();
            topicLabel             = new AntiAliasedLabel();
            TextDecisionTopic      = new TextBox();

            flowLayoutGeneralAuthor = new FlowLayoutPanel();
            authorLabel             = new AntiAliasedLabel();
            TextAuthor = new TextBox();

            flowLayoutGeneralDate      = new FlowLayoutPanel();
            dateLabel                  = new AntiAliasedLabel();
            DateTimePickerCreationDate = new DateTimePicker();

            flowLayoutGeneralVersion = new FlowLayoutPanel();
            versionLabel             = new AntiAliasedLabel();
            TextVersion = new TextBox();

            SuspendLayout();
            flowLayoutGeneralTopic.SuspendLayout();
            flowLayoutGeneralAuthor.SuspendLayout();
            flowLayoutGeneralDate.SuspendLayout();
            flowLayoutGeneralVersion.SuspendLayout();
            Init();
        }
Beispiel #7
0
        public void LayoutEngine_Layout_ValidContainerBottomUp_Success()
        {
            using var control = new FlowLayoutPanel
                  {
                      FlowDirection = FlowDirection.BottomUp
                  };
            control.SuspendLayout();
            using var child1 = new Control
                  {
                      Margin = Padding.Empty,
                      Size   = new Size(10, 20)
                  };
            using var child2 = new Control
                  {
                      Margin = new Padding(1, 2, 3, 4),
                      Size   = new Size(10, 20)
                  };
            using var largeChild = new Control
                  {
                      Margin = Padding.Empty,
                      Size   = new Size(100, 200)
                  };
            using var emptyChild = new Control
                  {
                      Size = Size.Empty
                  };
            using var emptyChildWithMargin = new Control
                  {
                      Margin = new Padding(1, 2, 3, 4),
                      Size   = Size.Empty
                  };
            using var child3 = new Control
                  {
                      Margin = Padding.Empty,
                      Size   = new Size(50, 100)
                  };
            using var child4 = new Control
                  {
                      Margin = Padding.Empty,
                      Size   = new Size(10, 20)
                  };
            control.Controls.Add(child1);
            control.Controls.Add(child2);
            control.Controls.Add(largeChild);
            control.Controls.Add(emptyChild);
            control.Controls.Add(emptyChildWithMargin);
            control.Controls.Add(child3);
            control.Controls.Add(child4);

            LayoutEngine engine = control.LayoutEngine;

            engine.Layout(control, null);
            Assert.Equal(new Rectangle(0, 80, 10, 20), child1.Bounds);
            Assert.Equal(new Rectangle(1, 56, 10, 20), child2.Bounds);
            Assert.Equal(new Rectangle(14, -100, 100, 200), largeChild.Bounds);
            Assert.Equal(new Rectangle(117, 97, 0, 0), emptyChild.Bounds);
            Assert.Equal(new Rectangle(115, 90, 0, 0), emptyChildWithMargin.Bounds);
            Assert.Equal(new Rectangle(120, 0, 50, 100), child3.Bounds);
            Assert.Equal(new Rectangle(170, 80, 10, 20), child4.Bounds);
        }
Beispiel #8
0
        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();
        }
Beispiel #9
0
        /// <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();
        }
Beispiel #10
0
        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();
        }
Beispiel #12
0
    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();
    }
Beispiel #13
0
        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);
            }
        }
Beispiel #14
0
        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();
        }
Beispiel #16
0
	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();
		
	}
Beispiel #17
0
        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();
        }
Beispiel #18
0
        Control CreateFlowPanel(GuiLayout gl)
        {
            FlowLayoutPanel flp = new FlowLayoutPanel();

            flp.SuspendLayout();
            flp.AutoScroll       = true;
            flp.AutoScrollMargin = new System.Drawing.Size(100, 1000);
            flp.WrapContents     = false;
            flp.FlowDirection    = FlowDirection.LeftToRight;
            if (gl.direction.IsExplicit())
            {
                switch (((string)gl.direction).ToUpper())
                {
                case "L2R": flp.FlowDirection = FlowDirection.LeftToRight; break;

                case "T2B": flp.FlowDirection = FlowDirection.TopDown; break;

                case "R2L": flp.FlowDirection = FlowDirection.RightToLeft; break;

                case "B2T": flp.FlowDirection = FlowDirection.BottomUp; break;
                }
            }
            FillCommonLayoutParameters(gl, flp);
            return(WrapInCollapsible(gl, flp));
        }
Beispiel #19
0
        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);
        }
        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();
        }
Beispiel #21
0
        /// <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();
        }
Beispiel #22
0
        public void LayoutEngine_Layout_ValidContainerLeftToRight_Success()
        {
            using var control = new FlowLayoutPanel();
            control.SuspendLayout();
            using var child1 = new Control
                  {
                      Margin = Padding.Empty,
                      Size   = new Size(10, 20)
                  };
            using var child2 = new Control
                  {
                      Margin = new Padding(1, 2, 3, 4),
                      Size   = new Size(10, 20)
                  };
            using var largeChild = new Control
                  {
                      Margin = Padding.Empty,
                      Size   = new Size(100, 200)
                  };
            using var emptyChild = new Control
                  {
                      Size = Size.Empty
                  };
            using var emptyChildWithMargin = new Control
                  {
                      Margin = new Padding(1, 2, 3, 4),
                      Size   = Size.Empty
                  };
            using var child3 = new Control
                  {
                      Margin = Padding.Empty,
                      Size   = new Size(50, 100)
                  };
            using var child4 = new Control
                  {
                      Margin = Padding.Empty,
                      Size   = new Size(10, 20)
                  };
            control.Controls.Add(child1);
            control.Controls.Add(child2);
            control.Controls.Add(largeChild);
            control.Controls.Add(emptyChild);
            control.Controls.Add(emptyChildWithMargin);
            control.Controls.Add(child3);
            control.Controls.Add(child4);

            LayoutEngine engine = control.LayoutEngine;

            engine.Layout(control, null);
            Assert.Equal(new Rectangle(0, 0, 10, 20), child1.Bounds);
            Assert.Equal(new Rectangle(11, 2, 10, 20), child2.Bounds);
            Assert.Equal(new Rectangle(24, 0, 100, 200), largeChild.Bounds);
            Assert.Equal(new Rectangle(127, 3, 0, 0), emptyChild.Bounds);
            Assert.Equal(new Rectangle(131, 2, 0, 0), emptyChildWithMargin.Bounds);
            Assert.Equal(new Rectangle(134, 0, 50, 100), child3.Bounds);
            Assert.Equal(new Rectangle(184, 0, 10, 20), child4.Bounds);
        }
Beispiel #23
0
        //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);
            }
        }
Beispiel #24
0
        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));
            }
        }
Beispiel #25
0
 private void InitPanel()
 {
     panel.SuspendLayout();
     panel.Size          = new Size(600, 150);
     panel.Location      = new Point(50, 50);
     panel.FlowDirection = FlowDirection.LeftToRight;
     panel.AutoScroll    = true;
     panel.WrapContents  = false;
     Controls.Add(panel);
 }
Beispiel #26
0
 /// <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);
        }
Beispiel #28
0
 private void ResumeSuspendHelper(FlowLayoutPanel flp, bool isSuspend)
 {
     if (isSuspend)
     {
         flp.SuspendLayout();
     }
     else
     {
         flp.ResumeLayout();
     }
 }
Beispiel #29
0
        /// <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( );
        }
Beispiel #30
0
        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);
        }