Beispiel #1
0
        /// <summary>
        /// Öػ汳¾°
        /// </summary>
        /// <param name="paint">»æͼ¶ÔÏó</param>
        /// <param name="clipRect">²Ã¼ôÇøÓò</param>
        public override void onPaintBackground(FCPaint paint, FCRect clipRect)
        {
            int      width     = Width;
            int      height    = Height;
            String   text      = Text;
            FCFont   font      = Font;
            FCSize   tSize     = paint.textSize(text, font);
            int      drawWidth = tSize.cx + 20;
            FCRect   drawRect  = new FCRect(0, 0, width, height);
            FCNative native    = Native;

            //»æÖƱ³¾°
            if (this == native.HoveredControl)
            {
                paint.fillGradientRect(FCDraw.FCCOLORS_BACKCOLOR5, FCDraw.FCCOLORS_BACKCOLOR6, drawRect, 2, 90);
            }
            //»æÖÆͼ±ê
            String backImage = getPaintingBackImage();
            FCRect imageRect = new FCRect(2, (height - 16) / 2, 18, (height + 16) / 2);

            if (backImage != null && backImage.Length > 0)
            {
                paint.fillRect(getPaintingBackColor(), imageRect);
                paint.drawImage(getPaintingBackImage(), imageRect);
            }
            //»æÖÆÎÄ×Ö
            FCRect tRect = new FCRect();

            tRect.left   = imageRect.right + 4;
            tRect.top    = (height - tSize.cy) / 2;
            tRect.right  = tRect.left + tSize.cx;
            tRect.bottom = tRect.top + tSize.cy;
            paint.drawText(text, getPaintingTextColor(), font, tRect);
            //»æÖƱßÏß
            if (this == native.HoveredControl)
            {
                paint.drawRoundRect(getPaintingBorderColor(), 1, 0, drawRect, 2);
            }
            if (Enabled)
            {
                if (this == native.PushedControl)
                {
                    paint.fillRect(FCDraw.FCCOLORS_BACKCOLOR4, drawRect);
                }
                else if (this == native.HoveredControl)
                {
                    paint.fillRect(FCDraw.FCCOLORS_BACKCOLOR3, drawRect);
                }
            }
            else
            {
                paint.fillRect(FCDraw.FCCOLORS_BACKCOLOR7, drawRect);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 重绘背景
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintBackground(FCPaint paint, FCRect clipRect)
        {
            FCNative native = Native;
            int      width = Width, height = Height;
            int      mw = width / 2, mh = height / 2;
            FCRect   drawRect     = new FCRect(0, 0, width, height);
            int      cornerRadius = 0;

            if (m_isClose)
            {
                long   lineColor   = FCDraw.FCCOLORS_LINECOLOR;
                FCRect ellipseRect = new FCRect(1, 1, width - 2, height - 2);
                //paint->FillEllipse(FCCOLORS_BACKCOLOR7, ellipseRect);
                paint.drawLine(lineColor, 2, 0, 4, 4, width - 7, height - 7);
                paint.drawLine(lineColor, 2, 0, 4, height - 7, width - 7, 3);
            }
            else
            {
                cornerRadius = 0;
                if (m_arrowType > 0)
                {
                    cornerRadius = 0;
                }
                FCView parent = Parent;
                if (parent != null)
                {
                    FCTabControl tabControl = parent as FCTabControl;
                    if (tabControl != null)
                    {
                        cornerRadius = 0;
                    }
                }
                paint.fillGradientRect(FCDraw.FCCOLORS_BACKCOLOR, FCDraw.FCCOLORS_BACKCOLOR2, drawRect, cornerRadius, 90);
                paint.drawRect(FCDraw.FCCOLORS_EXCOLOR1, 1, 0, drawRect);
                cornerRadius = 0;
                if (m_arrowType > 0)
                {
                    FCPoint point1 = new FCPoint();
                    FCPoint point2 = new FCPoint();
                    FCPoint point3 = new FCPoint();
                    int     dSize  = Math.Min(mw, mh) / 2;
                    switch (m_arrowType)
                    {
                    case 1:
                        point1.x = mw - dSize;
                        point1.y = mh;
                        point2.x = mw + dSize;
                        point2.y = mh - dSize;
                        point3.x = mw + dSize;
                        point3.y = mh + dSize;
                        break;

                    case 2:
                        point1.x = mw + dSize;
                        point1.y = mh;
                        point2.x = mw - dSize;
                        point2.y = mh - dSize;
                        point3.x = mw - dSize;
                        point3.y = mh + dSize;
                        break;

                    case 3:
                        point1.x = mw;
                        point1.y = mh - dSize;
                        point2.x = mw - dSize;
                        point2.y = mh + dSize;
                        point3.x = mw + dSize;
                        point3.y = mh + dSize;
                        break;

                    case 4:
                        point1.x = mw;
                        point1.y = mh + dSize;
                        point2.x = mw - dSize;
                        point2.y = mh - dSize;
                        point3.x = mw + dSize;
                        point3.y = mh - dSize;
                        break;
                    }
                    FCPoint[] points = new FCPoint[3];
                    points[0] = point1;
                    points[1] = point2;
                    points[2] = point3;
                    paint.fillPolygon(FCDraw.FCCOLORS_FORECOLOR, points);
                }
            }
            bool state = false;

            if (Selected)
            {
                state = true;
                paint.fillRoundRect(FCDraw.FCCOLORS_BACKCOLOR8, drawRect, cornerRadius);
            }
            else if (this == native.PushedControl)
            {
                state = true;
                paint.fillRoundRect(FCDraw.FCCOLORS_BACKCOLOR6, drawRect, cornerRadius);
            }
            else if (this == native.HoveredControl)
            {
                state = true;
                paint.fillRoundRect(FCDraw.FCCOLORS_BACKCOLOR5, drawRect, cornerRadius);
            }
            if (state)
            {
                if (cornerRadius > 0)
                {
                    paint.drawRoundRect(FCColor.Border, 2, 0, drawRect, cornerRadius);
                }
                else
                {
                    paint.drawRect(FCColor.Border, 1, 0, drawRect);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 重绘背景
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintBackground(FCPaint paint, FCRect clipRect)
        {
            int    width = Width, height = Height;
            int    mw = width / 2, mh = height / 2;
            FCRect drawRect = new FCRect(0, 0, width, height);

            if (m_isClose)
            {
                long   lineColor   = FCDraw.FCCOLORS_LINECOLOR;
                FCRect ellipseRect = new FCRect(1, 1, width - 2, height - 2);
                paint.fillEllipse(FCDraw.FCCOLORS_UPCOLOR, ellipseRect);
                paint.drawLine(lineColor, 2, 0, 4, 4, width - 7, height - 7);
                paint.drawLine(lineColor, 2, 0, 4, height - 7, width - 7, 3);
            }
            else
            {
                int cornerRadius = 4;
                if (m_arrowType > 0)
                {
                    cornerRadius = 0;
                }
                FCView parent = Parent;
                if (parent != null)
                {
                    FCTabControl tabControl = parent as FCTabControl;
                    if (tabControl != null)
                    {
                        cornerRadius = 0;
                    }
                }
                paint.fillGradientRect(FCDraw.FCCOLORS_BACKCOLOR, FCDraw.FCCOLORS_BACKCOLOR2, drawRect, cornerRadius, 90);
                paint.drawRoundRect(FCDraw.FCCOLORS_LINECOLOR3, 1, 0, drawRect, cornerRadius);
            }
            if (m_arrowType > 0)
            {
                FCPoint[] points = new FCPoint[3];
                int       ts     = Math.Min(mw, mh) / 2;
                switch (m_arrowType)
                {
                //向左
                case 1:
                    points[0] = new FCPoint(mw - ts, mh);
                    points[1] = new FCPoint(mw + ts, mh - ts);
                    points[2] = new FCPoint(mw + ts, mh + ts);
                    break;

                //向右
                case 2:
                    points[0] = new FCPoint(mw + ts, mh);
                    points[1] = new FCPoint(mw - ts, mh - ts);
                    points[2] = new FCPoint(mw - ts, mh + ts);
                    break;

                //向上
                case 3:
                    points[0] = new FCPoint(mw, mh - ts);
                    points[1] = new FCPoint(mw - ts, mh + ts);
                    points[2] = new FCPoint(mw + ts, mh + ts);
                    break;

                //向下
                case 4:
                    points[0] = new FCPoint(mw, mh + ts);
                    points[1] = new FCPoint(mw - ts, mh - ts);
                    points[2] = new FCPoint(mw + ts, mh - ts);
                    break;
                }
                paint.fillPolygon(FCDraw.FCCOLORS_FORECOLOR, points);
            }
            //绘制选中效果
            if (paint.supportTransparent())
            {
                FCNative native = Native;
                if (Selected)
                {
                    paint.fillRect(FCDraw.FCCOLORS_BACKCOLOR2, drawRect);
                }
                else if (this == native.PushedControl)
                {
                    paint.fillRect(FCDraw.FCCOLORS_BACKCOLOR6, drawRect);
                }
                else if (this == native.HoveredControl)
                {
                    paint.fillRect(FCDraw.FCCOLORS_BACKCOLOR5, drawRect);
                }
            }
        }
Beispiel #4
0
 /// <summary>
 /// 重绘边线方法
 /// </summary>
 /// <param name="paint">绘图对象</param>
 /// <param name="clipRect">裁剪区域</param>
 public override void onPaintBorder(FCPaint paint, FCRect clipRect)
 {
     paint.drawRoundRect(getPaintingBorderColor(), 1, 0, clipRect, 20);
 }