示例#1
0
 /// <summary>
 /// 重绘前景方法
 /// </summary>
 /// <param name="paint">绘图对象</param>
 /// <param name="clipRect">裁剪区域</param>
 public override void onPaintForeground(FCPaint paint, FCRect clipRect)
 {
     if (m_calendar != null)
     {
         int            width = Width, height = Height;
         FCFont         font = Font;
         String         text = "";
         FCCalendarMode mode = m_calendar.Mode;
         //日
         if (mode == FCCalendarMode.Day)
         {
             CMonth month = m_calendar.Month;
             text = month.Year.ToString() + "年" + month.Month.ToString() + "月";
         }
         //月
         else if (mode == FCCalendarMode.Month)
         {
             text = m_calendar.MonthDiv.Year.ToString() + "年";
         }
         //年
         else if (mode == FCCalendarMode.Year)
         {
             int startYear = m_calendar.YearDiv.StartYear;
             text = startYear.ToString() + "年 - " + (startYear + 12).ToString() + "年";
         }
         FCSize tSize = paint.textSize(text, font);
         FCRect tRect = new FCRect();
         tRect.left   = (width - tSize.cx) / 2;
         tRect.top    = (height - tSize.cy) / 2;
         tRect.right  = tRect.left + tSize.cx + 1;
         tRect.bottom = tRect.top + tSize.cy + 1;
         paint.drawText(text, getPaintingTextColor(), font, tRect);
     }
 }
示例#2
0
 /// <summary>
 /// 创建透明按钮
 /// </summary>
 public RuningButton()
 {
     AllowDrag   = true;
     BackColor   = FCColor.argb(50, 50, 50);
     BorderColor = FCColor.argb(100, 100, 100);
     Font        = new FCFont("SimSun", 30, true, false, false);
 }
示例#3
0
 /// <summary>
 /// 绘制有下划线的数字
 /// </summary>
 /// <param name="paint">绘图对象</param>
 /// <param name="value">值</param>
 /// <param name="digit">保留小数位数</param>
 /// <param name="font">字体</param>
 /// <param name="fontColor">文字颜色</param>
 /// <param name="zeroAsEmpty">0是否为空</param>
 /// <param name="x">横坐标</param>
 /// <param name="y">纵坐标</param>
 /// <returns>绘制的横坐标</returns>
 public static int drawUnderLineNum(FCPaint paint, double value, int digit, FCFont font, long fontColor, bool zeroAsEmpty, int x, int y)
 {
     if (zeroAsEmpty && value == 0)
     {
         String text = "-";
         FCSize size = paint.textSize(text, font);
         FCDraw.drawText(paint, text, fontColor, font, x, y);
         return(size.cx);
     }
     else
     {
         String[] nbs = FCStr.getValueByDigit(value, digit).Split(new String[] { "." }, StringSplitOptions.RemoveEmptyEntries);
         if (nbs.Length == 1)
         {
             FCSize size = paint.textSize(nbs[0], font);
             FCDraw.drawText(paint, nbs[0], fontColor, font, x, y);
             return(size.cx);
         }
         else
         {
             FCSize decimalSize = paint.textSize(nbs[0], font);
             FCSize size        = paint.textSize(nbs[1], font);
             FCDraw.drawText(paint, nbs[0], fontColor, font, x, y);
             FCDraw.drawText(paint, nbs[1], fontColor, font, x
                             + decimalSize.cx + 1, y);
             paint.drawLine(fontColor, 1, 0, x
                            + decimalSize.cx + 1, y + decimalSize.cy,
                            x + decimalSize.cx + size.cx, y + decimalSize.cy);
             return(decimalSize.cx + size.cx);
         }
     }
 }
