Beispiel #1
0
        private void LoadBGImage()
        {
            {
                PreImage_AlphaCover = Properties.Resources.IMG_AlphaCover;
            }
            {
                if (File.Exists("Data/bg.jpg"))
                {
                    Image image      = Image.FromFile("Data/bg.jpg");
                    Image cloneImage = new Bitmap(image);
                    image.Dispose();
                    PreImage_BG = (Bitmap)cloneImage;
                }
                else
                {
                    PreImage_BG = Properties.Resources.IMG_BG;
                }
                //PreImage_BG = ImageZoom.GetThumbnail(PreImage_BG, PreImage_BG.Height * 1920 / PreImage_BG.Width, 1920);
                PreImage_BG = ImageEx.SmallPic(PreImage_BG, 1920);
                {
                    //Bitmap b = new Bitmap(Width, Height);
                    //Graphics g = Graphics.FromImage();
                }
                //PreImage_BG.Save("0.jpg");
                Color_PrimaryColor  = ColorHelper.GetPrimaryColor(PreImage_BG);
                Color_SecondColor   = ImageEx.ChangeColor(Color_PrimaryColor, -0.75f);
                PreImage_AlphaCover = (Bitmap)ImageEx.SetImageColorAllWithoutAlpha(PreImage_AlphaCover, Color.Black, Color_SecondColor, 255);
                //PreImage_AlphaCover.Save("2.png");
                PreImage_BG = ImageEx.JoinMImage(PreImage_BG, PreImage_AlphaCover, new Rectangle(0, 0, PreImage_AlphaCover.Width, PreImage_AlphaCover.Height));
                //BackgroundImage = PreImage_BG;
            }
            {
                Graphics g;
                PreImage_Header = new Bitmap(PreImage_BG.Width, Header_Height);
                g = Graphics.FromImage(PreImage_Header);
                Rectangle    srcRect = new Rectangle(0, 0, PreImage_Header.Width, PreImage_Header.Height);
                GraphicsUnit units   = GraphicsUnit.Pixel;
                g.DrawImage(PreImage_BG, 0, 0, srcRect, units);
                g.Save();
                g.Dispose();
                PreImage_Header = ImageEx.BrightnessP(PreImage_Header, -10);
                PreImage_Header = GB.ProcessImage(PreImage_Header);

                //PreImage_Header.Save("1.jpg");
                //Bitmap b = new Bitmap(PictureBox_Header.Width, PictureBox_Header.Height);
                //g = Graphics.FromImage(b);
                //Pen p = new Pen(Color_PrimaryColor);
                //g.DrawImage(PreImage_Header, new Rectangle(0, 0, PictureBox_Header.Width, PictureBox_Header.Height),
                //                             new Rectangle((PreImage_Header.Width - Width) / 2, 0, Width, Height), GraphicsUnit.Pixel);
                ////Pen p = new Pen(Color.Red);
                //g.DrawLine(p, new Point(0, 0), new Point(b.Width, 0));
                //g.DrawLine(p, new Point(b.Width - 1, 0), new Point(b.Width - 1, b.Height - 1));
                //g.DrawLine(p, new Point(b.Width - 1, b.Height - 1), new Point(0, b.Height - 1));
                //g.DrawLine(p, new Point(0, b.Height), new Point(0, 0));
                //g.Save();
                //g.Dispose();
            }
            ControlNeedRefresh = true;
        }
Beispiel #2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Bitmap   b = new Bitmap(Width, Height);
            Graphics g = Graphics.FromImage(b);

            {
                //Draw Background
                {
                    g.Clear(_BackColor);
                }
                //Draw Border
                {
                    Pen p = new Pen(_BorderColor);
                    g.DrawLine(p, new Point(2, 1), new Point(Width - 2, 1));
                    g.DrawLine(p, new Point(Width - 2, 2), new Point(Width - 2, Height - 2));
                    g.DrawLine(p, new Point(Width - 3, Height - 2), new Point(1, Height - 2));
                    g.DrawLine(p, new Point(1, Height - 3), new Point(1, 1));
                }
                //Draw Text
                {
                    //Draw Text
                    SizeF size_of_NormalText;
                    {
                        Graphics gs = this.CreateGraphics();
                        size_of_NormalText = gs.MeasureString(_Text, _Font);
                        gs.Dispose();
                    }
                    g.DrawString(_Text, _Font, new SolidBrush(_NormalFontColor),
                                 new Point((Width - (int)size_of_NormalText.Width) / 2 + (_IsMouseDown ? 1 : 0),
                                           (Height - (int)size_of_NormalText.Height) / 2 + (_IsMouseDown ? 1 : 0)));
                    //Draw TextCover
                    {
                    }
                }
            }
            g.Save();
            g.Dispose();
            if (_bG != null)
            {
                b = (Bitmap)ImageEx.ChangeImageOpacity(b, (_HoverOpacity - _NormalOpacity) * (CurrentOpacityPercent / 100.0) + _NormalOpacity);
                b = ImageEx.JoinMImage((Bitmap)_bG.Clone(), b, ClientRectangle);
            }
            //b = ImageEx.BrightnessP(b, -25);
            e.Graphics.DrawImage(b, new Point(0, 0));
            b.Dispose();
            base.OnPaint(e);
        }
