private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { try { if (x_axisvalues.Length > 0) { if (e.Column != null) { if (x_axisvalues.Length > e.Column.VisibleIndex) { string xvalue = x_axisvalues.GetValue(e.Column.VisibleIndex).ToString(); Rectangle r = new Rectangle(e.Bounds.X + 1, e.Bounds.Y + 1, e.Bounds.Width - 2, e.Bounds.Height - 2); e.Graphics.DrawRectangle(Pens.LightSteelBlue, r); System.Drawing.Drawing2D.LinearGradientBrush gb = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, e.Appearance.BackColor2, e.Appearance.BackColor2, System.Drawing.Drawing2D.LinearGradientMode.Horizontal); e.Graphics.FillRectangle(gb, e.Bounds); //e.Graphics.DrawString(xvalue, this.Font, Brushes.MidnightBlue, r); e.Graphics.DrawString(xvalue, this.Font, Brushes.MidnightBlue, new PointF(e.Bounds.X + 3, e.Bounds.Y + 1 + (e.Bounds.Height - m_textheight) / 2)); e.Handled = true; } } } } catch (Exception E) { logger.Debug(E.Message); } }
private void CustomDrawChooseColumnHeaderEventMethod(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (this.AllowChoose && e.Column != null && e.Column.FieldName == ChooseColumnName) { e.Info.InnerElements.Clear(); e.Info.Caption = ""; e.Painter.DrawObject(e.Info); var repositoryCheck = new DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit(); repositoryCheck.Caption = ""; var info = repositoryCheck.CreateViewInfo() as DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo; var painter = repositoryCheck.CreatePainter() as DevExpress.XtraEditors.Drawing.CheckEditPainter; if (this.ChooseCount == this.DataRowCount) { info.EditValue = true; } else if (this.ChooseCount > 0) { info.EditValue = null; } else { info.EditValue = false; } info.Bounds = e.Bounds; info.CalcViewInfo(e.Graphics); var args = new DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs(info, new DevExpress.Utils.Drawing.GraphicsCache(e.Graphics), e.Bounds); painter.Draw(args); args.Cache.Dispose(); e.Handled = true; } }
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column == gcPayment) { int indent = 5; e.Info.Caption = string.Empty; e.Painter.DrawObject(e.Info); int rectHeight = e.Info.Bounds.Height - indent * 2; int rectWidth = (int)(rectHeight * 1.3); Rectangle interestRect = new Rectangle( e.Bounds.X + e.Appearance.CalcTextSizeInt(e.Cache, interestString, e.Info.Bounds.Width).Width + indent * 2, e.Info.Bounds.Y + Convert.ToInt32((e.Info.Bounds.Height - rectHeight) / 2) - 1, rectWidth, rectHeight); Rectangle principalRect = new Rectangle( e.Bounds.X + e.Bounds.Width - indent * 2 - e.Appearance.CalcTextSizeInt(e.Cache, principalString, e.Info.Bounds.Width).Width - rectWidth, e.Info.Bounds.Y + Convert.ToInt32((e.Info.Bounds.Height - rectHeight) / 2) - 1, rectWidth, rectHeight); Rectangle r = e.Info.Bounds; r.Inflate(-indent, 0); r.Height -= 1; using (StringFormat sf = new StringFormat()) { sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Center; e.Appearance.DrawString(e.Cache, interestString, r, sf); sf.Alignment = StringAlignment.Far; e.Appearance.DrawString(e.Cache, principalString, r, sf); } e.Graphics.FillRectangle(interestBrush, interestRect); e.Graphics.FillRectangle(principalBrush, principalRect); e.Graphics.DrawRectangle(paymentPen, interestRect); e.Graphics.DrawRectangle(paymentPen, principalRect); e.Handled = true; } }
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column == null) { return; } Rectangle rect = e.Bounds; 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) { try { DevExpress.Utils.Drawing.ObjectPainter.DrawObject(e.Cache, info.ElementPainter, info.ElementInfo); } catch (Exception exp) { } } e.Handled = true; }
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column == null) { 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 { } }
/// <summary> /// Handles the CustomDrawColumnHeader event of the gridViewBudgetSource control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs"/> instance containing the event data.</param> private void gridViewBudgetSource_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { var viewInfo = (GridViewInfo)gridViewBudgetSource.GetViewInfo(); var rec = new Rectangle(e.Bounds.X + 2, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); if (e.Column == null) { return; } if (e.Column == viewInfo.FixedLeftColumn || e.Column == viewInfo.ColumnsInfo.LastColumnInfo.Column) { 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.Painter.DrawCaption(e.Info, e.Info.Caption, e.Appearance.Font, e.Appearance.GetForeBrush(e.Cache), rec, e.Appearance.GetStringFormat()); e.Graphics.DrawLine(Pens.DarkGray, e.Bounds.Left - 1, e.Bounds.Bottom - 1, e.Bounds.Right - 1, e.Bounds.Bottom - 1); e.Handled = true; } }
/// <summary> /// 控制Grid头部内容 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridViewAnalyse_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { try { StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; Graphics g = e.Graphics; string caption = string.Empty; if (e.Column.Tag != null) { caption = e.Column.Tag.ToString(); } else { caption = e.Column.Caption; } m_DrawHeadRectangle.AddBound(caption, e.Bounds); Rectangle rect = new Rectangle(m_DrawHeadRectangle.Bound.Location.X, m_DrawHeadRectangle.Bound.Location.Y, m_DrawHeadRectangle.Bound.Width - 1, m_DrawHeadRectangle.Bound.Height - 1); g.FillRectangle(new SolidBrush(Color.FromArgb(235, 236, 239)), rect); g.DrawRectangle(SystemPens.ControlDark, rect); g.DrawString(m_DrawHeadRectangle.ColumnName, this.Font, Brushes.Black, rect, sf); e.Handled = true; } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }
private void myGridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column != null && !e.Column.Visible) { return; } DrawVertical(e); }
private void advBandedGridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { AdvBandedGridView view = sender as AdvBandedGridView; if (e.Column == view.FocusedColumn) { e.Info.State = ObjectState.Hot; } }
private void GridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e == null || e.Column == null) { return; } if (e.Column.FieldName == Schema.PRODUCT_ID) { return; } var stdStepList = _stdStepList; if (stdStepList == null) { return; } string stepID = e.Column.FieldName; var stdStep = stdStepList.Find(t => t.STEP_ID == stepID); bool isMain = false; bool isMandatory = false; bool isOtherShopStep = false; if (stdStep != null) { isMain = StringHelper.Equals(stdStep.STEP_TYPE, "MAIN"); isMandatory = CommonHelper.ToBoolYN(stdStep.IS_MANDATORY); if (StringHelper.Equals(this.TargetAreaID, TFT)) { if (StringHelper.Equals(stdStep.SHOP_ID, CF)) { isOtherShopStep = true; } } } if (isMain == false) { e.Appearance.ForeColor = Color.DarkGray; } if (isMandatory == false) { e.Appearance.FontStyleDelta = FontStyle.Underline; } //e.Appearance.FontStyleDelta = FontStyle.Bold; if (isOtherShopStep) { e.Appearance.FontStyleDelta = FontStyle.Bold; } }
/// <summary> /// 自定义列头 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gv_SYXX_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column != null && e.Column.FieldName == "chk") { e.Info.InnerElements.Clear(); e.Painter.DrawObject(e.Info); DrawCheckBox(e, m_checkStatus); e.Handled = true; } }
private static void DrawVertical(DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { e.Info.Caption = string.Empty; e.Painter.DrawObject(e.Info); if (e.Column != null) { e.Cache.DrawVString(e.Column.GetTextCaption(), e.Appearance.Font, e.Appearance.GetForeBrush(e.Cache), e.Info.CaptionRect, stringFormat, 90); } e.Handled = true; }
void gridStockTx_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column != null && e.Column.FieldName == "IsProcessed") { e.Column.ColumnEdit = new RepositoryItemCheckEdit(); e.Info.InnerElements.Clear(); e.Painter.DrawObject(e.Info); BLLDevControlHelper.DrawCheckBox(e, m_checkStatus); e.Handled = true; } }
private void gridViewAnalyse_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { i++; int gridRowHeaderHeight; if (e.Column == null) { return; } RowHeadFlag rhf = e.Column.Tag as RowHeadFlag; StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; Graphics g = e.Graphics; if (rhf != null) { gridRowHeaderHeight = e.Bounds.Size.Height / 2; Rectangle rect1 = new Rectangle(e.Bounds.Location, new System.Drawing.Size(e.Bounds.Size.Width, gridRowHeaderHeight)); Rectangle rect2 = new Rectangle(new Point(e.Bounds.Location.X, e.Bounds.Location.Y + gridRowHeaderHeight), new System.Drawing.Size(e.Bounds.Size.Width, gridRowHeaderHeight)); m_DrawHeadRectangle.AddBound(rhf, rect1); Rectangle rect = new Rectangle(m_DrawHeadRectangle.Bound.Location.X, m_DrawHeadRectangle.Bound.Location.Y, m_DrawHeadRectangle.Bound.Width - 1, m_DrawHeadRectangle.Bound.Height - 1); g.FillRectangle(new SolidBrush(Color.FromArgb(235, 236, 239)), rect); g.DrawRectangle(SystemPens.ControlDark, rect); g.DrawString(rhf.HeaderName, this.Font, Brushes.Black, rect, sf); rect = new Rectangle(rect2.Location.X, rect2.Location.Y, rect2.Width - 1, rect2.Height - 1); g.FillRectangle(new SolidBrush(Color.FromArgb(235, 236, 239)), rect); g.DrawRectangle(SystemPens.ControlDark, rect); g.DrawString(e.Info.Caption, this.Font, Brushes.Black, rect, sf); } else { Rectangle rect = new Rectangle(e.Bounds.Location.X, e.Bounds.Location.Y, e.Bounds.Width - 1, e.Bounds.Height - 1); g.FillRectangle(new SolidBrush(Color.FromArgb(235, 236, 239)), rect); g.DrawRectangle(SystemPens.ControlDark, rect); g.DrawString(e.Info.Caption, this.Font, Brushes.Black, rect, sf); } if (e.Column.VisibleIndex == GetGridControlVisibleColumnsCount()) { m_DrawHeadRectangle = new DrawHeadRectangle2(); } e.Handled = true; }
private void grvOpenItem_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column != null && e.Column.Equals(colCheck)) { if (HasLinesSelected) { e.Info.InnerElements.Clear(); e.Painter.DrawObject(e.Info); DrawCheckBox(e.Graphics, e.Bounds, true); e.Handled = true; } } }
private void grvProgress_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column == colShouldEmail) { e.DefaultDraw(); e.Graphics.DrawImage(ImageEmail, new Rectangle(e.Bounds.X + 2, e.Bounds.Y + 2, 16, 16)); e.Handled = true; } else if (e.Column == colShouldPrint) { e.DefaultDraw(); e.Graphics.DrawImage(ImagePrint, new Rectangle(e.Bounds.X + 2, e.Bounds.Y + 2, 16, 16)); e.Handled = true; } }
private void advBandedGridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { AdvBandedGridView view = sender as AdvBandedGridView; if (e.Column == view.FocusedColumn) { e.Appearance.Assign(style); e.Info.AllowColoring = true; } else { e.Info.AllowColoring = false; e.Appearance.Assign(view.PaintAppearance.HeaderPanel); } }
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { e.Appearance.DrawBackground(e.Cache, e.Bounds); 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.Painter.DrawCaption(e.Info, e.Info.Caption, e.Appearance.Font, e.Appearance.GetForeBrush(e.Cache), e.Bounds, e.Appearance.GetStringFormat()); e.Handled = true; }
private void gvwBase_CustomDrawColumnHeader_1(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column == null) { return; } if (e.Column.AppearanceHeader.BackColor != Color.Empty) { e.Info.AllowColoring = true; } if (e.Column.AppearanceHeader.ForeColor != Color.Empty) { e.Info.AllowColoring = true; } }
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column == null) { return; } SizeF s = e.Appearance.CalcTextSize(e.Cache, e.Info.Caption, e.Info.CaptionRect.Width); if (s.Width >= e.Info.CaptionRect.Width) { if (ShortCaptions.ContainsKey(e.Column.FieldName)) { e.Info.Caption = ShortCaptions[e.Column.FieldName]; } } }
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { //e.Info.InnerElements.Clear(); //e.Painter.DrawObject(e.Info); //var repositoryCheck = new DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit(); //repositoryCheck.GlyphAlignment = DevExpress.Utils.HorzAlignment.Far; //repositoryCheck.Caption = ""; //var info = repositoryCheck.CreateViewInfo() as DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo; //var painter = repositoryCheck.CreatePainter() as DevExpress.XtraEditors.Drawing.CheckEditPainter; //info.EditValue = true; //info.Bounds = e.Bounds; //info.CalcViewInfo(e.Graphics); //var args = new DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs(info, new DevExpress.Utils.Drawing.GraphicsCache(e.Graphics), e.Bounds); //painter.Draw(args); //args.Cache.Dispose(); ////e.Handled = true; }
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { GridFilterButtonInfoArgs args = null; foreach (DrawElementInfo deInfo in e.Info.InnerElements) { if (deInfo.ElementInfo.GetType() == typeof(GridFilterButtonInfoArgs)) { args = (GridFilterButtonInfoArgs)deInfo.ElementInfo; break; } } if (null == args) { return; } int x = e.Bounds.X + 5; int y = e.Bounds.Y + e.Bounds.Height / 2 - args.Bounds.Height / 2; args.Bounds = new Rectangle(new Point(x, y), args.Bounds.Size); }
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { try { if (e.Column != null) { float xvalue = (float)Convert.ToDouble(e.Column.Caption); Rectangle r = new Rectangle(e.Bounds.X + 1, e.Bounds.Y + 1, e.Bounds.Width - 2, e.Bounds.Height - 2); e.Graphics.DrawRectangle(Pens.LightSteelBlue, r); System.Drawing.Drawing2D.LinearGradientBrush gb = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, e.Appearance.BackColor2, e.Appearance.BackColor2, System.Drawing.Drawing2D.LinearGradientMode.Horizontal); e.Graphics.FillRectangle(gb, e.Bounds); //e.Graphics.DrawString(xvalue, this.Font, Brushes.MidnightBlue, r); e.Graphics.DrawString(xvalue.ToString("F2"), this.Font, Brushes.MidnightBlue, new PointF(e.Bounds.X + 3, e.Bounds.Y + 1 + (e.Bounds.Height - m_textheight) / 2)); e.Handled = true; } } catch (Exception E) { Console.WriteLine(E.Message); } }
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column == null) { return; } Rectangle rect = e.Bounds; ControlPaint.DrawBorder3D(e.Graphics, e.Bounds); Brush brush = e.Cache.GetGradientBrush(rect, Color.White, Color.LightCyan, e.Column.AppearanceHeader.GradientMode); rect.Inflate(-1, -1); e.Graphics.FillRectangle(brush, rect); e.Appearance.DrawString(e.Cache, e.Info.Caption, e.Info.CaptionRect); //为表头的每一列添加筛选按钮 foreach (DrawElementInfo info in e.Info.InnerElements) { ObjectPainter.DrawObject(e.Cache, info.ElementPainter, info.ElementInfo); } e.Handled = true; }
private void gvwView_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { if (e.Column == null) { return; } if (e.Column.FieldName.ToString().Split(new char[] { '\n' })[0] == _CurrentDay) { Rectangle rect = e.Bounds; rect.Inflate(new Size(1, 1)); Brush brush = new SolidBrush(Color.DodgerBlue); e.Graphics.FillRectangle(brush, rect); string text = e.Column.Caption == "" ? e.Column.FieldName.ToString().Split(new char[] { '\n' })[0] : e.Column.Caption.Split(new char[] { '\n' })[0]; // if (e.Column.Caption == "") return; // string text = e.Column.FieldName.ToString().Split(new char[] { '\n' })[0]; e.Graphics.DrawString(text, e.Appearance.Font, new SolidBrush(Color.White), rect, e.Appearance.GetStringFormat()); e.Handled = true; } }
private void gvFields_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { RepositoryItemCheckEdit CheckItem = new RepositoryItemCheckEdit(); uiHelper.DrawHeaderCheckBox(gvFields, CheckItem, "check", e); }
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { try { switch (m_viewtype) { case InjectionType.Normal: if (fuel_map_x_axis.Length > e.Column.VisibleIndex) { string xvalue = fuel_map_x_axis.GetValue(e.Column.VisibleIndex).ToString(); try { float v = (float)Convert.ToDouble(xvalue); switch (m_mapSensor) { case MapSensorType.MapSensor30: v *= 1.2F; break; case MapSensorType.MapSensor35: v *= 1.4F; break; case MapSensorType.MapSensor40: v *= 1.6F; break; case MapSensorType.MapSensor50: v *= 2.0F; break; } v *= (float)0.01F; v -= 1; xvalue = v.ToString("F2"); } catch (Exception cE) { Console.WriteLine(cE.Message); } Rectangle r = new Rectangle(e.Bounds.X + 1, e.Bounds.Y + 1, e.Bounds.Width - 2, e.Bounds.Height - 2); e.Graphics.DrawRectangle(Pens.LightSteelBlue, r); System.Drawing.Drawing2D.LinearGradientBrush gb = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, e.Appearance.BackColor2, e.Appearance.BackColor2, System.Drawing.Drawing2D.LinearGradientMode.Horizontal); e.Graphics.FillRectangle(gb, e.Bounds); //e.Graphics.DrawString(xvalue, this.Font, Brushes.MidnightBlue, r); e.Graphics.DrawString(xvalue, this.Font, Brushes.MidnightBlue, new PointF(e.Bounds.X + 3, e.Bounds.Y + 1 + (e.Bounds.Height - 12) / 2)); e.Handled = true; } break; case InjectionType.Knocking: if (fuel_knock_map_x_axis.Length > e.Column.VisibleIndex) { string xvalue = fuel_knock_map_x_axis.GetValue(e.Column.VisibleIndex).ToString(); try { float v = (float)Convert.ToDouble(xvalue); switch (m_mapSensor) { case MapSensorType.MapSensor30: v *= 1.2F; break; case MapSensorType.MapSensor35: v *= 1.4F; break; case MapSensorType.MapSensor40: v *= 1.6F; break; case MapSensorType.MapSensor50: v *= 2.0F; break; } v *= (float)0.01F; v -= 1; xvalue = v.ToString("F2"); } catch (Exception cE) { Console.WriteLine(cE.Message); } Rectangle r = new Rectangle(e.Bounds.X + 1, e.Bounds.Y + 1, e.Bounds.Width - 2, e.Bounds.Height - 2); e.Graphics.DrawRectangle(Pens.LightSteelBlue, r); System.Drawing.Drawing2D.LinearGradientBrush gb = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, e.Appearance.BackColor2, e.Appearance.BackColor2, System.Drawing.Drawing2D.LinearGradientMode.Horizontal); e.Graphics.FillRectangle(gb, e.Bounds); //e.Graphics.DrawString(xvalue, this.Font, Brushes.MidnightBlue, r); e.Graphics.DrawString(xvalue, this.Font, Brushes.MidnightBlue, new PointF(e.Bounds.X + 3, e.Bounds.Y + 1 + (e.Bounds.Height - 12) / 2)); e.Handled = true; } break; case InjectionType.Idle: if (idle_fuel_x_axis.Length > e.Column.VisibleIndex) { string xvalue = idle_fuel_x_axis.GetValue(e.Column.VisibleIndex).ToString(); try { float v = (float)Convert.ToDouble(xvalue); switch (m_mapSensor) { case MapSensorType.MapSensor30: v *= 1.2F; break; case MapSensorType.MapSensor35: v *= 1.4F; break; case MapSensorType.MapSensor40: v *= 1.6F; break; case MapSensorType.MapSensor50: v *= 2.0F; break; } v *= (float)0.01F; v -= 1; xvalue = v.ToString("F2"); } catch (Exception cE) { Console.WriteLine(cE.Message); } Rectangle r = new Rectangle(e.Bounds.X + 1, e.Bounds.Y + 1, e.Bounds.Width - 2, e.Bounds.Height - 2); e.Graphics.DrawRectangle(Pens.LightSteelBlue, r); System.Drawing.Drawing2D.LinearGradientBrush gb = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, e.Appearance.BackColor2, e.Appearance.BackColor2, System.Drawing.Drawing2D.LinearGradientMode.Horizontal); e.Graphics.FillRectangle(gb, e.Bounds); //e.Graphics.DrawString(xvalue, this.Font, Brushes.MidnightBlue, r); e.Graphics.DrawString(xvalue, this.Font, Brushes.MidnightBlue, new PointF(e.Bounds.X + 3, e.Bounds.Y + 1 + (e.Bounds.Height - 12) / 2)); e.Handled = true; } break; } } catch (Exception E) { Console.WriteLine(E.Message); } }
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { e.Info.State = DevExpress.Utils.Drawing.ObjectState.Normal; }
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) { }