ARCed.UI.InertButtonBase.OnPaint C# (CSharp) 메소드

OnPaint() 보호된 메소드

protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs
리턴 void
        protected override void OnPaint(PaintEventArgs e)
        {
            if (this.IsMouseOver && Enabled)
            {
                using (var pen = new Pen(ForeColor))
                {
                    e.Graphics.DrawRectangle(pen, Rectangle.Inflate(ClientRectangle, -1, -1));
                }
            }

            using (var imageAttributes = new ImageAttributes())
            {
                var colorMap = new ColorMap[2];
                colorMap[0] = new ColorMap
                {
                    OldColor = Color.FromArgb(0, 0, 0),
                    NewColor = ForeColor
                };
                colorMap[1] = new ColorMap
                {
                    OldColor = this.Image.GetPixel(0, 0),
                    NewColor = Color.Transparent
                };

                imageAttributes.SetRemapTable(colorMap);

                e.Graphics.DrawImage(
                   this.Image,
                   new Rectangle(0, 0, this.Image.Width, this.Image.Height),
                   0, 0,
                   this.Image.Width,
                   this.Image.Height,
                   GraphicsUnit.Pixel,
                   imageAttributes);
            }

            base.OnPaint(e);
        }