protected override void DrawHeader(DevExpress.XtraGrid.Views.Layout.ViewInfo.LayoutViewDrawArgs e) { if (!e.ViewInfo.ViewRects.HeaderRect.IsEmpty) { LayoutViewHeaderObjectInfoArgs info = new LayoutViewHeaderObjectInfoArgs(View); info.Bounds = e.ViewInfo.ViewRects.HeaderRect; info.SetAppearance(View.PaintAppearance.HeaderPanel); List <ButtonInfo> buttons = new List <ButtonInfo>(); PrepareSingleModeButton(e, buttons); PrepareRowModeButton(e, buttons); PrepareColumnModeButton(e, buttons); PrepareMultiRowModeButton(e, buttons); PrepareMultiColumnModeButton(e, buttons); PrepareCarouselModeButton(e, buttons); if (View.OptionsBehavior.AllowPanCards) { PreparePanButton(e, buttons); } if (View.OptionsBehavior.AllowRuntimeCustomization) { PrepareCustomizeButton(e, buttons); } // add custom button collections of the current layout view PrepareCustomButtons(e, buttons); info.Buttons = buttons.ToArray(); ObjectPainter.DrawObject(e.Cache, ElementsPainter.HeaderPanel, info); DrawHeaderSeparator(e); if (View.IsDetailView) { DrawCloseZoomButton(e); } } }
private void WaitDialogPaint(object sender, PaintEventArgs e) { Rectangle clipRectangle = e.ClipRectangle; GraphicsCache graphicsCache = new GraphicsCache(e); using (StringFormat stringFormat = new StringFormat()) { Brush solidBrush = graphicsCache.GetSolidBrush(LookAndFeelHelper.GetSystemColor(base.LookAndFeel, SystemColors.WindowText)); stringFormat.Alignment = (stringFormat.LineAlignment = StringAlignment.Center); stringFormat.Trimming = StringTrimming.EllipsisCharacter; if (base.LookAndFeel.ActiveLookAndFeel.ActiveStyle == ActiveLookAndFeelStyle.Skin) { ObjectPainter.DrawObject(graphicsCache, new SkinTextBorderPainter(base.LookAndFeel), new BorderObjectInfoArgs(null, clipRectangle, null)); } else { ControlPaint.DrawBorder3D(e.Graphics, clipRectangle, Border3DStyle.RaisedInner); } clipRectangle.X += 30; clipRectangle.Width -= 30; clipRectangle.Height /= 3; clipRectangle.Y += clipRectangle.Height / 2; e.Graphics.DrawString(this.title, this.BoldFont, solidBrush, clipRectangle, stringFormat); clipRectangle.Y += clipRectangle.Height; e.Graphics.DrawString(this.caption, this.RegularFont, solidBrush, clipRectangle, stringFormat); graphicsCache.Dispose(); } }
private Bitmap GetPicture() { if (downHitInfo == null) { return(null); } LayoutViewCard layoutCard = downHitInfo.HitCard; if (layoutCard == null) { return(null); } Rectangle r = new Rectangle(0, 0, Width * 2, Height * 2); using (Bitmap bmp = new Bitmap(r.Width, r.Height, PixelFormat.Format32bppArgb)) { using (Graphics imgGraphics = Graphics.FromImage(bmp)) { using (XtraBufferedGraphics bufferedGraphics = XtraBufferedGraphicsManager.Current.Allocate(imgGraphics, r)) { ObjectPainter cardPainter = (layoutView1 as ILayoutControl).PaintStyle.GetPainter(layoutCard); bufferedGraphics.Graphics.Clear(Color.White); layoutCard.ViewInfo.Cache = new GraphicsCache(new DXPaintEventArgs(bufferedGraphics.Graphics, r)); PropertyInfo property = typeof(LayoutView).GetProperty("DrawCard", BindingFlags.Instance | BindingFlags.NonPublic); property.SetValue(layoutView1, layoutCard, null); cardPainter.DrawObject(layoutCard.ViewInfo); layoutCard.ViewInfo.Cache = null; bufferedGraphics.Render(); } Bitmap newImage = Copy(bmp, layoutCard.Bounds); return(newImage); } } }
public override void DrawObject(ObjectInfoArgs e) { RibbonViewInfo vi = (RibbonViewInfo)((RibbonDrawInfo)e).ViewInfo; if (vi.Caption.Bounds.IsEmpty || !e.Cache.IsNeedDrawRect(vi.Caption.Bounds)) { return; } //ObjectPainter.DrawObject(e.Cache, SkinElementPainter.Default, vi.Caption.GetCaptionDrawInfo()); Rectangle captionRectangle = vi.Caption.Bounds; Brush br = (vi.Ribbon as CustomRibbonControl).CaptionColor == Color.Empty ? Brushes.White : new SolidBrush((vi.Ribbon as CustomRibbonControl).CaptionColor); // e.Cache.Paint.FillRectangle(e.Cache.Graphics, br, vi.Caption.Bounds); if (vi.ShouldUseAppButtonContainerControlBkgnd && (vi.Caption as CustomRibbonCaptionViewInfo).CanGetFormButtonsBoundsEx) { Rectangle rect = (vi.Caption as CustomRibbonCaptionViewInfo).FormButtonBoundsEx; if (!rect.IsEmpty) { ObjectPainter.DrawObject(e.Cache, SkinElementPainter.Default, (vi as CustomRibbonViewInfo).GetAppButtonContainerInfoEx(Rectangle.Inflate(rect, 1, 1))); } } DrawCaption(e); DrawPageHeaderBackground(e, true); if ((vi.Caption as CustomRibbonCaptionViewInfo).FormPainterEx != null) { (vi.Caption as CustomRibbonCaptionViewInfo).FormPainterEx.DrawIcon(e.Cache); } if ((vi.Caption as CustomRibbonCaptionViewInfo).FormPainterEx != null) { (vi.Caption as CustomRibbonCaptionViewInfo).FormPainterEx.DrawButtons(e.Cache, false); } DrawPageCategories(e as RibbonDrawInfo); }
protected override void DoDrawGlyph(ControlGraphicsInfoArgs info, TokenEditTokenInfo tokenInfo) { base.DoDrawGlyph(info, tokenInfo); if (editor.Properties.CheckBoxSkinElement != null) { int index = 0; CustomTokenEditTokenInfo customTokenInfo = tokenInfo as CustomTokenEditTokenInfo; int offset = customTokenInfo.Checked == true ? 4 : 0; Rectangle rect = customTokenInfo.CheckBoxGlyphBounds; Rectangle r = new Rectangle(rect.X + (int)info.Graphics.ClipBounds.X, rect.Y + (int)info.Graphics.ClipBounds.Y, rect.Width, rect.Height); SkinElementInfo skinElementInfo = new SkinElementInfo(editor.Properties.CheckBoxSkinElement, r); switch (customTokenInfo.CheckBoxState) { case ObjectState.Normal: index = offset; break; case ObjectState.Hot: index = offset + 1; break; case ObjectState.Hot | ObjectState.Pressed: index = offset + 2; break; } skinElementInfo.ImageIndex = index; ImageCollection imageCollection = editor.Properties.CheckBoxSkinElement.Image.GetImages(); info.Graphics.DrawImage(imageCollection.Images[index], new Rectangle(rect.X + (int)info.Graphics.ClipBounds.X, rect.Y + (int)info.Graphics.ClipBounds.Y, rect.Width, rect.Height)); ObjectPainter.DrawObject(info.Cache, SkinElementPainter.Default, skinElementInfo); } }
private void OnCustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e) { //背景颜色没有设置且为空,则默认 if (e.Column == null || (e.Column.AppearanceHeader.BackColor == Color.Empty && !e.Column.AppearanceHeader.Options.UseBackColor)) { return; } Rectangle rect = e.Bounds; //rect.Inflate(-1, -1); // 填充标题颜色. e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(180, e.Column.AppearanceHeader.BackColor)), rect); e.Appearance.DrawString(e.Cache, e.Info.Caption, e.Info.CaptionRect); Pen pen = new Pen(Color.LightGray, 0.1f); e.Graphics.DrawRectangle(pen, rect); // 绘制过滤和排序按钮. foreach (DrawElementInfo info in e.Info.InnerElements) { if (!info.Visible) { continue; } ObjectPainter.DrawObject(e.Cache, info.ElementPainter, info.ElementInfo); } e.Handled = true; }
///<summary>Raises the Paint event.</summary> protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); superTipInfoArgs.Bounds = ClientRectangle; superTipInfoArgs.Cache = new GraphicsCache(e); superTipPainter.DrawObject(superTipInfoArgs); }
void gridView1_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e) { GridGroupRowInfo info = (GridGroupRowInfo)e.Info; string groupText = info.GroupText; info.GroupText = "[#image]"; //default drawing _GridPainter.ElementsPainter.GroupRow.DrawGroupRowBackground(e.Info); ObjectPainter.DrawObject(e.Cache, _GridPainter.ElementsPainter.GroupRow, e.Info); info.GroupText = groupText; //draw caption Rectangle bounds = info.ButtonBounds; bounds.X = bounds.Right + 20; bounds.Width = info.Bounds.Right - bounds.Right - progressBarWidth; bounds.Offset(progressBarWidth, 0); info.CreateEditorInfo(bounds, info.Appearance.GetForeColor()); ObjectPainter.DrawObject(e.Cache, info.CreatePainter(), info.EditorInfo); //draw progressbar bounds = info.ButtonBounds; bounds.X = bounds.Right + 5; bounds.Width = progressBarWidth; bounds.Inflate(0, 2); ProgressBarBaseViewInfo vi = CreateViewInfo(bounds, (float)0.50, e.Graphics); ControlGraphicsInfoArgs args = new ControlGraphicsInfoArgs(vi, e.Cache, bounds); _PBPainter.Draw(args); e.Handled = true; }
private void gridView1_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e) { if (e.Column == null) { return; } var rect = e.Bounds; ControlPaint.DrawBorder3D(e.Graphics, e.Bounds); var 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 (DrawElementInfo info in e.Info.InnerElements) { if (!info.Visible) { continue; } ObjectPainter.DrawObject(e.Cache, info.ElementPainter, info.ElementInfo); } e.Handled = true; }
protected override void DrawContent(ControlGraphicsInfoArgs info) { SliderViewInfo vi = info.ViewInfo as SliderViewInfo; vi.TrackInfo.Bounds = info.Bounds; vi.TrackInfo.State = vi.TrackInfo.ViewInfo.State; ObjectPainter.DrawObject(info.Cache, vi.SliderPainter, vi.TrackInfo); }
protected virtual void DrawSelection(ControlGraphicsInfoArgs info) { DateTapeViewInfo dateViewInfo = info.ViewInfo as DateTapeViewInfo; HighlightedItemInfo.Bounds = dateViewInfo.SelectionBounds; HighlightedItemInfo.Graphics = info.Graphics; ObjectPainter.DrawObject(info.Cache, SkinElementPainter.Default, HighlightedItemInfo); }
protected override void DrawContent(ControlGraphicsInfoArgs info) { ProgressBarBaseViewInfo vi = info.ViewInfo as ProgressBarBaseViewInfo; RepositoryItemCircledProgressBar item = (RepositoryItemCircledProgressBar)vi.Item; ObjectPainter.DrawObject(info.Cache, vi.ProgressPainter, vi.ProgressInfo); info.Graphics.DrawEllipse(new Pen(item.Appearance.BackColor), CalcProportionalBorderRectangle(info.Bounds, item.CustomBehavior.MinWidthHeightProportion)); DrawCircledProgressBarString(info); }
private void gridView1_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo info; info = e.Info as DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo; info.ButtonBounds = Rectangle.Empty; info.GroupText = " " + info.GroupText.TrimStart(); e.Cache.FillRectangle(e.Appearance.GetBackBrush(e.Cache), e.Bounds); ObjectPainter.DrawObject(e.Cache, e.Painter, e.Info); e.Handled = true; }
void DrawButton(ControlGraphicsInfoArgs info) { IPhoneCheckEditViewInfo view = (info.ViewInfo as IPhoneCheckEditViewInfo); SkinElement e = CommonSkins.GetSkin(view.LookAndFeel)[CommonSkins.SkinButton]; SkinElementInfo ei = new SkinElementInfo(e, view.ButtonRect) { ImageIndex = view.ButtonImageIndex }; ObjectPainter.DrawObject(info.Cache, SkinElementPainter.Default, ei); }
protected override void FillBackground(GraphicsCache cache, Rectangle r) { if (LookAndFeel.ActiveLookAndFeel.Style == DevExpress.LookAndFeel.LookAndFeelStyle.Skin) { SkinElement element = CommonSkins.GetSkin(LookAndFeel)[CommonSkins.SkinForm]; SkinElementInfo info = new SkinElementInfo(element, r); ObjectPainter.DrawObject(cache, SkinElementPainter.Default, info); } else { cache.Graphics.FillRectangle(SystemBrushes.Control, r); } }
private void DrawButtons(TileControlViewInfo viewInfo, PaintEventArgs e) { foreach (TileGroupViewInfo group in viewInfo.Groups) { Rectangle rect = GetButtonRectangle(group); using (GraphicsCache cache = new GraphicsCache(e)) { var element = SkinManager.GetSkinElement(SkinProductId.Common, UserLookAndFeel.Default, CommonSkins.SkinButton); var info = new SkinElementInfo(element, rect); ObjectPainter.DrawObject(cache, SkinElementPainter.Default, info); viewInfo.PaintAppearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; viewInfo.PaintAppearance.DrawString(cache, ButtonCaption, rect); } } }
protected virtual void DrawCells(GraphicsCache cache) { foreach (CellViewInfo cellInfo in PopupViewInfo.CellsList) { drawPen.Color = PopupViewInfo.PopupAppearance.BackColor; if (cellInfo.isSelected) { ObjectPainter.DrawObject(cache, SkinElementPainter.Default, GetCellElementInfo(cellInfo, cache, true)); drawPen.Color = PopupViewInfo.PopupAppearance.BackColor2; } if (cellInfo.isHotPointed) { ObjectPainter.DrawObject(cache, SkinElementPainter.Default, GetCellElementInfo(cellInfo, cache, false)); drawPen.Color = PopupViewInfo.PopupAppearance.BackColor2; } cache.Graphics.DrawString(cellInfo.CellText, cellInfo.cellTextFont, drawPen.Brush, SetTextPoint(cellInfo, cache.Graphics)); } }
private void galleryView_CustomDrawItem(object sender, DevExpress.XtraGrid.Views.WinExplorer.WinExplorerViewCustomDrawItemEventArgs e) { if (!e.IsAnimated) { SkinElementInfo info = new SkinElementInfo(CustomSkinHelper.CustomGalleryBorder, e.Bounds); info.ImageIndex = 0; if (e.ItemInfo.IsHovered) { info.ImageIndex = 1; } else if (e.ItemInfo.IsPressed || e.ItemInfo.IsSelected) { info.ImageIndex = 2; } ObjectPainter.DrawObject(e.Cache, SkinElementPainter.Default, info); } e.DrawItemImage(); e.DrawContextButtons(); e.Handled = true; }
protected void DrawClear(bool isHot, AppearanceObject app, GraphicsCache cache, Rectangle rect) { if (rect.IsEmpty) { return; } Brush br = app.GetForeBrush(cache); if (isHot) { SkinElementInfo skin = new SkinElementInfo(CommonSkins.GetSkin(DevExpress.LookAndFeel.UserLookAndFeel.Default.ActiveLookAndFeel)[CommonSkins.SkinHighlightedItem], rect); br = new SolidBrush(DevExpress.LookAndFeel.LookAndFeelHelper.GetSystemColor( DevExpress.LookAndFeel.UserLookAndFeel.Default.ActiveLookAndFeel, SystemColors.HotTrack)); ObjectPainter.DrawObject(cache, SkinElementPainter.Default, skin); } StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Center; cache.DrawString("Clear", app.Font, br, rect, format); }
private void DrawButton(GraphicsCache cache, EditorButtonObjectInfoArgs button) { var state = ObjectState.Normal; if (!button.Button.Enabled) { state = ObjectState.Disabled; } else { if (HotButton == button.Button) { state |= ObjectState.Hot; } if (PressedButton == button.Button) { state |= ObjectState.Pressed; } } button.State = state; ObjectPainter.DrawObject(cache, Painter, button); }
/// <summary> /// 自定义表头颜色 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bandedGridView1_CustomDrawBandHeader(object sender, DevExpress.XtraGrid.Views.BandedGrid.BandHeaderCustomDrawEventArgs e) { //背景颜色没有设置且为空,则默认 if (e.Band.AppearanceHeader == null || (e.Band.AppearanceHeader.BackColor == Color.Empty && !e.Band.AppearanceHeader.Options.UseBackColor)) { return; } Rectangle rect = e.Bounds; rect.Inflate(-1, -1); // 填充标题颜色. e.Graphics.FillRectangle(new SolidBrush(e.Band.AppearanceHeader.BackColor), rect); e.Appearance.DrawString(e.Cache, e.Info.Caption, e.Info.CaptionRect); // 绘制过滤和排序按钮. foreach (DrawElementInfo info in e.Info.InnerElements) { if (!info.Visible) { continue; } ObjectPainter.DrawObject(e.Cache, info.ElementPainter, info.ElementInfo); } 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, 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; }
void DrawSkinImage(GraphicsCache cache, SkinElementInfo info) { ObjectPainter.DrawObject(cache, SkinElementPainter.Default, info); }