Ejemplo n.º 1
0
        private Bitmap CreateBacgroundImage()
        {
            Rectangle workRectangle   = WorkRectangle;
            int       width           = workRectangle.Width;
            int       height          = workRectangle.Height;
            Point     point           = new Point(base.Location.X + Padding.Left, base.Location.Y + CaptionHeight + Padding.Top);
            Point     upperLeftSource = (base.Parent == null) ? point : PointToScreen(point);
            Bitmap    bitmap          = new Bitmap(width, height);

            try
            {
                Bitmap bitmap2 = new Bitmap(width, height);
                using (Graphics graphics = Graphics.FromImage(bitmap))
                {
                    graphics.CopyFromScreen(upperLeftSource, new Point(0, 0), new Size(width, height));
                }
                using (Graphics graphics = Graphics.FromImage(bitmap2))
                {
                    GDIHelper.DrawImage(graphics, new Rectangle(0, 0, width, height), bitmap, 0.36f);
                }
                return(bitmap2);
            }
            catch
            {
                return(null);
            }
            finally
            {
                bitmap.Dispose();
            }
        }
Ejemplo n.º 2
0
 protected void DrawCaptionLogo(Graphics g)
 {
     if (base.ShowIcon && CapitionLogo != null)
     {
         GDIHelper.DrawImage(g, LogoRect, _CapitionLogo, LogoSize);
     }
 }
Ejemplo n.º 3
0
 private void DrawSkinControlBox(Graphics g)
 {
     if (!SkinBoxRect.IsEmpty)
     {
         ControlBoxRender.DrawControlBox(g, SkinBoxRect, _SkinBtnState);
         GDIHelper.DrawImage(g, SkinBoxRect, Resources.skin, _SkinBoxSize);
     }
 }
Ejemplo n.º 4
0
        private void DrawFormBackGround(Graphics g)
        {
            Rectangle rect = new Rectangle(0, 0, base.Width - 2, base.Height - 2);

            if (SkinManager.CurrentSkin.BackGroundImageEnable)
            {
                GDIHelper.DrawImage(g, rect, SkinManager.CurrentSkin.BackGroundImage, SkinManager.CurrentSkin.BackGroundImageOpacity);
            }
            else
            {
                GDIHelper.FillRectangle(g, rect, SkinManager.CurrentSkin.ThemeColor);
            }
        }
Ejemplo n.º 5
0
        protected virtual void OnDrawFirstSubItem(DrawListViewSubItemEventArgs e, Graphics g)
        {
            TextFormatFlags formatFlags = GetFormatFlags(e.Header.TextAlign);
            Rectangle       bounds      = e.Bounds;
            Image           image       = null;
            Size            empty       = Size.Empty;
            Rectangle       rectangle   = new Rectangle(bounds.X, bounds.Y, 0, 0);
            Rectangle       rect        = rectangle;
            Rectangle       bounds2     = bounds;
            int             num         = 2;

            if (e.Item.ListView.CheckBoxes)
            {
                rectangle.X     += num * 2;
                rectangle.Y      = bounds.Top + (bounds.Height - _CheckBoxSize.Height) / 2;
                rectangle.Width  = _CheckBoxSize.Width;
                rectangle.Height = _CheckBoxSize.Height;
                rect.X           = rectangle.Right;
                bounds2.X        = rectangle.Right;
                bounds2.Width   -= _CheckBoxSize.Width - num * 2;
                GDIHelper.DrawCheckBox(g, new RoundRectangle(rectangle, 1));
                if (e.Item.Checked)
                {
                    GDIHelper.DrawCheckedStateByImage(g, rectangle);
                }
            }
            if (e.Item.ImageList != null && e.Item.ImageIndex >= 0)
            {
                image   = e.Item.ImageList.Images[e.Item.ImageIndex];
                empty   = e.Item.ImageList.ImageSize;
                rect.X += num * 3;
                rect.Y  = bounds.Y + num;
                int num4 = rect.Height = (rect.Width = bounds.Height - num * 2);
                bounds2.X      = rect.Right;
                bounds2.Width -= num4 - num * 2;
                GDIHelper.DrawImage(g, rect, image, empty);
            }
            bounds2.X     += num;
            bounds2.Width -= num * 2;
            Color foreColor = ((e.ItemState & ListViewItemStates.Selected) == ListViewItemStates.Selected) ? Color.White : e.SubItem.ForeColor;

            TextRenderer.DrawText(g, e.SubItem.Text, _Font, bounds2, foreColor, formatFlags);
        }
Ejemplo n.º 6
0
        protected void DrawRibbonBtn(Graphics g)
        {
            Rectangle rect = new Rectangle(0, base.CaptionHeight, base.Width, base.Height - base.CaptionHeight + 1);

            g.SetClip(rect, CombineMode.Exclude);
            GDIHelper.InitializeGraphics(g);
            Rectangle ribbonBtnRect = RibbonBtnRect;

            ribbonBtnRect.Inflate(-1, -1);
            GDIHelper.FillEllipse(g, ribbonBtnRect, Color.White);
            Color empty      = Color.Empty;
            Color empty2     = Color.Empty;
            Color lightColor = Color.FromArgb(232, 246, 250);
            Blend blend      = new Blend();

            blend.Positions = new float[5]
            {
                0f,
                0.3f,
                0.5f,
                0.8f,
                1f
            };
            blend.Factors = new float[5]
            {
                0.15f,
                0.55f,
                0.7f,
                0.8f,
                0.95f
            };
            switch (_RibbonBtnState)
            {
            case EnumControlState.HeightLight:
                empty  = Color.FromArgb(225, 179, 27);
                empty2 = Color.FromArgb(255, 251, 232);
                break;

            case EnumControlState.Focused:
                empty  = Color.FromArgb(191, 113, 5);
                empty2 = Color.FromArgb(248, 227, 222);
                break;

            default:
                empty           = Color.FromArgb(239, 246, 249);
                empty2          = Color.FromArgb(224, 221, 231);
                blend.Positions = new float[5]
                {
                    0f,
                    0.3f,
                    0.5f,
                    0.85f,
                    1f
                };
                blend.Factors = new float[5]
                {
                    0.95f,
                    0.7f,
                    0.45f,
                    0.3f,
                    0.15f
                };
                break;
            }
            GDIHelper.DrawCrystalButton(g, ribbonBtnRect, empty, empty2, lightColor, blend);
            Color color = Color.FromArgb(65, 177, 199);

            GDIHelper.DrawEllipseBorder(g, ribbonBtnRect, color, 1);
            GDIHelper.DrawImage(imgSize: new Size(20, 20), g: g, rect: ribbonBtnRect, img: Resources.naruto);
            g.ResetClip();
        }