Example #1
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);
            }
        }
Example #2
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);
     }
 }
Example #3
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);
        }
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 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);
                    }
                }
            }
        }
Example #6
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);
            }
        }
Example #7
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);
        }
Example #8
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);
            }
        }
Example #9
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);
     }
 }
Example #10
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);
        }
Example #11
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);
            }
        }
Example #12
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 #13
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;
                }
            }
        }
Example #14
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, height = Height;
                if (width > 0 && height > 0)
                {
                    FCFont    font      = Font;
                    FCSize    tSize     = paint.textSize(text, font);
                    long      linkColor = getPaintingLinkColor();
                    FCPoint   tPoint    = new FCPoint((width - tSize.cx) / 2, (height - tSize.cy) / 2);
                    FCPadding padding   = Padding;
                    switch (m_textAlign)
                    {
                    case FCContentAlignment.BottomCenter:
                        tPoint.y = height - tSize.cy;
                        break;

                    case FCContentAlignment.BottomLeft:
                        tPoint.x = padding.left;
                        tPoint.y = height - tSize.cy - padding.bottom;
                        break;

                    case FCContentAlignment.BottomRight:
                        tPoint.x = width - tSize.cx - padding.right;
                        tPoint.y = height - tSize.cy - padding.bottom;
                        break;

                    case FCContentAlignment.MiddleLeft:
                        tPoint.x = padding.left;
                        break;

                    case FCContentAlignment.MiddleRight:
                        tPoint.x = width - tSize.cx - padding.right;
                        break;

                    case FCContentAlignment.TopCenter:
                        tPoint.y = padding.top;
                        break;

                    case FCContentAlignment.TopLeft:
                        tPoint.x = padding.left;
                        tPoint.y = padding.top;
                        break;

                    case FCContentAlignment.TopRight:
                        tPoint.x = width - tSize.cx - padding.right;
                        tPoint.y = padding.top;
                        break;
                    }
                    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, linkColor, font, tRect);
                    }
                    else
                    {
                        paint.drawText(text, linkColor, font, tRect);
                    }
                    //画下划线
                    FCNative native = Native;
                    if (m_linkBehavior == FCLinkBehavior.AlwaysUnderLine || (m_linkBehavior == FCLinkBehavior.HoverUnderLine && (this == native.PushedControl || this == native.HoveredControl)))
                    {
                        paint.drawLine(linkColor, 1, 0, tPoint.x, tPoint.y + tSize.cy, tPoint.x + tSize.cx, tPoint.y + tSize.cy);
                    }
                }
            }
        }
Example #15
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);
        }
Example #16
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);
                    }
                }
            }
        }
Example #17
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);
                }
            }
        }
Example #18
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, height = Height;
                if (width > 0 && height > 0)
                {
                    FCFont    font    = Font;
                    FCSize    tSize   = paint.textSize(text, font);
                    FCPoint   tPoint  = new FCPoint((width - tSize.cx) / 2, (height - tSize.cy) / 2);
                    FCPadding padding = Padding;
                    switch (m_textAlign)
                    {
                    case FCContentAlignment.BottomCenter:
                        tPoint.y = height - tSize.cy;
                        break;

                    case FCContentAlignment.BottomLeft:
                        tPoint.x = padding.left;
                        tPoint.y = height - tSize.cy - padding.bottom;
                        break;

                    case FCContentAlignment.BottomRight:
                        tPoint.x = width - tSize.cx - padding.right;
                        tPoint.y = height - tSize.cy - padding.bottom;
                        break;

                    case FCContentAlignment.MiddleLeft:
                        tPoint.x = padding.left;
                        break;

                    case FCContentAlignment.MiddleRight:
                        tPoint.x = width - tSize.cx - padding.right;
                        break;

                    case FCContentAlignment.TopCenter:
                        tPoint.y = padding.top;
                        break;

                    case FCContentAlignment.TopLeft:
                        tPoint.x = padding.left;
                        tPoint.y = padding.top;
                        break;

                    case FCContentAlignment.TopRight:
                        tPoint.x = width - tSize.cx - padding.right;
                        tPoint.y = padding.top;
                        break;
                    }
                    FCRect tRect     = new FCRect(tPoint.x, tPoint.y, tPoint.x + tSize.cx, tPoint.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);
                    }
                }
            }
        }