Example #1
0
 /// <summary>
 /// 绘制复选框
 /// </summary>
 /// <param name="paint">绘图对象</param>
 /// <param name="rect">区域</param>
 public virtual void onPaintCheckBox(FCPaint paint, FCRect rect)
 {
     if (m_checked)
     {
         if (m_tree.CheckedImage != null && m_tree.CheckedImage.Length > 0)
         {
             paint.drawImage(m_tree.CheckedImage, rect);
         }
         else
         {
             paint.fillRect(FCColor.argb(0, 0, 0), rect);
         }
     }
     else
     {
         if (m_tree.UnCheckedImage != null && m_tree.UnCheckedImage.Length > 0)
         {
             paint.drawImage(m_tree.UnCheckedImage, rect);
         }
         else
         {
             paint.drawRect(FCColor.argb(0, 0, 0), 1, 0, rect);
         }
     }
 }
Example #2
0
        /// <summary>
        /// 绘制前景方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintForeground(FCPaint paint, FCRect clipRect)
        {
            FCRect bounds = Bounds;
            int    width  = bounds.right - bounds.left;
            int    height = bounds.bottom - bounds.top;

            if (width > 0 && height > 0)
            {
                if (m_ssLatestData != null && m_szLatestData != null && m_cyLatestData != null)
                {
                    long   titleColor = FCColor.argb(255, 255, 80);
                    FCFont font       = new FCFont("SimSun", 16, false, false, false);
                    FCFont indexFont  = new FCFont("Arial", 14, true, false, false);
                    long   grayColor  = FCColor.Border;
                    //上证指数
                    long indexColor = FCDraw.getPriceColor(m_ssLatestData.m_close, m_ssLatestData.m_lastClose);
                    int  left       = 1;
                    FCDraw.drawText(paint, "上证", titleColor, font, left, 3);
                    left += 40;
                    paint.drawLine(grayColor, 1, 0, left, 0, left, height);
                    String amount     = (m_ssLatestData.m_amount / 100000000).ToString("0.0") + "亿";
                    FCSize amountSize = paint.textSize(amount, indexFont);
                    FCDraw.drawText(paint, amount, titleColor, indexFont, width / 3 - amountSize.cx, 3);
                    left += (width / 3 - 40 - amountSize.cx) / 4;
                    int length = FCDraw.drawUnderLineNum(paint, m_ssLatestData.m_close, 2, indexFont, indexColor, false, left, 3);
                    left  += length + (width / 3 - 40 - amountSize.cx) / 4;
                    length = FCDraw.drawUnderLineNum(paint, m_ssLatestData.m_close - m_ssLatestData.m_lastClose, 2, indexFont, indexColor, false, left, 3);
                    //深证指数
                    left = width / 3;
                    paint.drawLine(grayColor, 1, 0, left, 0, left, height);
                    indexColor = FCDraw.getPriceColor(m_szLatestData.m_close, m_szLatestData.m_lastClose);
                    FCDraw.drawText(paint, "深证", titleColor, font, left, 3);
                    left += 40;
                    paint.drawLine(grayColor, 1, 0, left, 0, left, height);
                    amount     = (m_szLatestData.m_amount / 100000000).ToString("0.0") + "亿";
                    amountSize = paint.textSize(amount, indexFont);
                    FCDraw.drawText(paint, amount, titleColor, indexFont, width * 2 / 3 - amountSize.cx, 3);
                    left  += (width / 3 - 40 - amountSize.cx) / 4;
                    length = FCDraw.drawUnderLineNum(paint, m_szLatestData.m_close, 2, indexFont, indexColor, false, left, 3);
                    left  += length + (width / 3 - 40 - amountSize.cx) / 4;
                    length = FCDraw.drawUnderLineNum(paint, m_szLatestData.m_close - m_szLatestData.m_lastClose, 2, indexFont, indexColor, false, left, 3);
                    //创业指数
                    left = width * 2 / 3;
                    paint.drawLine(grayColor, 1, 0, left, 0, left, height);
                    indexColor = FCDraw.getPriceColor(m_cyLatestData.m_close, m_cyLatestData.m_lastClose);
                    FCDraw.drawText(paint, "创业", titleColor, font, left, 3);
                    left += 40;
                    paint.drawLine(grayColor, 1, 0, left, 0, left, height);
                    amount     = (m_cyLatestData.m_amount / 100000000).ToString("0.0") + "亿";
                    amountSize = paint.textSize(amount, indexFont);
                    FCDraw.drawText(paint, amount, titleColor, indexFont, width - amountSize.cx, 3);
                    left  += (width / 3 - 40 - amountSize.cx) / 4;
                    length = FCDraw.drawUnderLineNum(paint, m_cyLatestData.m_close, 2, indexFont, indexColor, false, left, 3);
                    left  += (width / 3 - 40 - amountSize.cx) / 4 + length;
                    length = FCDraw.drawUnderLineNum(paint, m_cyLatestData.m_close - m_cyLatestData.m_lastClose, 2, indexFont, indexColor, false, left, 3);
                    paint.drawRect(grayColor, 1, 0, new FCRect(0, 0, width - 1, height - 1));
                }
            }
        }
Example #3
0
        /// <summary>
        /// 绘制边线方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintBorder(FCPaint paint, FCRect clipRect)
        {
            int    width = Width, height = Height;
            FCRect drawRect = new FCRect(0, 0, width, height);

            if (m_isEllipse)
            {
                paint.drawEllipse(getPaintingBorderColor(), 1, 0, drawRect);
            }
            else
            {
                paint.drawRect(getPaintingBorderColor(), 1, 0, drawRect);
            }
        }
