private static FilterPanel GetNewFilterPanel(GridFilter gridFilter) { FilterPanel fp = new FilterPanel(); fp.Visible = false; gridFilter.SuperGrid.Controls.Add(fp); return (fp); }
static internal void RenderCheckBox( Graphics g, GridFilter gf, GridColumn column, Rectangle bounds) { object value = column.FilterValue; if (_sizeCheckBox == null) { _sizeCheckBox = new MyCheckBoxX(); _sizeCheckBox.Text = ""; _sizeCheckBox.BackColor = Color.Transparent; } _sizeCheckBox.Enabled = false; _sizeCheckBox.Size = new Size(20, 20); _sizeCheckBox.BackColor = GetSimpleColor(gf.GetEffectiveStyle(column)); if (value is CheckState) _sizeCheckBox.CheckState = (CheckState)value; else _sizeCheckBox.CheckState = CheckState.Indeterminate; Rectangle r = new Rectangle(0, 0, 20, 20); using (Bitmap bm = new Bitmap(20, 20)) { _sizeCheckBox.DrawToBitmap(bm, r); Rectangle t = bounds; if (bounds.Width > r.Width) { t.X += (t.Width - r.Width - 1) / 2; t.Width = r.Width; } if (bounds.Height > r.Height) { t.Y += (t.Height - r.Height) / 2; t.Height = r.Height; } g.DrawImage(bm, t); } }
static private FilterPanel GetFilterPanel( GridFilter gridFilter, FilterEditType type) { switch (type) { case FilterEditType.CheckBox: if (_checkBoxPanel == null || _checkBoxPanel.Parent != gridFilter.SuperGrid) _checkBoxPanel = GetNewFilterPanel(gridFilter); return (_checkBoxPanel); case FilterEditType.ComboBox: if (_comboBoxPanel == null || _comboBoxPanel.Parent != gridFilter.SuperGrid) _comboBoxPanel = GetNewFilterPanel(gridFilter); return (_comboBoxPanel); case FilterEditType.DateTime: case FilterEditType.TextBox: if (_textBoxPanel == null || _textBoxPanel.Parent != gridFilter.SuperGrid) _textBoxPanel = GetNewFilterPanel(gridFilter); return (_textBoxPanel); } return (null); }
/// <summary> /// Handles invocation of PreRenderFilterRowEvent events /// </summary> internal bool DoPreRenderFilterRowEvent(Graphics g, GridFilter filter, GridColumn column, RenderParts parts, Rectangle bounds) { if (PreRenderFilterRow != null) { GridPanel panel = filter.GridPanel; GridPreRenderFilterRowEventArgs ev = new GridPreRenderFilterRowEventArgs(g, panel, filter, column, parts, bounds); PreRenderFilterRow(this, ev); return (ev.Cancel); } return (false); }
static internal Size GetPreferredSize( GridFilter gridFilter, GridColumn gridColumn) { Size size = Size.Empty; FilterEditType type = gridColumn.GetFilterPanelType(); switch (type) { case FilterEditType.ComboBox: if (_sizeComboBox == null) _sizeComboBox = new ComboBoxEx(); _sizeComboBox.Font = gridFilter.GetEffectiveStyle(gridColumn).Font; size = _sizeComboBox.GetPreferredSize(Size.Empty); break; case FilterEditType.TextBox: case FilterEditType.DateTime: if (_sizeTextBox == null) _sizeTextBox = new TextBoxX(); _sizeTextBox.BorderStyle = BorderStyle.None; _sizeTextBox.Font = gridFilter.GetEffectiveStyle(gridColumn).Font; size = _sizeTextBox.GetPreferredSize(Size.Empty); break; case FilterEditType.CheckBox: if (_sizeCheckBox == null) _sizeCheckBox = new MyCheckBoxX(); size = new Size(20, 20); break; } return (size); }
/// <summary> /// Handles invocation of PostRenderFilterRow events /// </summary> internal void DoPostRenderFilterRowEvent(Graphics g, GridFilter filter, GridColumn column, RenderParts parts, Rectangle bounds) { if (PostRenderFilterRow != null) { GridPanel panel = filter.GridPanel; GridPostRenderFilterRowEventArgs ev = new GridPostRenderFilterRowEventArgs(g, panel, filter, column, parts, bounds); PostRenderFilterRow(this, ev); } }
/// <summary> /// Handles invocation of GetFilterRowStyle events /// </summary> internal void DoGetFilterRowStyleEvent( GridFilter gridFilter, StyleType eStyle, ref FilterRowVisualStyle style) { if (GetFilterRowStyle != null) { GridGetFilterRowStyleEventArgs ev = new GridGetFilterRowStyleEventArgs(gridFilter.GridPanel, gridFilter, eStyle, style); GetFilterRowStyle(this, ev); style = ev.Style; } }
///<summary> /// GridPreRenderFilterRowEventArgs ///</summary> ///<param name="graphics"></param> ///<param name="gridPanel"></param> ///<param name="filter"></param> ///<param name="column"></param> ///<param name="parts"></param> ///<param name="bounds"></param> public GridPreRenderFilterRowEventArgs(Graphics graphics, GridPanel gridPanel, GridFilter filter, GridColumn column, RenderParts parts, Rectangle bounds) : base(graphics, gridPanel, filter, column, parts, bounds) { }
///<summary> /// GridPostRenderFilterRowEventArgs ///</summary> ///<param name="graphics"></param> ///<param name="gridPanel"></param> ///<param name="filter"></param> ///<param name="column"></param> ///<param name="parts"></param> ///<param name="bounds"></param> public GridPostRenderFilterRowEventArgs(Graphics graphics, GridPanel gridPanel, GridFilter filter, GridColumn column, RenderParts parts, Rectangle bounds) : base(gridPanel) { _Bounds = bounds; _Graphics = graphics; _GridFilter = filter; _GridColumn = column; _RenderParts = parts; }
///<summary> /// GridGetFilterRowStyleEventArgs ///</summary> ///<param name="gridPanel"></param> ///<param name="gridFilter"></param> ///<param name="styleType"></param> ///<param name="style"></param> public GridGetFilterRowStyleEventArgs(GridPanel gridPanel, GridFilter gridFilter, StyleType styleType, FilterRowVisualStyle style) : base(gridPanel) { _GridFilter = gridFilter; _StyleType = styleType; _Style = style; }