示例#4
0
        /// <summary>
        /// 重绘方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public virtual void onPaint(FCPaint paint, FCRect clipRect)
        {
            int    width = m_calendar.Width, height = m_calendar.Height;
            int    top  = height - m_height;
            FCRect rect = new FCRect(0, height - m_height, width, height);

            paint.fillRect(getPaintingBackColor(), rect);
            if (m_height > 0)
            {
                long   textColor = getPaintingTextColor();
                FCFont font      = m_calendar.Font;
                FCSize tSize     = paint.textSize("时", font);
                FCRect tRect     = new FCRect();
                tRect.left   = width / 3 - tSize.cx;
                tRect.top    = top + m_height / 2 - tSize.cy / 2;
                tRect.right  = tRect.left + tSize.cx;
                tRect.bottom = tRect.top + tSize.cy;
                paint.drawText("时", textColor, font, tRect);
                tSize        = paint.textSize("分", font);
                tRect.left   = width * 2 / 3 - tSize.cx;
                tRect.top    = top + m_height / 2 - tSize.cy / 2;
                tRect.right  = tRect.left + tSize.cx;
                tRect.bottom = tRect.top + tSize.cy;
                paint.drawText("分", textColor, font, tRect);
                tSize        = paint.textSize("秒", font);
                tRect.left   = width - tSize.cx - 5;
                tRect.top    = top + m_height / 2 - tSize.cy / 2;
                tRect.right  = tRect.left + tSize.cx;
                tRect.bottom = tRect.top + tSize.cy;
                paint.drawText("秒", textColor, font, tRect);
            }
        }
示例#5
0
        /// <summary>
        /// 重绘边线方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintBorder(FCPaint paint, FCRect clipRect)
        {
            FCFont font = Font;
            int    width = Width, height = Height;
            String text  = Text;
            FCSize tSize = new FCSize();

            if (text.Length > 0)
            {
                tSize = paint.textSize(text, font);
            }
            else
            {
                tSize    = paint.textSize("0", font);
                tSize.cx = 0;
            }
            //绘制边线
            FCPoint[] points  = new FCPoint[6];
            int       tMid    = tSize.cy / 2;
            int       padding = 2;

            points[0] = new FCPoint(10, tMid);
            points[1] = new FCPoint(padding, tMid);
            points[2] = new FCPoint(padding, height - padding);
            points[3] = new FCPoint(width - padding, height - padding);
            points[4] = new FCPoint(width - padding, tMid);
            points[5] = new FCPoint(14 + tSize.cx, tMid);
            paint.drawPolyline(getPaintingBorderColor(), 1, 0, points);
            callPaintEvents(FCEventID.PAINTBORDER, paint, clipRect);
        }
示例#6
0
        /// <summary>
        /// 绘制文字
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="text">文字</param>
        /// <param name="dwPenColor">颜色</param>
        /// <param name="font">字体</param>
        /// <param name="x">横坐标</param>
        /// <param name="y">纵坐标</param>
        public static void drawText(FCPaint paint, String text, long dwPenColor, FCFont font, int x, int y)
        {
            FCSize tSize = paint.textSize(text, font);
            FCRect tRect = new FCRect(x, y, x + tSize.cx, y + tSize.cy);

            paint.drawText(text, dwPenColor, font, tRect);
        }
示例#7
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));
                }
            }
        }
示例#8
0
 /// <summary>
 /// 创建日期标题
 /// </summary>
 /// <param name="calendar">日历控件</param>
 public DateTitle(FCCalendar calendar)
 {
     m_calendar  = calendar;
     BackColor   = FCColor.None;
     BorderColor = FCColor.None;
     Font        = new FCFont("宋体", 22, true, false, false);
     Size        = new FCSize(180, 30);
 }