Example #4
0
        /// <summary>
        /// 重绘方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaint(FCPaint paint, FCRect clipRect)
        {
            int         vh        = 0;
            FCLayoutDiv layoutDiv = Parent as FCLayoutDiv;

            if (layoutDiv.HScrollBar != null && layoutDiv.HScrollBar.Visible)
            {
                vh = layoutDiv.HScrollBar.Height;
            }
            int    width = Width, height = Height - vh;
            FCRect drawRect = new FCRect(0, 0, width, height);

            paint.fillRect(FCColor.argb(0, 0, 0), drawRect);
            paint.drawRect(FCColor.argb(50, 105, 217), 1, 0, drawRect);
            String text  = Text;
            FCFont font  = Font;
            FCSize tSize = paint.textSize(text, font);
            FCRect tRect = new FCRect((width - tSize.cx) / 2, (height - tSize.cy) / 2, (width + tSize.cx) / 2, (height + tSize.cy) / 2);

            paint.drawText(text, FCColor.argb(255, 0, 0), font, tRect);
            FCPoint[] points = new FCPoint[3];
            points[0] = new FCPoint(0, 0);
            points[1] = new FCPoint(50, 0);
            points[2] = new FCPoint(0, 30);
            FCFont font3 = new FCFont("微软雅黑", 10, false, false, false);

            if (m_isUser)
            {
                paint.fillPolygon(FCColor.argb(255, 200, 0), points);
                FCDraw.drawText(paint, "自定义", FCColor.argb(0, 0, 0), font3, 2, 2);
                String btn1   = "编辑";
                FCFont font2  = new FCFont("微软雅黑", 12, false, false, false);
                FCSize tSize2 = paint.textSize(btn1, font2);
                tRect        = new FCRect(width - tSize2.cx - 20, height - tSize2.cy - 5, 0, 0);
                tRect.right  = tRect.left + tSize2.cx;
                tRect.bottom = tRect.top + tSize2.cy;
                m_tRect      = tRect;
                paint.drawText(btn1, FCColor.argb(80, 255, 80), font2, m_tRect);
            }
            else
            {
                paint.fillPolygon(FCColor.argb(80, 255, 255), points);
                FCDraw.drawText(paint, "系统", FCColor.argb(0, 0, 0), font3, 2, 2);
            }
        }
Example #5
0
        /// <summary>
        /// 重绘前景方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintBackground(FCPaint paint, FCRect clipRect)
        {
            base.onPaintBackground(paint, clipRect);
            int width = Width, height = Height;

            lock (m_barrages) {
                int barragesSize = m_barrages.Count;
                for (int i = 0; i < barragesSize; i++)
                {
                    Barrage brg  = m_barrages[i];
                    FCFont  font = brg.Font;
                    FCRect  rect = brg.Rect;
                    String  str  = brg.Text;
                    FCSize  size = paint.textSize(str, font);
                    rect.right  = rect.left + size.cx;
                    rect.bottom = rect.top + size.cy;
                    brg.Rect    = rect;
                    long color = brg.Color;
                    int  mode  = brg.Mode;
                    if (mode == 1)
                    {
                        int a = 0, r = 0, g = 0, b = 0;
                        FCColor.toArgb(null, color, ref a, ref r, ref g, ref b);
                        a     = a * brg.Tick / 400;
                        color = FCColor.argb(a, r, g, b);
                    }
                    paint.drawText(str, color, font, rect);
                }
            }
            if (m_progress > 0)
            {
                int    tWidth    = 500;
                int    tHeight   = 60;
                int    showWidth = m_progress * 500 / 100;
                FCRect pRect     = new FCRect((width - tWidth) / 2, (height - tHeight) / 2, (width + tWidth) / 2, (height + tHeight) / 2);
                paint.fillRect(FCColor.argb(255, 0, 0), pRect);
                FCRect pRect2 = new FCRect((width - tWidth) / 2, (height - tHeight) / 2, (width - tWidth) / 2 + showWidth, (height + tHeight) / 2);
                paint.fillRect(FCColor.argb(255, 255, 0), pRect2);
                paint.drawRect(FCColor.argb(255, 255, 255), 1, 0, pRect);
                FCFont pFont = new FCFont("微软雅黑", 20, true, false, false);
                FCSize pSize = paint.textSize(m_progressText, pFont);
                FCDraw.drawText(paint, m_progressText, FCColor.argb(0, 0, 0), pFont, (width - pSize.cx) / 2, (height - pSize.cy) / 2);
            }
        }
Example #6
0
        /// <summary>
        /// 重绘选中按钮方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public virtual void onPaintCheckButton(FCPaint paint, FCRect clipRect)
        {
            //绘制背景图
            String bkImage = getPaintingBackImage();

            if (bkImage != null && bkImage.Length > 0)
            {
                paint.drawImage(bkImage, clipRect);
            }
            else
            {
                if (m_checked)
                {
                    FCRect innerRect = new FCRect(clipRect.left + 2, clipRect.top + 2, clipRect.right - 3, clipRect.bottom - 3);
                    if (clipRect.right - clipRect.left < 4 || clipRect.bottom - clipRect.top < 4)
                    {
                        innerRect = clipRect;
                    }
                    paint.fillRect(getPaintingButtonBackColor(), innerRect);
                }
                paint.drawRect(getPaintingButtonBorderColor(), 1, 0, clipRect);
            }
        }
Example #7
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);
                }
            }
        }
Example #8
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);
                            }
                        }
                    }
                }
            }
        }