Beispiel #3
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Bitmap   b = new Bitmap(Width, Height);
            Graphics g = Graphics.FromImage(b);

            {
                //Draw Background
                {
                    g.Clear(_BackColor);
                }
                //Draw Border
                {
                    Pen p = new Pen(_BorderColor);
                    g.DrawLine(p, new Point(2, 1), new Point(Width - 2, 1));
                    g.DrawLine(p, new Point(Width - 2, 2), new Point(Width - 2, Height - 2));
                    g.DrawLine(p, new Point(Width - 3, Height - 2), new Point(1, Height - 2));
                    g.DrawLine(p, new Point(1, Height - 3), new Point(1, 1));
                }
                //Draw Image
                {
                    if (_Image != null)
                    {
                        g.DrawImage(_Image, new Rectangle(2, 2, Width - 4, Height - 4));
                    }
                }
            }
            g.Save();
            g.Dispose();
            if (_bG != null)
            {
                b = (Bitmap)ImageEx.ChangeImageOpacity(b, (_HoverOpacity - _NormalOpacity) * (CurrentOpacityPercent / 100.0) + _NormalOpacity);
                b = ImageEx.JoinMImage((Bitmap)_bG.Clone(), b, ClientRectangle);
            }
            //b = ImageEx.BrightnessP(b, -25);
            e.Graphics.DrawImage(b, new Point(0, 0));
            b.Dispose();
            base.OnPaint(e);
        }
Beispiel #4
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Bitmap   b = new Bitmap(Width, Height);
            Graphics g = Graphics.FromImage(b);

            {
                //if (_BG != null)
                //    g.DrawImage(_BG, new Point(0, 0));
                Size Bar_Size = new Size(12, Height);
                //Draw BackGround
                {
                    g.Clear(_BackColor);
                    g.FillRectangle(
                        new SolidBrush(Color.FromArgb((int)(255 * (CurrentTransPercent / 100.0)), _SwitchedColor)),
                        new Rectangle(2, 2, (int)((Width - Bar_Size.Width) * (CurrentTransPercent / 100.0)) - 2, Height - 4));
                }
                //Draw Border
                {
                    Pen p = new Pen(_BorderColor);
                    g.DrawLine(p, new Point(2, 1), new Point(Width - 2, 1));
                    g.DrawLine(p, new Point(Width - 2, 2), new Point(Width - 2, Height - 2));
                    g.DrawLine(p, new Point(Width - 3, Height - 2), new Point(1, Height - 2));
                    g.DrawLine(p, new Point(1, Height - 3), new Point(1, 1));
                }
                //Draw HighLight Border
                if (IsMouseIn)
                {
                    Pen p = new Pen(_HoverBorderColor);
                    g.DrawLine(p, new Point(0, 0), new Point(Width, 0));
                    g.DrawLine(p, new Point(Width - 1, 0), new Point(Width - 1, Height - 1));
                    g.DrawLine(p, new Point(Width - 1, Height - 1), new Point(0, Height - 1));
                    g.DrawLine(p, new Point(0, Height), new Point(0, 0));
                }
                //Draw SwitchBar
                {
                    Bitmap   b_Bar = new Bitmap(Bar_Size.Width, Bar_Size.Height);
                    Graphics g_Bar = Graphics.FromImage(b_Bar);

                    //SwitchBar BackGround
                    g_Bar.Clear(_SwitchBarColor);
                    //SwitchBar Border
                    Pen p = new Pen(_BorderColor);
                    g_Bar.DrawLine(p, new Point(0, 0), new Point(Bar_Size.Width, 0));
                    g_Bar.DrawLine(p, new Point(Bar_Size.Width - 1, 0), new Point(Bar_Size.Width - 1, Bar_Size.Height - 1));
                    g_Bar.DrawLine(p, new Point(Bar_Size.Width - 1, Bar_Size.Height - 1), new Point(0, Bar_Size.Height - 1));
                    g_Bar.DrawLine(p, new Point(0, Bar_Size.Height), new Point(0, 0));

                    g_Bar.Save();
                    g_Bar.Dispose();
                    g.DrawImage(b_Bar, new Point((int)((Width - Bar_Size.Width) * (CurrentTransPercent / 100.0)), 0));
                    b_Bar.Dispose();
                }
            }
            g.Save();
            g.Dispose();
            if (_bG != null)
            {
                b = (Bitmap)ImageEx.ChangeImageOpacity(b, (_HoverOpacity - _NormalOpacity) * (CurrentOpacityPercent / 100.0) + _NormalOpacity);
                b = ImageEx.JoinMImage((Bitmap)_bG.Clone(), b, ClientRectangle);
            }
            //b = ImageEx.BrightnessP(b, -25);
            e.Graphics.DrawImage(b, new Point(0, 0));
            b.Dispose();
            base.OnPaint(e);
        }