示例#9
0
        /// <summary>
        /// 重绘前景方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintForeground(FCPaint paint, FCRect clipRect)
        {
            String text = Text;
            int    width = Width, height = Height;

            if (width > 0 && height > 0)
            {
                FCRect  buttonRect = new FCRect(5, (height - m_buttonSize.cy) / 2, 5 + m_buttonSize.cx, (height + m_buttonSize.cy) / 2);
                FCPoint tLocation  = new FCPoint();
                FCSize  tSize      = new FCSize();
                FCFont  font       = Font;
                if (text != null && text.Length > 0)
                {
                    tSize       = paint.textSize(text, font);
                    tLocation.x = buttonRect.right + 5;
                    tLocation.y = (height - tSize.cy) / 2;
                }
                //居中
                if (m_buttonAlign == FCHorizontalAlign.Center)
                {
                    buttonRect.left  = (width - m_buttonSize.cx) / 2;
                    buttonRect.right = (width + m_buttonSize.cx) / 2;
                    tLocation.x      = buttonRect.right + 5;
                }
                //远离
                else if (m_buttonAlign == FCHorizontalAlign.Right)
                {
                    buttonRect.left  = width - m_buttonSize.cx - 5;
                    buttonRect.right = width - 5;
                    tLocation.x      = buttonRect.left - tSize.cx - 5;
                }
                //绘制背景图
                onPaintCheckButton(paint, buttonRect);
                //绘制文字
                if (text != null && text.Length > 0)
                {
                    FCRect tRect     = new FCRect(tLocation.x, tLocation.y, tLocation.x + tSize.cx + 1, tLocation.y + tSize.cy);
                    long   textColor = getPaintingTextColor();
                    if (AutoEllipsis && (tRect.right > clipRect.right || tRect.bottom > clipRect.bottom))
                    {
                        if (tRect.right > clipRect.right)
                        {
                            tRect.right = clipRect.right;
                        }
                        if (tRect.bottom > clipRect.bottom)
                        {
                            tRect.bottom = clipRect.bottom;
                        }
                        paint.drawTextAutoEllipsis(text, textColor, font, tRect);
                    }
                    else
                    {
                        paint.drawText(text, textColor, font, tRect);
                    }
                }
            }
        }
示例#10
0
 /// <summary>
 /// 创建窗体
 /// </summary>
 public WindowEx()
 {
     BackColor     = FCColor.None;
     BorderColor   = FCDraw.FCCOLORS_LINECOLOR3;
     CaptionHeight = 25;
     Font          = new FCFont("微软雅黑", 14, false, false, false);
     TextColor     = FCColor.None;
     ShadowColor   = FCDraw.FCCOLORS_BACKCOLOR5;
     ShadowSize    = 0;
 }
示例#11
0
 /// <summary>
 /// 创建窗体
 /// </summary>
 public WindowEx()
 {
     BackColor     = FCColor.None;
     BorderColor   = FCDraw.FCCOLORS_LINECOLOR3;
     CaptionHeight = 23;
     Font          = new FCFont("SimSun", 14, true, false, false);
     TextColor     = FCColor.None;
     Opacity       = 0;
     ShadowColor   = FCDraw.FCCOLORS_BACKCOLOR5;
 }
示例#12
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);
            }
        }
示例#13
0
        /// <summary>
        /// 重绘前景方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintForeground(FCPaint paint, FCRect clipRect)
        {
            String text = Text;

            if (text.Length > 0)
            {
                FCFont font  = Font;
                FCSize tSize = paint.textSize(text, font);
                FCRect tRect = new FCRect(12, 0, 12 + tSize.cx, tSize.cy);
                paint.drawText(text, getPaintingTextColor(), font, tRect);
            }
        }
示例#14
0
 /// <summary>
 /// 重绘前景方法
 /// </summary>
 /// <param name="paint">绘图对象</param>
 /// <param name="clipRect">裁剪区域</param>
 public override void onPaintForeground(FCPaint paint, FCRect clipRect)
 {
     base.onPaintForeground(paint, clipRect);
     //绘制移动的节点
     if (m_movingNode != null)
     {
         FCFont  font  = Font;
         FCPoint mp    = TouchPoint;
         FCSize  tSize = paint.textSize(m_movingNode.Text, font);
         FCRect  tRect = new FCRect(mp.x, mp.y, mp.x + tSize.cx, mp.y + tSize.cy);
         paint.drawText(m_movingNode.Text, TextColor, font, tRect);
     }
 }
示例#15
0
        /// <summary>
        /// 绘制前景方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintForeground(FCPaint paint, FCRect clipRect)
        {
            String text = Text;

            if (text != null && text.Length > 0)
            {
                int     width    = Width;
                FCFont  font     = Font;
                FCSize  tSize    = paint.textSize(text, font);
                FCPoint strPoint = new FCPoint();
                strPoint.x = 5;
                strPoint.y = (m_captionHeight - tSize.cy) / 2;
                FCRect tRect = new FCRect(strPoint.x, strPoint.y, strPoint.x + tSize.cx, strPoint.y + tSize.cy);
                paint.drawText(text, getPaintingTextColor(), font, tRect);
            }
        }
