Exemplo n.º 1
0
 public override void Show(C2DGraphics g2d, int w, int h)
 {
     if (!visible)
         return;
     int iw = 0, ih = 0;
     g2d.GetImageDim(imgname, ref iw, ref ih);
     int px = GuiConfig.GetPosition(0, w, iw, x, docking[1]);
     int py = GuiConfig.GetPosition(0, h, ih, y, docking[0]);
     g2d.SetColor(color);
     g2d.Image(imgname, px, py);
 }
Exemplo n.º 2
0
 public override void OnGLPaint(C2DGraphics gr)
 {
     base.OnGLPaint(gr);
     if (mGLImageCach == null)
     {
         mGLImageCach = gr.GetImage(mGLImage);
         if (mGLImageCach == null)
             return;
         gr.SetColor(Style.ForeColor);
         gr.Image(mGLImageCach, 0, 0, mGLImageCach.w, mGLImageCach.h, 0, 0, Width, Height);
     }
 }
 void GLPaint4(C2DGraphics gr)
 {
     int index = (int)mCtlState;
     if (Enabled == false)
         index = 3;
     if (mGLImageCach != null)
     {
         gr.SetColor(Color.White);
         mSrcrc.X = mSubImgWidth * index;
         gr.Image(mGLImageCach, mSubImgWidth * index, 0, mSubImgWidth, mGLImageCach.h, 0, 0, Width, Height);
         /*if (Enabled && (mCheckImage != null))
         {
             mCheckrc.X = Checked ? mSubChkImgWidth : 0;
             gr.DrawImage(mCheckImage, mDstrc, mCheckrc, GraphicsUnit.Pixel);
         }*/
     }
 }
        void GLPaint1(C2DGraphics gr, GuiControlStyle stl)
        {
            gr.SetColor(GetPaintColor(stl));

            float scale = 1;
            if (mCtlState == CtlState.Hover)
                scale = (float)stl.HoverSize / 100f;
            if (mCtlState == CtlState.Pressed)
                scale = (float)stl.PressedSize / 100f;

            if ((scale < 0.999f) || (scale > 1.001f))
            {
                float w = (float)Width * scale;
                float h = (float)Height * scale;
                float scx = ((float)Width - w) / 2f;
                float scy = ((float)Height - h) / 2f;
                gr.Image(mGLImageCach, 0, 0, mGLImageCach.w, mGLImageCach.h, scx, scy, w, h);
            }
            else
            {
                gr.Image(mGLImageCach, 0, 0, mGLImageCach.w, mGLImageCach.h, 0, 0, Width, Height);
            }
        }
 public override void OnGLPaint(C2DGraphics gr)
 {
     base.OnGLPaint(gr);
     if (mGLImageCach == null)
     {
         mGLImageCach = gr.GetImage(mGLImage);
         if (mGLImageCach == null)
             return;
         mSubImgWidth = mGLImageCach.w / Style.SubImgCount;
     }
     GuiControlStyle stl = Style;
     if (stl.SubImgCount == 4)
         GLPaint4(gr);
     if (stl.SubImgCount == 1)
         GLPaint1(gr, stl);
     C2DImage cimg = stl.CheckedImageCach;
     if (Enabled && (cimg != null))
     {
         int chimgw = cimg.w / 2;
         int posx = Checked ? chimgw : 0;
         gr.SetColor(stl.CheckedColor);
         gr.Image(cimg, posx, 0, chimgw, cimg.h, 0, 0, Width, Height);
     }
 }
Exemplo n.º 6
0
        void GLPaint1(C2DGraphics gr, ButtonStyle stl)
        {
            if (Enabled == false)
            {
                gr.SetColor(stl.DisabledColor);
            }
            else
            {
                switch (mCtlState)
                {
                    case CtlState.Hover:
                        if (Checked)
                            gr.SetColor(stl.CheckedColor);
                        else
                            gr.SetColor(stl.HoverColor);
                        break;

                    case CtlState.Normal:
                        if (Checked)
                            gr.SetColor(stl.CheckedColor);
                        else
                            gr.SetColor(stl.ForeColor);
                        break;

                    case CtlState.Pressed:
                        gr.SetColor(stl.PressedColor);
                        break;
                }
            }

            if (mCtlState == CtlState.Hover)
            {
                float scx = (float)Width / 16f;
                float scy = (float)Height / 16f;
                gr.Image(mGLImageCach, 0, 0, mGLImageCach.w, mGLImageCach.h, -scx, -scy, Width + 2f * scx, Height + 2f * scy);
            }
            else
            {
                gr.Image(mGLImageCach, 0, 0, mGLImageCach.w, mGLImageCach.h, 0, 0, Width, Height);
            }
        }