예제 #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);
        }
예제 #3
0
        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));
        }
예제 #4
0
        protected override void DrawMatchedString(ControlGraphicsInfoArgs info, Rectangle bounds, string text,
                                                  string matchedText, AppearanceObject appearance, bool invert, int containsIndex)
        {
            TextEditViewInfo vi = info.ViewInfo as TextEditViewInfo;

            if (matchedText.Length > text.Length)
            {
                matchedText = text;
            }
            RepositoryItemMyTextEdit properties = (RepositoryItemMyTextEdit)vi.Item;
            AppearanceDefault        highlight  = new AppearanceDefault(properties.IncrementalForeColor, properties.IncrementalBackColor);

            info.Cache.Paint.DrawMultiColorString(info.Cache, bounds, text, matchedText, appearance, appearance.GetTextOptions().GetStringFormat(info.ViewInfo.DefaultTextOptions),
                                                  highlight.ForeColor, highlight.BackColor, invert, containsIndex);
        }