Esempio n. 1
0
 protected virtual void PaintItem(Graphics g, DockItem item)
 {
     if (item != null)
     {
         if (item.Scale == 1.0f)
         {
             if (item.Alpha == 255)
             {
                 BitmapPainter.DrawImageUnscaled(item.Icon, g, item.X, item.Y);
             }
             else
             {
                 BitmapPainter.DrawImageUnscaled(item.Icon, g, item.X, item.Y, item.Alpha);
             }
         }
         else
         {
             if (item.Alpha == 255)
             {
                 BitmapPainter.DrawImageScaled(item.Icon, g, item.X, item.Y, item.PaintWidth, item.PaintHeight);
             }
             else
             {
                 BitmapPainter.DrawImageScaled(item.Icon, g, item.X, item.Y, item.PaintWidth, item.PaintHeight, item.Alpha);
             }
         }
     }
 }
Esempio n. 2
0
        protected virtual void DoPaintBackground()
        {
            Rectangle workingArea;
            float     offset    = 0;
            int       imageSize = 0;

            if (GlobalConfig.LowMemory)
            {
                workingArea = new Rectangle(0, 0, (int)maxSize, (int)maxSize);
            }
            else
            {
                imageSize   = (int)(maxSize * scale);
                offset      = (float)((manager.StoneSize - maxSize * scale) / 2);
                workingArea = new Rectangle((int)offset, (int)offset, imageSize, imageSize);
            }

            if ((backgroundBitmap != IntPtr.Zero))
            {
                if (isMouseDown && (!MouseOverSettingsButton))
                {
                    BitmapPainter.DrawImageScaled(backgroundBitmap, window.Buffer.Handle, (int)offset, (int)offset,
                                                  backgroundBitmapWidth, backgroundBitmapHeight, imageSize, imageSize, 180);
                }
                else
                {
                    BitmapPainter.DrawImageScaled(backgroundBitmap, window.Buffer.Handle, (int)offset, (int)offset,
                                                  backgroundBitmapWidth, backgroundBitmapHeight, imageSize, imageSize);
                }
            }
        }
Esempio n. 3
0
 protected override void Paint()
 {
     if (glyph != null)
     {
         if (Alpha == 255)
         {
             BitmapPainter.DrawImageScaled(glyph, Canvas, Left, Top, Width, Height);
         }
         else
         {
             BitmapPainter.DrawImageScaled(glyph, Canvas, Left, Top, Width, Height, Alpha);
         }
     }
 }
Esempio n. 4
0
 public override void Draw(Graphics canvas)
 {
     BitmapPainter.DrawImageScaled(bitmap, canvas, Left, Top, Width, Height, Alpha);
 }
Esempio n. 5
0
        public void PaintCaption(string caption, Bitmap glyph)
        {
            this.Text = caption;
            if (string.IsNullOrEmpty(caption))
            {
                Clear();
                Update(false);
                Hide();
                return;
            }
            else
            {
                Size size          = windowsFont.GetTextSize(caption, 200, TextFormatFlags.Left | TextFormatFlags.WordBreak, true);
                int  captionHeight = (int)size.Height + 1;
                int  captionWidth  = (int)size.Width + 1;

                int buttonsWidth = buttonSize * 4 + buttonSpace * 5;


                int totalWidth = 46 + captionWidth;
                if (totalWidth < buttonsWidth)
                {
                    totalWidth = buttonsWidth;
                }

                int totalHeight = Math.Max(captionHeight, 34) + 10 + buttonSize;

                buttonConfigureStone.Left = buttonSpace;
                buttonChangeType.Left     = buttonSpace * 2 + buttonSize;
                buttonRemoveStone.Left    = buttonSpace * 3 + buttonSize * 2;
                buttonAbout.Left          = buttonSpace * 4 + buttonSize * 3;

                int buttonTop = totalHeight - buttonSpace - buttonSize;

                buttonConfigureStone.Top = buttonTop;
                buttonChangeType.Top     = buttonTop;
                buttonRemoveStone.Top    = buttonTop;
                buttonAbout.Top          = buttonTop;

                if (Background != null)
                {
                    Background.Dispose();
                    Background = null;
                }
                Background = new Bitmap(totalWidth, totalHeight, PixelFormat.Format32bppPArgb);
                using (Graphics g = Graphics.FromImage(Background))
                {
                    g.FillRectangle(brushBorder, new Rectangle(1, 1, totalWidth - 2, totalHeight - 2));
                    g.FillRectangle(brushBody, new Rectangle(3, 3, totalWidth - 6, totalHeight - 6));
                    g.DrawRectangle(penOutLine, new Rectangle(0, 0, totalWidth - 1, totalHeight - 1));
                    windowsFont.DrawTextRect(g, caption, ForeColor, hintBodyColor, new Rectangle(43, 5, captionWidth, captionHeight), TextFormatFlags.WordBreak);
                    if (glyph != null)
                    {
                        BitmapPainter.DrawImageScaled(glyph, g, 7, 6, 32, 32);
                    }
                }

                Size(totalWidth, totalHeight);
                Repaint();
            }
        }