示例#16
0
        /// <summary>
        /// 重绘前景方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public virtual void onPaintForeground(FCPaint paint, FCRect clipRect)
        {
            int    width    = m_bounds.right - m_bounds.left;
            int    height   = m_bounds.bottom - m_bounds.top;
            String yearStr  = m_year.ToString();
            FCFont font     = m_calendar.Font;
            FCSize textSize = paint.textSize(yearStr, font);
            //创建渐变刷
            FCRect tRect = new FCRect();

            tRect.left   = m_bounds.left + (width - textSize.cx) / 2;
            tRect.top    = m_bounds.top + (height - textSize.cy) / 2;
            tRect.right  = tRect.left + textSize.cx;
            tRect.bottom = tRect.top + textSize.cy;
            paint.drawText(yearStr, getPaintingTextColor(), font, tRect);
        }
示例#17
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);
            }
        }
示例#18
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);
            }
        }
示例#19
0
        /// <summary>
        /// ÖØ»æÇ°¾°·½·¨
        /// </summary>
        /// <param name="paint">»æͼ¶ÔÏó</param>
        /// <param name="clipRect">²Ã¼ôÇøÓò</param>
        public override void onPaintForeground(FCPaint paint, FCRect clipRect)
        {
            base.onPaintForeground(paint, clipRect);
            int    width = Width, height = Height;
            String cText = "UC:" + m_cid;
            int    fSize = Math.Min(width, height) / 3;

            if (fSize > 40)
            {
                fSize = 40;
            }
            if (fSize > 3)
            {
                FCFont tfFont = new FCFont("SimSun", fSize, true, false, false);
                FCSize ftSize = paint.textSize(cText, tfFont);
                FCRect tfRect = new FCRect();
                tfRect.left   = (width - ftSize.cx) / 2;
                tfRect.top    = (height - ftSize.cy) / 2;
                tfRect.right  = tfRect.left + ftSize.cx;
                tfRect.bottom = tfRect.top + ftSize.cy;
                paint.drawText(cText, FCDraw.FCCOLORS_TEXTCOLOR3, tfFont, tfRect);
            }
            String text  = Text;
            FCFont font  = Font;
            FCSize tSize = paint.textSize(text, font);
            FCRect tRect = new FCRect();

            if (m_cid == "windowex")
            {
                tRect.left = 2;
                tRect.top  = 5;
            }
            else
            {
                tRect.left = (width - tSize.cx) / 2;
                tRect.top  = (height - tSize.cy) / 2;
            }
            tRect.right  = tRect.left + tSize.cx;
            tRect.bottom = tRect.top + tSize.cy;
            paint.drawText(text, getPaintingTextColor(), font, tRect);
        }
示例#20
0
        /// <summary>
        /// 重绘前景方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintForeground(FCPaint paint, FCRect clipRect)
        {
            int width = Width, height = Height;

            if (width > 0 && height > 0)
            {
                String text = Text;
                if (text != null && text.Length > 0)
                {
                    FCFont   font      = Font;
                    FCRect   rect      = DisplayRect;
                    FCSize   tSize     = paint.textSize(text, font);
                    long     foreColor = getPaintingTextColor();
                    string   cmd       = Name.Substring(3).ToLower();
                    BaseWork work      = DataCenter.Works[cmd];
                    if (work != null)
                    {
                        FCFont sFont = new FCFont("Arial", 30, true, false, false);
                        String state = "START!";
                        if (work.IsRunning)
                        {
                            state = work.Log;
                            if (state.Length == 0)
                            {
                                state = "START!";
                            }
                            else
                            {
                                sFont.m_fontSize = 30;
                            }
                        }
                        FCDraw.drawText(paint, text, foreColor, font, (width - tSize.cx) / 2, (height - tSize.cy) / 2 - 30);
                        tSize = paint.textSize(state, sFont);
                        FCDraw.drawText(paint, state, foreColor, sFont, (width - tSize.cx) / 2, (height - tSize.cy) / 2 + 30);
                    }
                }
            }
        }
