Ejemplo n.º 1
0
        /// <summary>
        /// 重绘背景方法
        /// </summary>
        /// <param name="paint">绘图区域</param>
        /// <param name="clipRect">裁剪对象</param>
        public override void onPaintBackground(FCPaint paint, FCRect clipRect)
        {
            int    width = Width, height = Height;
            FCRect drawRect = new FCRect(0, 0, width, height);

            paint.fillGradientRect(FCDraw.FCCOLORS_BACKCOLOR, FCDraw.FCCOLORS_BACKCOLOR2, drawRect, 0, 90);
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
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);
                }
            }
        }
Ejemplo n.º 4
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);
                }
            }
        }
Ejemplo n.º 5
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;
            FCNative native   = Native;
            FCRect   drawRect = convertBoundsToPRect(new FCRect(0, 0, width, height));
            //绘制选中的点
            int resizePoint = m_resizePoint != -1 ? m_resizePoint : getResizePoint(TouchPoint);

            if (width > 4 && height > 4)
            {
                long borderColor = FCDraw.FCCOLORS_BACKCOLOR8;
                //绘制多目标
                int targetsSize = m_targets.Count;
                if (targetsSize > 1)
                {
                    for (int i = 0; i < targetsSize; i++)
                    {
                        FCView  target         = m_targets[i];
                        FCPoint clientLocation = pointToControl(new FCPoint(Native.clientX(target), Native.clientY(target)));
                        paint.drawRect(borderColor, 2, 0,
                                       new FCRect(clientLocation.x, clientLocation.y,
                                                  clientLocation.x + target.Width,
                                                  clientLocation.y + target.Height));
                    }
                }
                if (resizePoint != -1 && resizePoint != 8)
                {
                    paint.fillGradientRect(FCDraw.FCCOLORS_BACKCOLOR5, FCDraw.FCCOLORS_BACKCOLOR6, drawRect, 0, 90);
                    paint.drawRect(borderColor, 1, 2, drawRect);
                    int        thick     = 4;
                    List <int> positions = new List <int>();
                    //左上右下
                    if (resizePoint < 4)
                    {
                        positions.Add(resizePoint);
                    }
                    else
                    {
                        switch (resizePoint)
                        {
                        //左上
                        case 4:
                            positions.Add(0);
                            positions.Add(1);
                            break;

                        //左下
                        case 5:
                            positions.Add(0);
                            positions.Add(3);
                            break;

                        //右上
                        case 6:
                            positions.Add(1);
                            positions.Add(2);
                            break;

                        //右下
                        case 7:
                            positions.Add(2);
                            positions.Add(3);
                            break;
                        }
                    }
                    //绘制选中点
                    int positionsSize = positions.Count;
                    for (int i = 0; i < positionsSize; i++)
                    {
                        switch (positions[i])
                        {
                        //左
                        case 0:
                            paint.fillRect(borderColor, new FCRect(0, 0, thick, height));
                            break;

                        //上
                        case 1:
                            paint.fillRect(borderColor, new FCRect(0, 0, width, thick));
                            break;

                        //右
                        case 2:
                            paint.fillRect(borderColor, new FCRect(width - thick, 0, width, height));
                            break;

                        //下
                        case 3:
                            paint.fillRect(borderColor, new FCRect(0, height - thick, width, height));
                            break;
                        }
                    }
                }
                else
                {
                    if (Native.PushedControl == this)
                    {
                        if (Math.Abs(m_point1.x - m_point2.x) > 5 && Math.Abs(m_point1.y - m_point2.y) > 5)
                        {
                            FCRect moveRect = getRectangle(pointToControl(m_point1), pointToControl(m_point2));
                            paint.drawRect(borderColor, 2, 0, moveRect);
                        }
                    }
                    paint.drawRect(borderColor, 2, 2, drawRect);
                    FCRect[] pRects     = getResizePoints();
                    int      pRectsSize = pRects.Length;
                    for (int p = 0; p < pRectsSize; p++)
                    {
                        paint.fillRect(borderColor, pRects[p]);
                    }
                    //绘制动画
                    if (resizePoint == -1)
                    {
                        if (m_tick < 20)
                        {
                            if (m_tick > 2 && m_tick < 18)
                            {
                                int xTick = width / 20;
                                int yTick = height / 20;
                                int tWidth = width / 3, tHeight = height / 3;
                                int nSize = RESIZEPOINT_SIZE;
                                paint.setLineCap(2, 2);
                                int a = (10 - Math.Abs(m_tick - 10)) * 20;
                                paint.drawLine(FCColor.argb(a, m_random.Next(0, 256), m_random.Next(0, 256), m_random.Next(0, 256)), m_random.Next(1, 10),
                                               0, xTick * m_tick - tWidth / 2, (m_direction == 1 ? nSize : height - nSize), xTick * m_tick + tWidth / 2, (m_direction == 1 ? nSize : height - nSize));
                                paint.drawLine(FCColor.argb(a, m_random.Next(0, 256), m_random.Next(0, 256), m_random.Next(0, 256)), m_random.Next(1, 10),
                                               0, width - xTick * m_tick - tWidth / 2, (m_direction == 0 ? nSize : height - nSize), width - (xTick * m_tick - tWidth / 2), (m_direction == 0 ? nSize : height - nSize));
                                paint.drawLine(FCColor.argb(a, m_random.Next(0, 256), m_random.Next(0, 256), m_random.Next(0, 256)), m_random.Next(1, 10),
                                               0, (m_direction == 1 ? nSize : width - nSize), height - yTick * m_tick - tHeight / 2, (m_direction == 1 ? nSize : width - nSize), height - (yTick * m_tick - tHeight / 2));
                                paint.drawLine(FCColor.argb(a, m_random.Next(0, 256), m_random.Next(0, 256), m_random.Next(0, 256)), m_random.Next(1, 10),
                                               0, (m_direction == 0 ? nSize : width - nSize), yTick * m_tick - tHeight / 2, (m_direction == 0 ? nSize : width - nSize), yTick * m_tick + tHeight / 2);
                                paint.setLineCap(0, 0);
                            }
                        }
                    }
                }
            }
        }