Exemple #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);
        }