예제 #1
0
        public ButtonClient(CommandButton commandButton)
        {
            _commandButton          = commandButton;
            _commandButton.Changed += new CommandControlChangedEventHandler(this.ClientUpdate);
            this.Dock = DockStyle.None;
            Debug.Assert(_commandButton.Icon != null, "CommandButton has null icon: " + _commandButton.GetType());
            _bitmap = new Bitmap(16, 16, PixelFormat.Format32bppArgb);
            BitmapUtils.CopyBitmapData(_commandButton.Icon.ToBitmap(), _bitmap);
            BitmapUtils.SetTransparency(_bitmap, Color.Magenta);
            _bitmapDark       = ExoControlUtils.CreateDisabledBitmap(_bitmap, 192, 64);
            _bitmapUnselected = ExoControlUtils.CreateContrastedBitmap(_bitmap, 0.8f);

            this.Size    = new Size(22, 22);
            this.Layout += new LayoutEventHandler(this.OnLayout);
        }
예제 #2
0
        public void DrawCheckmark(Graphics g, Rectangle bounds, bool selected)
        {
            if (bitmapCheckmark == null)
            {
                bitmapCheckmark = ExocortexResources.GetIcon("menuCheckmark.ico").ToBitmap();
                ExoControlUtils.SetBitmapTransparency(bitmapCheckmark, Color.Magenta);
            }
            int checkTop  = bounds.Top + (itemHeight - BITMAP_SIZE) / 2;
            int checkLeft = bounds.Left + (STRIPE_WIDTH - BITMAP_SIZE) / 2;

            if (selected)
            {
                Color darker = ScaleColor(selectionColor, 0.8f);                   //.A, (int)(selectionColor.R * 0.8), (int)(selectionColor.G * 0.8), (int)(selectionColor.B * 0.8) );
                g.FillRectangle(new SolidBrush(darker), checkLeft - 1, checkTop - 1, BITMAP_SIZE + 3, BITMAP_SIZE + 3);
            }
            else
            {
                Color lighter = ScaleColor(selectionColor, 1.2f);                   //CreateColor( selectionColor.A, (int)(selectionColor.R * 1.2), (int)(selectionColor.G * 1.2), (int)(selectionColor.B * 1.2) );
                g.FillRectangle(new SolidBrush(lighter), checkLeft - 1, checkTop - 1, BITMAP_SIZE + 3, BITMAP_SIZE + 3);
            }
            g.DrawImage(bitmapCheckmark, checkLeft, checkTop);
            g.DrawRectangle(new Pen(borderColor), checkLeft - 2, checkTop - 2, BITMAP_SIZE + 3, BITMAP_SIZE + 3);
        }