示例#21
0
        /// <summary>
        /// 字体转换为字符
        /// </summary>
        /// <param name="font">字体</param>
        /// <returns>字符</returns>
        public static String convertFontToStr(FCFont font)
        {
            ArrayList <String> strs = new ArrayList <String>();

            strs.add(font.m_fontFamily);
            strs.add(font.m_fontSize.ToString());
            if (font.m_bold)
            {
                strs.add("Bold");
            }
            if (font.m_underline)
            {
                strs.add("UnderLine");
            }
            if (font.m_italic)
            {
                strs.add("Italic");
            }
            if (font.m_strikeout)
            {
                strs.add("Strikeout");
            }
            String fontStr = "";
            int    size    = strs.size();

            if (size > 0)
            {
                for (int i = 0; i < size; i++)
                {
                    fontStr += strs[i];
                    if (i != size - 1)
                    {
                        fontStr += ",";
                    }
                }
            }
            return(fontStr);
        }
示例#22
0
 /// <summary>
 /// 预绘图方法
 /// </summary>
 /// <param name="paint">绘图对象</param>
 /// <param name="clipRect">裁剪区域</param>
 public override void onPrePaint(FCPaint paint, FCRect clipRect)
 {
     base.onPrePaint(paint, clipRect);
     if (AutoSize)
     {
         int width = Width, height = Height;
         if (width > 0 && height > 0)
         {
             String text  = Text;
             FCFont font  = Font;
             FCSize tSize = paint.textSize(text, font);
             if (AutoSize)
             {
                 int newW = tSize.cx + 2;
                 int newH = tSize.cy + 2;
                 if (newW != width || newH != height)
                 {
                     Size = new FCSize(newW, newH);
                 }
             }
         }
     }
 }
示例#23
0
        /// <summary>
        /// 重绘前景方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintForeground(FCPaint paint, FCRect clipRect)
        {
            int            width = Width, height = Height;
            FCCalendarMode mode = m_calendar.Mode;

            //画星期标题
            if (mode == FCCalendarMode.Day)
            {
                float  left        = 0;
                FCSize weekDaySize = new FCSize();
                FCFont font        = Font;
                long   textColor   = getPaintingTextColor();
                for (int i = 0; i < m_weekDays.Length; i++)
                {
                    weekDaySize = paint.textSize(m_weekDays[i], font);
                    float  textX = left + (width / 7F) / 2F - weekDaySize.cx / 2F;
                    float  textY = height - weekDaySize.cy;
                    FCRect tRect = new FCRect(textX, textY, textX + weekDaySize.cx, textY + weekDaySize.cy);
                    paint.drawText(m_weekDays[i], textColor, font, tRect);
                    left += Width / 7F;
                }
            }
        }
