예제 #1
0
        private void DrawButton(GraphicsCache cache, Rectangle bounds, ActiveLookAndFeelStyle lookAndFeel, AppearanceObject appearance, ObjectState state, string caption, bool drawIcon)
        {
            EditorButtonObjectInfoArgs args     = new EditorButtonObjectInfoArgs(cache, Button, appearance);
            BaseLookAndFeelPainters    painters = LookAndFeelPainterHelper.GetPainter(lookAndFeel);

            // Create some margin
            bounds.Inflate(-BUTTONMARGIN, -BUTTONMARGIN);

            args.Bounds = bounds;
            args.State  = state;

            painters.Button.DrawObject(args);

            if (drawIcon)
            {
                Image calcIcon = Microsoft.Dynamics.Retail.Pos.Dialog.Properties.Resources.PriceCalc;
                if (calcIcon != null)
                {
                    // Determine origin point to draw centered
                    int x = args.Bounds.Left + ((args.Bounds.Width - calcIcon.Width) / 2);
                    int y = args.Bounds.Top + ((args.Bounds.Height - calcIcon.Height) / 2);

                    if (state == ObjectState.Disabled)
                    {
                        ControlPaint.DrawImageDisabled(cache.Graphics, calcIcon, x, y, Color.Transparent);
                    }
                    else
                    {
                        cache.Graphics.DrawImageUnscaled(calcIcon, x, y);
                    }
                }
            }
            else
            {
                // Draw the text
                // DO NOT dispose of the brush, as it is owned by the cache
                Brush brush = GetButtonForeBrush(state, cache);

                StringFormat sf = appearance.GetStringFormat(appearance.GetTextOptions());
                painters.Button.DrawCaption(args, caption, appearance.Font, brush, args.Bounds, sf);
            }
        }
        private void DrawButton(GraphicsCache cache, Rectangle bounds, ActiveLookAndFeelStyle lookAndFeel, AppearanceObject appearance, ObjectState state, string caption)
        {
            EditorButtonObjectInfoArgs args     = new EditorButtonObjectInfoArgs(cache, Button, appearance);
            BaseLookAndFeelPainters    painters = LookAndFeelPainterHelper.GetPainter(lookAndFeel);

            // Create some margin
            bounds.Inflate(-BUTTONMARGIN, -BUTTONMARGIN);

            args.Bounds = bounds;
            args.State  = state;

            painters.Button.DrawObject(args);

            // Draw the text
            // DO NOT dispose of Brush, as it is owned by the cache.
            Brush        brush = gridView.Appearance.HeaderPanel.GetForeBrush(cache);
            StringFormat sf    = appearance.GetStringFormat(appearance.GetTextOptions());

            painters.Button.DrawCaption(args, caption, appearance.Font, brush, args.Bounds, sf);
        }
        protected override void DrawHeaderPageText(TabDrawArgs e, DevExpress.XtraTab.ViewInfo.BaseTabPageViewInfo pInfo)
        {
            //base.DrawHeaderPageText(e, pInfo);
            //
            int angle = 0;

            if (e.ViewInfo.HeaderInfo.RealPageOrientation == TabOrientation.Vertical)
            {
                angle = 270;
                if (e.ViewInfo.HeaderInfo.IsLeftLocation || e.ViewInfo.HeaderInfo.IsTopLocation)
                {
                    angle = 270;
                }
            }
            AppearanceObject a = pInfo.PaintAppearance;

            System.Drawing.Text.HotkeyPrefix?hotKeyPrefixOverride = (a.TextOptions.HotkeyPrefix == HKeyPrefix.Default) || pInfo.UseHotkeyPrefixDrawModeOverride ?
                                                                    new System.Drawing.Text.HotkeyPrefix?(pInfo.HotkeyPrefixDrawModeOverride) : null;
            //default for Brusher.Green was e.Cache.GetSolidBrush(CheckHeaderPageForeColor(e, pInfo))
            DrawVString(e.Cache, pInfo.Page.Text,
                        a.GetFont(), Brushes.Green,
                        a.GetStringFormat(), pInfo.Text, angle, hotKeyPrefixOverride);
        }
예제 #4
0
        protected override void DrawText(GraphicsCache cache)
        {
            string text = Text;

            if (text == null || text.Length == 0 || TextBounds.IsEmpty)
            {
                return;
            }
            AppearanceObject appearance = new AppearanceObject(GetDefaultAppearance());

            appearance.Font = Owner.Font;
            appearance.TextOptions.Trimming = Trimming.EllipsisCharacter;
            Rectangle r = RectangleHelper.GetCenterBounds(TextBounds, new Size(TextBounds.Width, appearance.CalcDefaultTextSize(cache.Graphics).Height));

            DrawTextShadow(cache, appearance, r);
            cache.DrawString(text, appearance.Font, appearance.GetForeBrush(cache), r, appearance.GetStringFormat());
        }
    protected override void DrawText(DevExpress.Utils.Drawing.GraphicsCache cache)
    {
        string text = Text;

        if (text == null || text.Length == 0 || TextBounds.IsEmpty)
        {
            return;
        }
        using (AppearanceObject appearance = new AppearanceObject(GetDefaultAppearance())) {
            appearance.TextOptions.Trimming   = Trimming.EllipsisCharacter;
            appearance.TextOptions.HAlignment = HorzAlignment.Center;
            if (AllowHtmlDraw)
            {
                DrawHtmlText(cache, appearance);
                return;
            }
            Rectangle r = RectangleHelper.GetCenterBounds(TextBounds, new Size(TextBounds.Width, CalcTextHeight(cache.Graphics, appearance)));
            DrawTextShadow(cache, appearance, r);
            cache.DrawString(text, appearance.Font, appearance.GetForeBrush(cache), r, appearance.GetStringFormat());
        }
    }
 void MyTreeList_PaintEx(object sender, TreeListPaintEventArgs e)
 {
     foreach (RowInfo rowInfo in ViewInfo.RowsInfo.Rows)
     {
         Rectangle bounds = rowInfo.Bounds;
         bounds.Width = 14;
         e.Cache.DrawString(Helper.GetIndexByNode(rowInfo.Node).ToString(), indexPaintAppearance.Font, indexPaintAppearance.ForeColor, bounds, indexPaintAppearance.GetStringFormat());
     }
 }