Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        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;
        }
 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);
         }
     }
 }
        protected override Size CalcLargeButtonSizeCore(GraphicsCache cache, RibbonItemViewInfo item, bool drawArrow)
        {
            Size client     = (ViewInfo as CustomRibbonViewInfo).LargeImageSize;
            int  width      = GetButtonWidthByLevel(item);
            int  arrowWidth = (drawArrow ? ArrowIndent + ViewInfo.ButtonArrowSize.Width : 0);

            if (width != 0)
            {
                item.ShouldWrapText = ShouldWrapLargeButtonText(cache, item, drawArrow, GetLargeButtonElementInfo(item));
                return(new Size(width, ViewInfo.LargeButtonHeight));
            }
            else
            {
                item.ShouldWrapText = ShouldWrapItemText(item);
            }
            string[] text      = WrapText(item);
            int      textWidth = Math.Max(CalcLineTextSize(cache, item.Appearance, text[0]).Width,
                                          CalcLineTextSize(cache, item.Appearance, text[1]).Width + ((item.ViewInfo as CustomRibbonViewInfo).GetRibbonStyle() == RibbonControlStyle.MacOffice ? 0 : arrowWidth));

            client.Width = Math.Max(textWidth, client.Width);
            Size res = ObjectPainter.CalcBoundsByClientRectangle(cache, SkinElementPainter.Default, GetLargeButtonElementInfo(item), new Rectangle(Point.Empty, client)).Size;

            res.Width  = Math.Max(ViewInfo.LargeButtonMinWidth, res.Width);
            res.Width += arrowWidth;
            IRibbonGroupInfo groupInfo = item.Owner as IRibbonGroupInfo;

            res.Height = groupInfo != null ? groupInfo.LargeRibbonButtonHeight : ViewInfo.LargeButtonHeight;
            if (width != 0)
            {
                res.Width = width;
            }
            return(res);
        }
        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;
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        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 int CalcLargeButtonHeightCore(GraphicsCache cache, bool singleLine)
        {
            Size client     = (ViewInfo as CustomRibbonViewInfo).LargeImageSize;
            int  textHeight = GetLargeButtonTextHeight(singleLine);

            client.Height = client.Height + textHeight + CaptionVGlyphIndent;
            return(ObjectPainter.CalcBoundsByClientRectangle(cache, SkinElementPainter.Default, GetLargeButtonElementInfo(null), new Rectangle(Point.Empty, client)).Height);
        }
        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);
        }
Ejemplo n.º 13
0
        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);
        }
        public override int CalcLargeSplitButtonHeight(GraphicsCache cache)
        {
            Size client     = (ViewInfo as CustomRibbonViewInfo).LargeImageSize;
            int  textHeight = GetLargeButtonTextHeight();
            int  height     = ObjectPainter.CalcBoundsByClientRectangle(cache, SkinElementPainter.Default, GetLargeSplitButtonElementInfo(null), new Rectangle(Point.Empty, client)).Height;

            height += ObjectPainter.CalcBoundsByClientRectangle(cache, SkinElementPainter.Default, GetLargeSplitButtonElementInfo2(null), new Rectangle(Point.Empty, new Size(16, textHeight))).Height;
            return(height);
        }
Ejemplo n.º 15
0
        public override void CalcColumnInfo(ColumnInfo ci, ref int left, bool customization)
        {
            int offset = 0;

            base.CalcColumnInfo(ci, ref offset, customization);
            if (ci.Type == ColumnInfo.ColumnInfoType.Column)
            {
                MyTreeListBand ParentBand = TreeList.Bands.GetColumnParentBand(ci.Column);
                if (ParentBand == null)
                {
                    ci.Bounds = Rectangle.Empty;
                    return;
                }
                MyTreeListBandInfo bi = new MyTreeListBandInfo(ParentBand);
                bi.CalcBandInfo(this);
                int VisiblePosition = ParentBand.GetColumnIndex(ci.Column);
                if (ParentBand.BandColumn == ci.Column)
                {
                    ci.Bounds      = bi.Bounds;
                    ci.CaptionRect = new Rectangle(left + 4, 0, bi.Bounds.Width, bi.Bounds.Height);
                    if (BandLinks.ContainsKey(ci.Column))
                    {
                        BandLinks[ci.Column] = bi;
                    }
                    else
                    {
                        BandLinks.Add(ci.Column, bi);
                    }
                }
                else
                {
                    int X = bi.Bounds.X;
                    for (int i = 0; i < VisiblePosition; i++)
                    {
                        TreeListColumn Col = ParentBand.GetColumn(i);
                        if ((Col != null) && Col.Visible)
                        {
                            X += Col.Width;
                        }
                    }
                    int Y      = bi.Bounds.Bottom - 1;
                    int Width  = ci.Column.Width;
                    int Height = BandHeight * (BandMaxLevel - ParentBand.Level);
                    ci.Bounds      = new Rectangle(X, Y, Width, Height);
                    ci.CaptionRect = new Rectangle(left + 4, 0, Width, Height);
                    ColCount++;
                    left += Width;
                }
            }
            else
            {
                left += offset;
            }
            UpdateGlyphInfo(ci);
            ObjectPainter.CalcObjectBounds(GInfo.Graphics, TreeList.ElementsLookAndFeel.Painter.Header, ci);
        }