示例#24
0
        /// <summary>
        /// 重绘方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="rect">矩形</param>
        /// <param name="clipRect">裁剪矩形</param>
        /// <param name="isAlternate">是否交替行</param>
        public override void onPaint(FCPaint paint, FCRect rect, FCRect clipRect, bool isAlternate)
        {
            int       clipW = clipRect.right - clipRect.left;
            int       clipH = clipRect.bottom - clipRect.top;
            FCGrid    grid  = Grid;
            FCGridRow row   = Row;

            if (clipW > 0 && clipH > 0 && grid != null && Column != null && row != null && TargetColumn != null)
            {
                int          width      = rect.right - rect.left;
                int          height     = rect.bottom - rect.top;
                int          scrollH    = 0;
                FCHScrollBar hscrollBar = grid.HScrollBar;
                if (hscrollBar != null && hscrollBar.Visible)
                {
                    scrollH = hscrollBar.Pos;
                }
                FCFont          font         = null;
                long            backColor    = FCColor.None;
                long            textColor    = FCColor.None;
                bool            autoEllipsis = m_tree.AutoEllipsis;
                FCGridCellStyle style        = Style;
                if (style != null)
                {
                    if (style.AutoEllipsis)
                    {
                        autoEllipsis = style.AutoEllipsis;
                    }
                    backColor = style.BackColor;
                    if (style.Font != null)
                    {
                        font = style.Font;
                    }
                    textColor = style.TextColor;
                }
                FCGridRowStyle rowStyle = grid.RowStyle;
                if (isAlternate)
                {
                    FCGridRowStyle alternateRowStyle = grid.AlternateRowStyle;
                    if (alternateRowStyle != null)
                    {
                        rowStyle = alternateRowStyle;
                    }
                }
                if (rowStyle != null)
                {
                    bool selected = false;
                    ArrayList <FCGridRow> selectedRows = grid.SelectedRows;
                    int selectedRowsSize = selectedRows.size();
                    for (int i = 0; i < selectedRowsSize; i++)
                    {
                        if (selectedRows[i] == row)
                        {
                            selected = true;
                            break;
                        }
                    }
                    if (backColor == FCColor.None)
                    {
                        //选中
                        if (selected)
                        {
                            backColor = rowStyle.SelectedBackColor;
                        }
                        //悬停
                        else if (Row == Grid.HoveredRow)
                        {
                            backColor = rowStyle.HoveredBackColor;
                        }
                        //普通
                        else
                        {
                            backColor = rowStyle.BackColor;
                        }
                    }
                    if (font == null)
                    {
                        font = rowStyle.Font;
                    }
                    if (textColor == FCColor.None)
                    {
                        //选中
                        if (selected)
                        {
                            textColor = rowStyle.SelectedTextColor;
                        }
                        //悬停
                        else if (Row == Grid.HoveredRow)
                        {
                            textColor = rowStyle.HoveredTextColor;
                        }
                        //普通
                        else
                        {
                            textColor = rowStyle.TextColor;
                        }
                    }
                }
                //绘制背景
                paint.fillRect(backColor, rect);
                FCRect headerRect = TargetColumn.Bounds;
                headerRect.left += Grid.HorizontalOffset - scrollH;
                headerRect.top  += Grid.VerticalOffset - scrollH;
                int left = headerRect.left;
                //绘制复选框
                if (m_tree.CheckBoxes)
                {
                    int    cw           = m_tree.CheckBoxSize.cx;
                    int    ch           = m_tree.CheckBoxSize.cy;
                    FCRect checkBoxRect = new FCRect();
                    checkBoxRect.left   = left;
                    checkBoxRect.top    = rect.top + (height - ch) / 2;
                    checkBoxRect.right  = checkBoxRect.left + cw;
                    checkBoxRect.bottom = checkBoxRect.top + ch;
                    onPaintCheckBox(paint, checkBoxRect);
                    left += cw + 10;
                }
                //绘制折叠展开的标志
                int nw = m_tree.NodeSize.cx;
                int nh = m_tree.NodeSize.cy;
                if (m_nodes.size() > 0)
                {
                    FCRect nodeRect = new FCRect();
                    nodeRect.left   = left;
                    nodeRect.top    = rect.top + (height - nh) / 2;
                    nodeRect.right  = nodeRect.left + nw;
                    nodeRect.bottom = nodeRect.top + nh;
                    onPaintNode(paint, nodeRect);
                }
                left    += nw + 10;
                m_indent = left;
                String text = getPaintText();
                //绘制文字
                if (text != null)
                {
                    FCSize tSize = paint.textSize(text, font);
                    FCRect tRect = new FCRect();
                    tRect.left   = left;
                    tRect.top    = rect.top + (row.Height - tSize.cy) / 2;
                    tRect.right  = tRect.left + tSize.cx;
                    tRect.bottom = tRect.top + tSize.cy;
                    if (autoEllipsis && (tRect.right < clipRect.right || tRect.bottom < clipRect.bottom))
                    {
                        if (tRect.right < clipRect.right)
                        {
                            tRect.right = clipRect.right;
                        }
                        if (tRect.bottom < clipRect.bottom)
                        {
                            tRect.bottom = clipRect.bottom;
                        }
                        paint.drawTextAutoEllipsis(text, textColor, font, tRect);
                    }
                    else
                    {
                        paint.drawText(text, textColor, font, tRect);
                    }
                }
            }
            onPaintControl(paint, rect, clipRect);
        }
示例#25
0
 /// <summary>
 /// 创建透明按钮
 /// </summary>
 public RibbonButton()
 {
     BackColor   = FCColor.None;
     BorderColor = FCColor.None;
     Font        = new FCFont("微软雅黑", 12, false, false, false);
 }