Beispiel #5
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Bitmap   b = new Bitmap(Width, Height);
            Graphics g = Graphics.FromImage(b);

            {
                //try
                //{
                //    if(NeedRefresh)
                //        if (Parent is MoUI_Panel)
                //        {
                //            if (((MoUI_Panel)Parent)._BG != null)
                //            {
                //                if (_BG == null)
                //                    _BG = new Bitmap(Width, Height);
                //                _BG = ((MoUI_Panel)Parent)._BG.Clone(Bounds, ((MoUI_Panel)Parent)._BG.PixelFormat);
                //                NeedRefresh = false;
                //            }
                //        }
                //}
                //catch { }
                //Draw Background
                {
                    g.Clear(_BackColor);
                    if (_IsSelected)
                    {
                        if (_BG != null && !_BGColorStyle)
                        {
                            g.DrawImage(_BG, new Point(0, 0));
                        }
                        Bitmap   bb = new Bitmap(Width, Height);
                        Graphics gb = Graphics.FromImage(bb);
                        gb.FillRectangle(new SolidBrush(Color.FromArgb(20, 0, 0, 255)), new Rectangle(0, 0, Width, Height));
                        gb.Save();
                        gb.Dispose();
                        bb = (Bitmap)ImageEx.ChangeImageOpacity(bb, 0.5);
                        g.DrawImage(bb, new Point(0, 0));
                        bb.Dispose();
                    }
                    else
                    {
                        if (_BG != null && !_BGColorStyle)
                        {
                            g.DrawImage(_BG, new Point(0, 0));
                        }
                        Bitmap   bb = new Bitmap(Width, Height);
                        Graphics gb = Graphics.FromImage(bb);
                        gb.FillRectangle(new SolidBrush(Color.FromArgb(20, 255, 255, 255)), new Rectangle(0, 0, Width, Height));
                        gb.Save();
                        gb.Dispose();
                        bb = (Bitmap)ImageEx.ChangeImageOpacity(bb, (CurrentOpacityPercent / 100.0) * 0.5);
                        g.DrawImage(bb, new Point(0, 0));
                        bb.Dispose();
                    }
                }
                //Draw Border
                {
                    if (_IsSelected)
                    {
                        Pen p = new Pen(Color.FromArgb(28, 100, 160));
                        g.DrawLine(p, new Point(2, 1), new Point(Width - 2, 1));
                        g.DrawLine(p, new Point(Width - 2, 2), new Point(Width - 2, Height - 2));
                        g.DrawLine(p, new Point(Width - 3, Height - 2), new Point(1, Height - 2));
                        g.DrawLine(p, new Point(1, Height - 3), new Point(1, 1));
                    }
                    else if (IsMouseIn)
                    {
                        Pen p = new Pen(Color.FromArgb(125, 255, 255, 255));
                        g.DrawLine(p, new Point(2, 1), new Point(Width - 2, 1));
                        g.DrawLine(p, new Point(Width - 2, 2), new Point(Width - 2, Height - 2));
                        g.DrawLine(p, new Point(Width - 3, Height - 2), new Point(1, Height - 2));
                        g.DrawLine(p, new Point(1, Height - 3), new Point(1, 1));
                    }
                }
                //Draw Text
                {
                    //Draw Text
                    SizeF size_of_Text;
                    {
                        Graphics gs = this.CreateGraphics();
                        size_of_Text = gs.MeasureString(_Text, _Font);
                        gs.Dispose();
                    }
                    g.DrawString(_Text, _Font, new SolidBrush(_NormalFontColor),
                                 new Point((Width - (int)size_of_Text.Width) / 2 + (_IsMouseDown ? 1 : 0),
                                           (Height - (int)size_of_Text.Height) / 2 + (_IsMouseDown ? 1 : 0) - (Height / 4)));
                    //Draw Text
                    SizeF size_of_TextB;
                    {
                        Graphics gs = this.CreateGraphics();
                        size_of_TextB = gs.MeasureString(_TextB, _Font);
                        gs.Dispose();
                    }
                    g.DrawString(_TextB, _Font, new SolidBrush(_NormalFontColor),
                                 new Point((Width - (int)size_of_TextB.Width) / 2 + (_IsMouseDown ? 1 : 0),
                                           (Height - (int)size_of_TextB.Height) / 2 + (_IsMouseDown ? 1 : 0) + (Height / 4)));
                }
            }
            g.Save();
            g.Dispose();
            if (_BG != null && !_BGColorStyle)
            {
                if (_IsSelected)
                {
                }
                else
                {
                    b = (Bitmap)ImageEx.ChangeImageOpacity(b, (_HoverOpacity - _NormalOpacity) * (CurrentOpacityPercent / 100.0) + _NormalOpacity);
                    b = ImageEx.JoinMImage((Bitmap)_bG.Clone(), b, ClientRectangle);
                }
            }
            e.Graphics.DrawImage(b, new Point(0, 0));
            b.Dispose();
            base.OnPaint(e);
        }