Ejemplo n.º 16
0
 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);
        }
Ejemplo n.º 18
0
 protected virtual EditorButtonObjectInfoArgs PrepareButton(ButtonsPanelInfo viewInfo, Graphics g, Rectangle bounds, EditorButtonObjectInfoArgs button)
 {
     g = GraphicsInfo.Default.AddGraphics(g);
     try {
         var min = ObjectPainter.CalcObjectMinBounds(g, viewInfo.Painter, button);
         button.Bounds = min;
     } finally {
         GraphicsInfo.Default.ReleaseGraphics();
     }
     return(button);
 }
Ejemplo n.º 19
0
        int CalcGalleryItemMargins()
        {
            SkinWinExplorerViewInfo viewInfo = this.galleryView.GetViewInfo() as SkinWinExplorerViewInfo;

            if (viewInfo == null)
            {
                return(0);
            }
            SkinElementInfo info   = viewInfo.GetItemBackgroundInfo();
            Rectangle       bounds = ObjectPainter.CalcBoundsByClientRectangle((GraphicsCache)null, SkinElementPainter.Default, info, new Rectangle(0, 0, 100, 100));

            return(bounds.Width - 100);
        }
Ejemplo n.º 20
0
 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);
     }
 }
Ejemplo n.º 21
0
 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));
     }
 }
 protected override void CalcButtonRectsCore(EditorButtonObjectCollection collection)
 {
     for (int n = collection.Count - 1; n >= 0; n--)
     {
         EditorButtonObjectInfoArgs info = collection[n];
         ObjectPainter painter           = ViewInfo.GetButtonPainter(info);
         Rectangle     buttonRect        = painter.CalcObjectMinBounds(info);
         buttonRect.Width += 10;
         buttonRect        = new Rectangle(this.ClientRect.X, this.ClientRect.Y, buttonRect.Width, this.ClientRect.Height);
         Rectangle realButtonRect = buttonRect;
         info.Bounds = realButtonRect;
         painter.CalcObjectBounds(info);
         this.ClientRect.Width -= buttonRect.Width;
         if (this.IsLeft)
         {
             this.ClientRect.X += buttonRect.Width;
         }
     }
 }
        public override void CalcLargeButtonViewInfo(GraphicsCache cache, RibbonItemViewInfo item)
        {
            Rectangle       glyph, bounds = item.Bounds;
            SkinElementInfo info = GetLargeButtonElementInfo(item);

            info.Bounds = bounds;
            Rectangle client = ObjectPainter.GetObjectClientRectangle(cache, SkinElementPainter.Default, info);

            glyph            = client;
            glyph.Size       = (ViewInfo as CustomRibbonViewInfo).LargeImageSize;
            glyph.X         += (client.Width - glyph.Width) / 2;
            item.GlyphBounds = glyph;
            IRibbonGroupInfo groupInfo = item.Owner as IRibbonGroupInfo;
            Rectangle        caption   = client;

            caption.Height     = GetLargeButtonTextHeight(groupInfo != null && groupInfo.IsSingleLineLargeButton);
            caption.Y          = client.Bottom - caption.Height;
            item.CaptionBounds = caption;
        }
Ejemplo n.º 25
0
 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;
 }
Ejemplo n.º 26
0
        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);
        }
Ejemplo n.º 27
0
        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);
        }
Ejemplo n.º 28
0
        /// <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;
        }
Ejemplo n.º 29
0
        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);
 }