示例#26
0
        /// <summary>
        /// 重绘方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="rect">矩形</param>
        /// <param name="clipRect">裁剪矩形</param>
        /// <param name="isAlternate">是否交替行</param>
        public virtual void onPaint(FCPaint paint, FCRect rect, FCRect clipRect, bool isAlternate)
        {
            int clipW = clipRect.right - clipRect.left;
            int clipH = clipRect.bottom - clipRect.top;

            if (clipW > 0 && clipH > 0)
            {
                if (m_grid != null && m_row != null && m_column != null)
                {
                    //判断选中
                    String text     = getPaintText();
                    bool   selected = false;
                    if (m_grid.SelectionMode == FCGridSelectionMode.SelectCell)
                    {
                        ArrayList <FCGridCell> selectedCells = m_grid.SelectedCells;
                        int selectedCellSize = selectedCells.size();
                        for (int i = 0; i < selectedCellSize; i++)
                        {
                            if (selectedCells.get(i) == this)
                            {
                                selected = true;
                                break;
                            }
                        }
                    }
                    else if (m_grid.SelectionMode == FCGridSelectionMode.SelectFullColumn)
                    {
                        ArrayList <FCGridColumn> selectedColumns = m_grid.SelectedColumns;
                        int selectedColumnsSize = selectedColumns.size();
                        for (int i = 0; i < selectedColumnsSize; i++)
                        {
                            if (selectedColumns.get(i) == m_column)
                            {
                                selected = true;
                                break;
                            }
                        }
                    }
                    else if (m_grid.SelectionMode == FCGridSelectionMode.SelectFullRow)
                    {
                        ArrayList <FCGridRow> selectedRows = m_grid.SelectedRows;
                        int selectedRowsSize = selectedRows.size();
                        for (int i = 0; i < selectedRowsSize; i++)
                        {
                            if (selectedRows.get(i) == m_row)
                            {
                                selected = true;
                                break;
                            }
                        }
                    }
                    //获取颜色
                    FCFont            font            = null;
                    long              backColor       = FCColor.None;
                    long              textColor       = FCColor.None;
                    bool              autoEllipsis    = m_grid.AutoEllipsis;
                    FCHorizontalAlign horizontalAlign = m_column.CellAlign;
                    if (m_style != null)
                    {
                        if (m_style.AutoEllipsis)
                        {
                            autoEllipsis = m_style.AutoEllipsis;
                        }
                        backColor = m_style.BackColor;
                        if (m_style.Font != null)
                        {
                            font = m_style.Font;
                        }
                        textColor = m_style.TextColor;
                        if (m_style.Align != FCHorizontalAlign.Inherit)
                        {
                            horizontalAlign = m_style.Align;
                        }
                    }
                    FCGridRowStyle rowStyle = m_grid.RowStyle;
                    if (isAlternate)
                    {
                        FCGridRowStyle alternateRowStyle = m_grid.AlternateRowStyle;
                        if (alternateRowStyle != null)
                        {
                            rowStyle = alternateRowStyle;
                        }
                    }
                    if (rowStyle != null)
                    {
                        if (backColor == FCColor.None)
                        {
                            if (selected)
                            {
                                backColor = rowStyle.SelectedBackColor;
                            }
                            else if (m_row == m_grid.HoveredRow)
                            {
                                backColor = rowStyle.HoveredBackColor;
                            }
                            else
                            {
                                backColor = rowStyle.BackColor;
                            }
                        }
                        if (font == null)
                        {
                            font = rowStyle.Font;
                        }
                        if (textColor == FCColor.None)
                        {
                            if (selected)
                            {
                                textColor = rowStyle.SelectedTextColor;
                            }
                            else if (m_row == m_grid.HoveredRow)
                            {
                                textColor = rowStyle.HoveredTextColor;
                            }
                            else
                            {
                                textColor = rowStyle.TextColor;
                            }
                        }
                    }
                    paint.fillRect(backColor, rect);
                    FCSize  tSize  = paint.textSize(text, font);
                    FCPoint tPoint = new FCPoint(rect.left + 1, rect.top + clipH / 2 - tSize.cy / 2);
                    int     width  = rect.right - rect.left;
                    if (tSize.cx < width)
                    {
                        if (horizontalAlign == FCHorizontalAlign.Center)
                        {
                            tPoint.x = rect.left + (rect.right - rect.left - tSize.cx) / 2;
                        }
                        else if (horizontalAlign == FCHorizontalAlign.Right)
                        {
                            tPoint.x = rect.right - tSize.cx - 2;
                        }
                    }
                    FCRect tRect = new FCRect(tPoint.x, tPoint.y, tPoint.x + tSize.cx, tPoint.y + tSize.cy);
                    if (autoEllipsis && (tRect.right > clipRect.right || tRect.bottom > clipRect.bottom))
                    {
                        if (tRect.right > clipRect.right)
                        {
                            tRect.right = clipRect.right;
                        }
                        if (tRect.bottom > clipRect.bottom)
                        {
                            tRect.bottom = clipRect.bottom;
                        }
                        paint.drawTextAutoEllipsis(text, textColor, font, tRect);
                    }
                    else
                    {
                        paint.drawText(text, textColor, font, tRect);
                    }
                }
            }
        }
