private void drawSortGlyph(DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column == null) { return; } //A rectangle for the sort glyph Rectangle sortBounds = Rectangle.Empty; try { //Store the rectangle for the sort glyph in sortBounds and //then clear this region in the e.Info object updateInnerElements(e, false, ref sortBounds); //Draw the column header without the sort glyph e.Painter.DrawObject(e.Info); } finally { //Restore the rectangle for the sort glyph updateInnerElements(e, true, ref sortBounds); } if (!sortBounds.IsEmpty) { //Perform custom painting of the sort glyph drawCustomSortedShape(e.Graphics, sortBounds, e.Column.SortOrder, sortingGlyphsImageList); } e.Handled = true; }
/// <summary> /// 列头画多选框 /// </summary> /// <param name="e"></param> /// <param name="chk"></param> private static void DrawCheckBox(DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e, bool chk) { try { DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit repositoryCheck = e.Column.ColumnEdit as DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit; if (repositoryCheck != null) { System.Drawing.Graphics g = e.Graphics; System.Drawing.Rectangle r = e.Bounds; DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo info; DevExpress.XtraEditors.Drawing.CheckEditPainter painter; DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs args; info = repositoryCheck.CreateViewInfo() as DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo; painter = repositoryCheck.CreatePainter() as DevExpress.XtraEditors.Drawing.CheckEditPainter; info.EditValue = chk; info.Bounds = r; info.CalcViewInfo(g); args = new DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs(info, new DevExpress.Utils.Drawing.GraphicsCache(g), r); painter.Draw(args); args.Cache.Dispose(); } } catch { } }
private void GV_Main_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column == null) { return; } if (!KeyListMain.Contains(e.Column.FieldName)) { return; } Rectangle rect = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height + 1); ControlPaint.DrawBorder3D(e.Graphics, e.Bounds); Brush brush = e.Cache.GetGradientBrush(rect, e.Column.AppearanceHeader.BackColor, e.Column.AppearanceHeader.BackColor2, e.Column.AppearanceHeader.GradientMode); rect.Inflate(-1, -1); // Fill column headers with the specified colors. e.Graphics.FillRectangle(brush, rect); e.Appearance.DrawString(e.Cache, e.Info.Caption, e.Info.CaptionRect); // Draw the filter and sort buttons. foreach (DevExpress.Utils.Drawing.DrawElementInfo info in e.Info.InnerElements) { if (!info.Visible) { continue; } DevExpress.Utils.Drawing.ObjectPainter.DrawObject(e.Cache, info.ElementPainter, info.ElementInfo); } e.Handled = true; }
//컬럼의 헤더를 CheckEdit으로 그려줌. void gv_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { GridView gv = sender as GridView; if (e.Column == null) { return; } if (e.Column.FieldName == strColumnName) { e.Info.InnerElements.Clear(); e.Info.Appearance.ForeColor = Color.Blue; e.Painter.DrawObject(e.Info); int intCheckCnt = getCheckedCount(gv); switch (intCheckCnt) { case 0: DrawCheckBox(e.Graphics, e.Bounds, false); break; default: if (intCheckCnt == gv.RowCount) { DrawCheckBox(e.Graphics, e.Bounds, true); } else { DrawCheckBox(e.Graphics, e.Bounds); } break; } e.Handled = true; } }
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column == null) { e.Handled = true; } }
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column == null) { return; } //A rectangle for the sort glyph Rectangle sortBounds = Rectangle.Empty; try { //Store the rectangle for the sort glyph in sortBounds and //then clear this region in the e.Info object UpdateInnerElements(e, false, ref sortBounds); //Draw the column header without the sort glyph e.Painter.DrawObject(e.Info); } finally { //Restore the rectangle for the sort glyph UpdateInnerElements(e, true, ref sortBounds); } if (!sortBounds.IsEmpty) { //Perform custom painting of the sort glyph Rectangle newSortBounds = sortBounds; newSortBounds.Offset(-10, -1); DrawCustomSortedShape(e.Cache, newSortBounds, e.Column.SortOrder, sortGlyphCollection); } e.Handled = true; }
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column != null && e.Column.FieldName == "OutlookDeadLineStateToString") { e.Info.Caption = string.Empty; e.Column.View.Images = imageCollection1; e.Column.ImageIndex = 11; } }
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column != null && e.Column.FieldName == "check") { e.Info.InnerElements.Clear(); e.Painter.DrawObject(e.Info); DevControlHelper.DrawCheckBox(e, m_checkStatus); e.Handled = true; } }
private void GirdViewCustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column != null && e.Column.FieldName == _column.FieldName) { e.Info.InnerElements.Clear(); e.Painter.DrawObject(e.Info); DrawCheckBox(e, _checkstate); e.Handled = true; } }
private void GridView_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column == colEmailStatement) { e.DefaultDraw(); e.Graphics.DrawImage(CDS.Client.Desktop.Accounting.Properties.Resources.mail_sealed_16, new Rectangle(e.Bounds.X + 2, e.Bounds.Y + 2, 16, 16)); e.Handled = true; } else if (e.Column == colPrintStatement) { e.DefaultDraw(); e.Graphics.DrawImage(CDS.Client.Desktop.Accounting.Properties.Resources.printer_16, new Rectangle(e.Bounds.X + 2, e.Bounds.Y + 2, 16, 16)); e.Handled = true; } }
private void OnCustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column == null) { return; } switch (Convert.ToInt32(e.Column.Tag)) { case 1: e.Info.State = DevExpress.Utils.Drawing.ObjectState.Hot; break; case 2: e.Info.State = DevExpress.Utils.Drawing.ObjectState.Pressed; break; } }
private void serviceOrderBillView_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { drawSortGlyph(e); }
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { //GridView _view = sender as GridView; //_view.DrawHeaderCheckBox(CheckItem, gcCheckFieldName, e); }
private void customGridLookUpEdit1View_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { }