Exemplo n.º 1
0
        protected override void OnPaint(PaintEventArgs pevent)
        {
            if (GLDisplay)
            {
                base.OnPaint(pevent);
                return;
            }
            Image img = mImage;

            if (img == null)
            {
                img = UVDLPApp.Instance().m_2d_graphics.GetBitmap(mGLImage);
            }
            if (img == null)
            {
                return;
            }
            Graphics gr = pevent.Graphics;

            img = C2DGraphics.ColorizeBitmap((Bitmap)img, Style.ForeColor);
            Rectangle dstrc = new Rectangle(0, 0, Width, Height);

            gr.DrawImage(img, dstrc);
            //base.OnPaint(pevent);
        }
Exemplo n.º 2
0
        public void Draw(Graphics gr, Rectangle destrc, Color col)
        {
            Bitmap img;

            if (col == Color.White)
            {
                img = image;
            }
            else
            {
                img = C2DGraphics.ColorizeBitmap(image, col);
            }
            if ((destrc.Width < minx) || (destrc.Height < miny))
            {
                gr.DrawImage(img, destrc);
            }
            else
            {
                // do the actual 9 patch.
                AdjustDest(destrc);
                for (int i = 0; i < 3; i++)
                {
                    for (int j = 0; j < 3; j++)
                    {
                        gr.DrawImage(img, dstrc[i, j], srcrc[i, j], GraphicsUnit.Pixel);
                    }
                }
            }
        }
Exemplo n.º 3
0
        void OnPaint1(Graphics gr, Image inimg)
        {
            Image img = C2DGraphics.ColorizeBitmap((Bitmap)inimg, GetPaintColor(Style));
            //Rectangle srcrc = new Rectangle(0, 0, img.Width, img.Height);
            float scale = 1;

            if (mCtlState == CtlState.Hover)
            {
                scale = Style.HoverSize / 100;
            }
            if (mCtlState == CtlState.Pressed)
            {
                scale = Style.PressedSize / 100;
            }

            RectangleF dstrc;

            if ((scale < 0.999f) || (scale > 1.001f))
            {
                float w   = (float)mDstrc.Width * scale;
                float h   = (float)mDstrc.Height * scale;
                float scx = ((float)mDstrc.Width - w) / 2f;
                float scy = ((float)mDstrc.Height - h) / 2f;
                dstrc = new RectangleF(mDstrc.X + scx, mDstrc.Y + scy, w, h);
            }
            else
            {
                dstrc = mDstrc;
            }
            gr.DrawImage(img, dstrc);
        }