/// <summary> /// Helper Method to create an Argument Panel out of a Label and a Control. Such an 'Argument Panel' /// can be passed to the TUcoFilterAndFind UserControl. /// </summary> /// <param name="AControlLabel">Label of the Argument Control. /// If this is null, no Label will be shown (useful e.g. for CheckBox Controls who have their own /// 'attached' Label).</param> /// <param name="AControl">Argument Control.</param> /// <param name="AAutomaticClearButton">Whether to automatically create an 'Clear Value' Button (default=true).</param> /// <returns>An Argument Panel that can be passed to the TUcoFilterAndFind UserControl.</returns> public static Panel CreateArgumentPanel(Label AControlLabel, Control AControl, bool AAutomaticClearButton = true) { const int ARGUMENT_PANEL_BOTTOM_BORDER = 6; // in Pixels; int NextControlVPos = 0; Panel ArgumentPanel = new Panel(); if (AControl == null) { throw new ArgumentNullException("Argument AControl must not be null"); } if (AControlLabel != null) { AControlLabel.Location = new System.Drawing.Point(3, 0); AControlLabel.AutoSize = true; AControlLabel.Font = new System.Drawing.Font("Verdana", 7F); AControlLabel.TabIndex = 0; NextControlVPos = 17; } AControl.Location = new System.Drawing.Point(3, NextControlVPos); AControl.TabIndex = 1; if (!AAutomaticClearButton) { ArgumentPanel.Tag = CommonTagString.ARGUMENTPANELTAG_NO_AUTOM_ARGUMENTCLEARBUTTON; } if (!(AControl is CheckBox)) { ArgumentPanel.Height = AControl.Bottom + ARGUMENT_PANEL_BOTTOM_BORDER; } else { ArgumentPanel.Height = AControl.Bottom + 3; AControl.Font = new System.Drawing.Font("Verdana", 7F); // for the Label that is part of the CheckBox Control! } if (AControlLabel != null) { ArgumentPanel.Controls.Add(AControlLabel); } ArgumentPanel.Controls.Add(AControl); ArgumentPanel.BackColor = System.Drawing.Color.Teal; ArgumentPanel.SetDoubleBuffered(true); return ArgumentPanel; }
private void AddTabs() { Panel pnlFindOptions = new Panel(); Button btnFindNext = new Button(); GroupBox grpFindDirection = new GroupBox(); RadioButton rbtFindDirUp = new RadioButton(); RadioButton rbtFindDirDown = new RadioButton(); TSingleLineFlow LayoutManagerFindControls; TSingleLineFlow LayoutManagerFilterTab; TSingleLineFlow LayoutManagerFindTab; this.SuspendLayout(); grpFindDirection.SuspendLayout(); pnlFindOptions.SuspendLayout(); FTabFilterAndFind.SuspendLayout(); FPnlFindControls = new Owf.Controls.A1Panel(); FPnlFindControls.SuspendLayout(); FPnlFindControls.Name = "FPnlFindControls"; FPnlFindControls.Left = 7; FPnlFindControls.Top = 8; FPnlFindControls.Width = FInitialWidth - 5; FPnlFindControls.Height = 174; FPnlFindControls.BorderColor = System.Drawing.Color.CadetBlue; FPnlFindControls.ShadowOffSet = 4; FPnlFindControls.RoundCornerRadius = 4; FPnlFindControls.GradientDirection = LinearGradientMode.Horizontal; // Layout Manager for the 'Find' Panel. // This will arrange 'Argument Panels' that will be added later to the 'Find' Panel. LayoutManagerFindControls = new TSingleLineFlow(FPnlFindControls, 4, 3); LayoutManagerFindControls.TopMargin = 5; LayoutManagerFindControls.RightMargin = 9; LayoutManagerFindControls.SpacerDistance = 3; btnFindNext.Top = 2; btnFindNext.Left = 1; btnFindNext.Text = "Find Ne&xt"; btnFindNext.Name = "btnFindNext"; btnFindNext.BackColor = System.Drawing.SystemColors.ButtonFace; btnFindNext.ImageList = imlButtonIcons; btnFindNext.ImageIndex = 4; btnFindNext.ImageAlign = ContentAlignment.MiddleRight; btnFindNext.Click += delegate(object sender, EventArgs e) { OnFindNextClicked(sender, e); }; tipGeneral.SetToolTip(btnFindNext, "Click to find the next occurance\r\nin the search direction"); rbtFindDirUp.Top = 14; rbtFindDirUp.Left = 10; rbtFindDirUp.AutoSize = true; rbtFindDirUp.Name = "rbtFindDirUp"; rbtFindDirUp.Text = Catalog.GetString("&Up"); rbtFindDirUp.Tag = CommonTagString.SUPPRESS_CHANGE_DETECTION; rbtFindDirDown.Top = 14; rbtFindDirDown.Left = 60; rbtFindDirDown.AutoSize = true; rbtFindDirDown.Checked = true; rbtFindDirDown.Name = "rbtFindDirDown"; rbtFindDirDown.Text = Catalog.GetString("D&own"); rbtFindDirDown.Tag = CommonTagString.SUPPRESS_CHANGE_DETECTION; grpFindDirection.Top = 30; grpFindDirection.Left = 3; grpFindDirection.Height = 38; grpFindDirection.BackColor = System.Drawing.Color.Transparent; grpFindDirection.Name = "grpFindDirection"; grpFindDirection.Text = "Direction"; grpFindDirection.Controls.Add(rbtFindDirUp); grpFindDirection.Controls.Add(rbtFindDirDown); pnlFindOptions.Name = "pnlFindOptions"; pnlFindOptions.Left = 0; pnlFindOptions.Width = FTabFilterAndFind.Width; pnlFindOptions.Height = 72; pnlFindOptions.BackColor = System.Drawing.Color.Transparent; pnlFindOptions.Tag = TSingleLineFlow.BeginGroupIndicator; pnlFindOptions.Controls.Add(btnFindNext); pnlFindOptions.Controls.Add(grpFindDirection); pnlFindOptions.SetDoubleBuffered(true); FPnlFindControls.Controls.Add(pnlFindOptions); // // FTabFilterAndFind // FTabFilterAndFind.BackColor = System.Drawing.Color.LightSteelBlue; FTabFilterAndFind.Alignment = System.Windows.Forms.TabAlignment.Bottom; FTabFilterAndFind.Controls.Add(FTbpFilter); FTabFilterAndFind.Controls.Add(FTbpFind); FTabFilterAndFind.Dock = System.Windows.Forms.DockStyle.Fill; FTabFilterAndFind.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed; FTabFilterAndFind.Font = new System.Drawing.Font("Verdana", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); FTabFilterAndFind.Location = new System.Drawing.Point(0, 0); FTabFilterAndFind.Name = "tabFilterAndFind"; FTabFilterAndFind.SelectedIndex = 0; FTabFilterAndFind.ShowToolTips = true; FTabFilterAndFind.TabIndex = 10; FTabFilterAndFind.SelectedIndexChanged += delegate(object sender, EventArgs e) { FTabFilterAndFind_SelectedIndexChanged(sender, e); }; FTabFilterAndFind.GotFocus += delegate(object sender, EventArgs e) { OnFilterFindTabFocused(); }; // // FTbpFilter // FTbpFilter.BackColor = System.Drawing.Color.LightSteelBlue; FTbpFilter.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); FTbpFilter.Location = new System.Drawing.Point(4, 4); FTbpFilter.Name = "tbpFilter"; FTbpFilter.Padding = new System.Windows.Forms.Padding(6, 3, 2, 3); FTbpFilter.Size = new System.Drawing.Size(553, 157); FTbpFilter.TabIndex = 0; FTbpFilter.Text = "Filter"; FTbpFilter.ToolTipText = Catalog.GetString("Filter the rows shown in the list"); FTbpFilter.AutoScroll = true; FTbpFilter.SetAutoScrollMargin(3, 3); LayoutManagerFilterTab = new TSingleLineFlow(FTbpFilter, 4, 3); LayoutManagerFilterTab.SpacerDistance = 5; FTbpFilter.Controls.Add(pnlFilterControls); if (IsExtraFilterShown) { FTbpFilter.Controls.Add(pnlExtraFilterControls); } // // FTbpFind // FTbpFind.BackColor = System.Drawing.Color.LightSteelBlue; FTbpFind.Controls.Add(FPnlFindControls); FTbpFind.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); FTbpFind.Location = new System.Drawing.Point(4, 4); FTbpFind.Name = "tbpFind"; FTbpFind.Padding = new System.Windows.Forms.Padding(6, 3, 2, 3); FTbpFind.Size = new System.Drawing.Size(553, 157); FTbpFind.TabIndex = 0; FTbpFind.Text = "Find"; FTbpFind.ToolTipText = Catalog.GetString("Find within the rows shown in the list"); FTbpFind.AutoScroll = true; FTbpFind.SetAutoScrollMargin(3, 3); LayoutManagerFindTab = new TSingleLineFlow(FTbpFind, 4, 3); LayoutManagerFindTab.SpacerDistance = 5; FTabFilterAndFind.Dock = DockStyle.Fill; this.Controls.Clear(); pnlTitle.Dock = DockStyle.Top; this.Controls.Add(pnlTitle); this.Controls.Add(FTabFilterAndFind); FTabFilterAndFind.BringToFront(); FPnlFindControls.Top = pnlFilterControls.Top - 22; // Add individual 'Argument Panels' Panels to the 'Find' Panel (on 'Find' Tab) // Layout is taken care of automatically due to a TSingleLineFlow Layout Manager! foreach (Panel ArgumentPanel in FFindControls) { ProcessArgumentPanel(ArgumentPanel, FPnlFindControls.Width, true); FPnlFindControls.Controls.Add(ArgumentPanel); if (FFindPanelFirstArgumentControl == null) { FFindPanelFirstArgumentControl = DetermineFirstArgumentControl(ArgumentPanel); } } btnFindNext.Width = FInitialWidth - 31; grpFindDirection.Width = FInitialWidth - 34; // Ensure that pnlFindOptions is always the bottommost of the Controls in the Panel FPnlFindControls.Controls.SetChildIndex(pnlFindOptions, FPnlFindControls.Controls.Count); FTabFilterAndFind.ResumeLayout(); FPnlFindControls.ResumeLayout(); pnlFindOptions.ResumeLayout(); grpFindDirection.ResumeLayout(); this.ResumeLayout(); }