public static void DrawStringDefaultColor(this AppearanceObject app, GraphicsCache cache, string text, Rectangle bounds, Brush foreground) { if (foreground != null) { app.DrawString(cache, text, bounds, foreground); } else { app.DrawString(cache, text, bounds); } }
private void imageListBoxControl1_Paint(object sender, PaintEventArgs e) { Rectangle bounds = imageListBoxControl1.ClientRectangle; bounds.Y = bounds.Height - 10; bounds.Height = 10; e.Graphics.DrawLine(Pens.Red, bounds.Location, new Point(bounds.Width, bounds.Y)); _appObject.ForeColor = Color.Black; _appObject.DrawString(new GraphicsCache(e.Graphics), "Custom menu", bounds); bounds.Offset(-1, -1); _appObject.ForeColor = Color.Yellow; _appObject.DrawString(new GraphicsCache(e.Graphics), "Custom menu", bounds); }
private void DrawAutoFilterRowText(GridView view, GraphicsCache cache, Rectangle r) { AppearanceObject appearance = view.PaintAppearance.TopNewRow; appearance.DrawBackground(cache, r); appearance.DrawString(cache, _AutoFilterText, r); }
private void DrawString(CheckedListBoxViewInfo.CheckedItemInfo itInfo, AppearanceObject appearance, GraphicsCache cache) { Rectangle textRect = new Rectangle(itInfo.TextRect.X + RepositoryItemCheckedImageComboBoxEdit.ImageWidth + 2, itInfo.TextRect.Y, itInfo.TextRect.Width - RepositoryItemCheckedImageComboBoxEdit.ImageWidth - 2, itInfo.TextRect.Height); appearance.DrawString(cache, itInfo.Text, textRect); }
void DrawTitle(ControlGraphicsInfoArgs info) { if ((info.ViewInfo as ProgressBarViewInfo).Item.ShowTitle) { Rectangle bounds = info.Bounds; AppearanceObject obj = new AppearanceObject(info.ViewInfo.PaintAppearance); obj.ForeColor = Color.White; obj.DrawString(info.Cache, info.ViewInfo.DisplayText, bounds); bounds.Offset(1, 1); info.ViewInfo.PaintAppearance.DrawString(info.Cache, info.ViewInfo.DisplayText, bounds); } }
void gridView_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column != colArea) { return; } ListVoteResults lr = gridView.GetRow(e.RowHandle) as ListVoteResults; if (lr == null) { return; } int votes = 0; Color color = Color.Empty; if (IsCountyMode) { votes = lr.DemVotes == 0 ? lr.RepVotes : lr.DemVotes; color = lr.RepVotes > lr.DemVotes ? colorizer.RepColor : colorizer.DemColor; } else { votes = lr.DemElectoralVotes == 0 ? lr.RepElectoralVotes : lr.DemElectoralVotes; color = lr.DemElectoralVotes == 0 ? colorizer.RepColor : colorizer.DemColor; } if (votes == 0) { return; } e.Appearance.BackColor = color; e.Appearance.ForeColor = Color.White; e.DefaultDraw(); e.Handled = true; if (IsCountyMode) { return; } Rectangle bounds = e.Bounds; AppearanceObject app = new AppearanceObject() { ForeColor = Color.White }; app.TextOptions.HAlignment = HorzAlignment.Far; app.TextOptions.VAlignment = VertAlignment.Bottom; app.DrawString(e.Cache, votes.ToString(), bounds); }
protected override void DrawString(ControlGraphicsInfoArgs info, Rectangle bounds, string text, AppearanceObject appearance) { ButtonEditViewInfo vi = info.ViewInfo as ButtonEditViewInfo; int buttonsWidth = CalcButtonsWidth(info); int text_width = vi.Bounds.Width - buttonsWidth; if (text_width <= 1) { text_width = vi.ClientRect.Width; } bounds = new Rectangle(bounds.X, bounds.Y, text_width, bounds.Height); appearance.DrawString(info.Cache, text, bounds, appearance.GetForeBrush(info.Cache), appearance.GetTextOptions().GetStringFormat(info.ViewInfo.DefaultTextOptions)); }
private void schedulerControl1_CustomDrawResourceHeader(object sender, DevExpress.XtraScheduler.CustomDrawObjectEventArgs e) { DevExpress.XtraScheduler.Drawing.ResourceHeader resourceHeader = e.ObjectInfo as ResourceHeader; if (resourceHeader != null) { DataRowView rowView = (DataRowView)resourceHeader.Resource.GetRow(schedulerControl1.Storage); if (rowView != null) { string dtstartTime = ACMS.Convert.ToDateTime(rowView["dtStartTime"]).ToString("T"); string dtEndTime = ACMS.Convert.ToDateTime(rowView["dtEndTime"]).ToString("T"); string strCaption = resourceHeader.Resource.Caption + "\n" + dtstartTime + " -- " + dtEndTime; AppearanceObject appObj = resourceHeader.Appearance.Selection; appObj.Font = new Font(appObj.Font.FontFamily.Name, 7); appObj.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; appObj.BackColor = Color.White; appObj.DrawBackground(e.Graphics, e.Cache, e.Bounds, false); appObj.DrawString(e.Cache, strCaption, e.Bounds); e.Handled = true; } } }
void DrawText(GraphicsCache cache) { AppearanceObject.DrawString(cache, ButtonText, ButtonRectangle); }