示例#27
0
 /// <summary>
 /// 创建按钮
 /// </summary>
 public IndicatorButton()
 {
     BorderColor = FCColor.None;
     Font        = new FCFont("微软雅黑", 14, true, false, false);
 }
示例#28
0
 /// <summary>
 /// 创建菜单项
 /// </summary>
 /// <param name="text">文字</param>
 public FCMenuItem(String text)
 {
     Font = new FCFont("宋体", 12, false, false, false);
     Size = new FCSize(200, 25);
     Text = text;
 }
示例#29
0
        /// <summary>
        /// 重绘前景方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪矩形</param>
        public override void onPaintForeground(FCPaint paint, FCRect clipRect)
        {
            int width = Width, height = Height;

            if (width > 0 && height > 0)
            {
                int    right     = width;
                int    midY      = height / 2;
                String text      = Text;
                int    tRight    = 0;
                long   textColor = getPaintingTextColor();
                if (text != null && text.Length > 0)
                {
                    FCFont font  = Font;
                    FCSize tSize = paint.textSize(text, font);
                    FCRect tRect = new FCRect();
                    tRect.left   = 10;
                    tRect.top    = midY - tSize.cy / 2 + 2;
                    tRect.right  = tRect.left + tSize.cx;
                    tRect.bottom = tRect.top + tSize.cy;
                    paint.drawText(text, textColor, font, tRect);
                    tRight = tRect.right + 4;
                }
                //绘制选中
                if (m_checked)
                {
                    FCRect eRect = new FCRect(tRight, height / 2 - 4, tRight + 8, height / 2 + 4);
                    paint.fillEllipse(textColor, eRect);
                }
                //画子菜单的提示箭头
                if (m_items.size() > 0)
                {
                    FCPoint point1 = new FCPoint(), point2 = new FCPoint(), point3 = new FCPoint();
                    FCMenu  menu = m_parentMenu;
                    if (m_parentItem != null)
                    {
                        menu = m_parentItem.DropDownMenu;
                    }
                    FCLayoutStyle layoutStyle = menu.LayoutStyle;
                    //横向
                    if (layoutStyle == FCLayoutStyle.LeftToRight || layoutStyle == FCLayoutStyle.RightToLeft)
                    {
                        point1.x = right - 25;
                        point1.y = midY - 2;
                        point2.x = right - 14;
                        point2.y = midY - 2;
                        point3.x = right - 20;
                        point3.y = midY + 4;
                    }
                    //纵向
                    else
                    {
                        point1.x = right - 15;
                        point1.y = midY;
                        point2.x = right - 25;
                        point2.y = midY - 5;
                        point3.x = right - 25;
                        point3.y = midY + 5;
                    }
                    FCPoint[] points = new FCPoint[] { point1, point2, point3 };
                    paint.fillPolygon(textColor, points);
                }
            }
        }
示例#30
0
 /// <summary>
 /// 创建菜单项
 /// </summary>
 public FCMenuItem()
 {
     Font = new FCFont("宋体", 12, false, false, false);
     Size = new FCSize(200, 25);
 }