Beispiel #1
0
 /// <summary>
 /// 绘制背景方法
 /// </summary>
 /// <param name="paint">绘图对象</param>
 /// <param name="clipRect">裁剪区域</param>
 public override void onPaintBackground(FCPaint paint, FCRect clipRect)
 {
     base.onPaintBackground(paint, clipRect);
     if (paint.supportTransparent())
     {
         ArrayList <FCView> controls = m_controls;
         int controlsSize            = controls.size();
         for (int i = 0; i < controlsSize; i++)
         {
             FCWindow window = controls.get(i) as FCWindow;
             if (window != null)
             {
                 long shadowColor = window.ShadowColor;
                 int  shadowSize  = window.ShadowSize;
                 if (shadowColor != FCColor.None && shadowSize > 0 && window.IsDialog && window.Frame == this)
                 {
                     FCRect bounds     = window.Bounds;
                     FCRect leftShadow = new FCRect(bounds.left - shadowSize, bounds.top - shadowSize, bounds.left, bounds.bottom + shadowSize);
                     paint.fillRect(shadowColor, leftShadow);
                     FCRect rightShadow = new FCRect(bounds.right, bounds.top - shadowSize, bounds.right + shadowSize, bounds.bottom + shadowSize);
                     paint.fillRect(shadowColor, rightShadow);
                     FCRect topShadow = new FCRect(bounds.left, bounds.top - shadowSize, bounds.right, bounds.top);
                     paint.fillRect(shadowColor, topShadow);
                     FCRect bottomShadow = new FCRect(bounds.left, bounds.bottom, bounds.right, bounds.bottom + shadowSize);
                     paint.fillRect(shadowColor, bottomShadow);
                     break;
                 }
             }
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// Öػ汳¾°
        /// </summary>
        /// <param name="paint">»æͼ¶ÔÏó</param>
        /// <param name="clipRect">²Ã¼ôÇøÓò</param>
        public override void onPaintBackground(FCPaint paint, FCRect clipRect)
        {
            int      width     = Width;
            int      height    = Height;
            String   text      = Text;
            FCFont   font      = Font;
            FCSize   tSize     = paint.textSize(text, font);
            int      drawWidth = tSize.cx + 20;
            FCRect   drawRect  = new FCRect(0, 0, width, height);
            FCNative native    = Native;

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

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

            tRect.left   = imageRect.right + 4;
            tRect.top    = (height - tSize.cy) / 2;
            tRect.right  = tRect.left + tSize.cx;
            tRect.bottom = tRect.top + tSize.cy;
            paint.drawText(text, getPaintingTextColor(), font, tRect);
            //»æÖƱßÏß
            if (this == native.HoveredControl)
            {
                paint.drawRoundRect(getPaintingBorderColor(), 1, 0, drawRect, 2);
            }
            if (Enabled)
            {
                if (this == native.PushedControl)
                {
                    paint.fillRect(FCDraw.FCCOLORS_BACKCOLOR4, drawRect);
                }
                else if (this == native.HoveredControl)
                {
                    paint.fillRect(FCDraw.FCCOLORS_BACKCOLOR3, drawRect);
                }
            }
            else
            {
                paint.fillRect(FCDraw.FCCOLORS_BACKCOLOR7, drawRect);
            }
        }
Beispiel #3
0
 /// <summary>
 /// 绘制复选框
 /// </summary>
 /// <param name="paint">绘图对象</param>
 /// <param name="rect">区域</param>
 public virtual void onPaintCheckBox(FCPaint paint, FCRect rect)
 {
     if (m_checked)
     {
         if (m_tree.CheckedImage != null && m_tree.CheckedImage.Length > 0)
         {
             paint.drawImage(m_tree.CheckedImage, rect);
         }
         else
         {
             paint.fillRect(FCColor.argb(0, 0, 0), rect);
         }
     }
     else
     {
         if (m_tree.UnCheckedImage != null && m_tree.UnCheckedImage.Length > 0)
         {
             paint.drawImage(m_tree.UnCheckedImage, rect);
         }
         else
         {
             paint.drawRect(FCColor.argb(0, 0, 0), 1, 0, rect);
         }
     }
 }
Beispiel #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);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 绘制背景
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintBackground(FCPaint paint, FCRect clipRect)
        {
            int    width = Width, height = Height;
            float  xRate    = (float)width / 200;
            float  yRate    = (float)height / 200;
            FCRect drawRect = new FCRect(0, 0, width - 1, height - 1);

            if (m_isEllipse)
            {
                paint.fillEllipse(getPaintingBackColor(), drawRect);
            }
            else
            {
                paint.fillRect(getPaintingBackColor(), drawRect);
            }
            long  textColor = getPaintingTextColor();
            float lineWidth = 10 * xRate;

            if (m_style == WindowButtonStyle.Close)
            {
                paint.setLineCap(2, 2);
                paint.drawLine(textColor, lineWidth, 0, (int)(135 * xRate), (int)(70 * yRate), (int)(70 * xRate), (int)(135 * yRate));
                paint.drawLine(textColor, lineWidth, 0, (int)(70 * xRate), (int)(70 * yRate), (int)(135 * xRate), (int)(135 * yRate));
            }
            else if (m_style == WindowButtonStyle.Max)
            {
                paint.setLineCap(2, 2);
                paint.drawLine(textColor, lineWidth, 0, (int)(80 * xRate), (int)(80 * yRate), (int)(60 * xRate), (int)(60 * yRate));
                paint.drawLine(textColor, lineWidth, 0, (int)(125 * xRate), (int)(145 * yRate), (int)(145 * xRate), (int)(145 * yRate));
                paint.drawLine(textColor, lineWidth, 0, (int)(145 * xRate), (int)(125 * yRate), (int)(145 * xRate), (int)(145 * yRate));
                paint.drawLine(textColor, lineWidth, 0, (int)(125 * xRate), (int)(125 * yRate), (int)(145 * xRate), (int)(145 * yRate));
                paint.drawLine(textColor, lineWidth, 0, (int)(60 * xRate), (int)(80 * yRate), (int)(60 * xRate), (int)(60 * yRate));
                paint.drawLine(textColor, lineWidth, 0, (int)(80 * xRate), (int)(60 * yRate), (int)(60 * xRate), (int)(60 * yRate));
                paint.drawLine(textColor, lineWidth, 0, (int)(125 * xRate), (int)(80 * yRate), (int)(145 * xRate), (int)(60 * yRate));
                paint.drawLine(textColor, lineWidth, 0, (int)(145 * xRate), (int)(80 * yRate), (int)(145 * xRate), (int)(60 * yRate));
                paint.drawLine(textColor, lineWidth, 0, (int)(125 * xRate), (int)(60 * yRate), (int)(145 * xRate), (int)(60 * yRate));
                paint.drawLine(textColor, lineWidth, 0, (int)(80 * xRate), (int)(125 * yRate), (int)(60 * xRate), (int)(145 * yRate));
                paint.drawLine(textColor, lineWidth, 0, (int)(60 * xRate), (int)(125 * yRate), (int)(60 * xRate), (int)(145 * yRate));
                paint.drawLine(textColor, lineWidth, 0, (int)(80 * xRate), (int)(145 * yRate), (int)(60 * xRate), (int)(145 * yRate));
            }
            else if (m_style == WindowButtonStyle.Min)
            {
                paint.setLineCap(2, 2);
                paint.drawLine(textColor, lineWidth, (int)(0 * xRate), (int)(60 * yRate), (int)(105 * xRate), (int)(135 * xRate), (int)(105 * yRate));
            }
            else if (m_style == WindowButtonStyle.Restore)
            {
                paint.setLineCap(2, 2);
                paint.drawLine(textColor, lineWidth, (int)(0 * xRate), (int)(90 * yRate), (int)(90 * xRate), (int)(70 * xRate), (int)(70 * yRate));
                paint.drawLine(textColor, lineWidth, (int)(0 * xRate), (int)(90 * yRate), (int)(90 * xRate), (int)(70 * xRate), (int)(90 * yRate));
                paint.drawLine(textColor, lineWidth, (int)(0 * xRate), (int)(90 * yRate), (int)(90 * xRate), (int)(90 * xRate), (int)(70 * yRate));
                paint.drawLine(textColor, lineWidth, (int)(0 * xRate), (int)(115 * yRate), (int)(115 * xRate), (int)(135 * xRate), (int)(135 * yRate));
                paint.drawLine(textColor, lineWidth, (int)(0 * xRate), (int)(115 * yRate), (int)(115 * xRate), (int)(135 * xRate), (int)(115 * yRate));
                paint.drawLine(textColor, lineWidth, (int)(0 * xRate), (int)(115 * yRate), (int)(115 * xRate), (int)(115 * xRate), (int)(135 * yRate));
            }
            paint.setLineCap(0, 0);
        }
Beispiel #6
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);
            }
        }
Beispiel #7
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;
            FCRect rect      = new FCRect(0, 0, width, height);
            long   backColor = FCDraw.FCCOLORS_WINDOWBACKCOLOR;
            long   foreColor = FCDraw.FCCOLORS_WINDOWFORECOLOR;

            if (paint.supportTransparent())
            {
                backColor = FCDraw.FCCOLORS_WINDOWBACKCOLOR2;
            }
            int    captionHeight = CaptionHeight;
            FCRect hRect         = new FCRect(0, 0, width, captionHeight);

            paint.fillRect(backColor, hRect);
            FCRect lRect = new FCRect(0, captionHeight, 5, height);

            paint.fillRect(backColor, lRect);
            FCRect rRect = new FCRect(width - 5, captionHeight, width, height);

            paint.fillRect(backColor, rRect);
            FCRect bRect = new FCRect(0, height - 5, width, height);

            paint.fillRect(backColor, bRect);
            FCRect contentRect = rect;

            contentRect.top    += captionHeight;
            contentRect.bottom -= 5;
            contentRect.left   += 5;
            contentRect.right  -= 5;
            if (contentRect.right - contentRect.left > 0 && contentRect.bottom - contentRect.top > 0)
            {
                paint.fillRect(FCDraw.FCCOLORS_WINDOWCONTENTBACKCOLOR, contentRect);
            }
            FCDraw.drawText(paint, Text, foreColor, Font, 5, 5);
        }
Beispiel #8
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);
            }
        }
Beispiel #9
0
        /// <summary>
        /// 重绘选中按钮方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public virtual void onPaintCheckButton(FCPaint paint, FCRect clipRect)
        {
            //绘制背景图
            String bkImage = getPaintingBackImage();

            if (bkImage != null && bkImage.Length > 0)
            {
                paint.drawImage(bkImage, clipRect);
            }
            else
            {
                if (m_checked)
                {
                    FCRect innerRect = new FCRect(clipRect.left + 2, clipRect.top + 2, clipRect.right - 3, clipRect.bottom - 3);
                    if (clipRect.right - clipRect.left < 4 || clipRect.bottom - clipRect.top < 4)
                    {
                        innerRect = clipRect;
                    }
                    paint.fillRect(getPaintingButtonBackColor(), innerRect);
                }
                paint.drawRect(getPaintingButtonBorderColor(), 1, 0, clipRect);
            }
        }
Beispiel #10
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);
        }
Beispiel #11
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);
                    }
                }
            }
        }
Beispiel #12
0
        /// <summary>
        /// 重绘背景
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintBackground(FCPaint paint, FCRect clipRect)
        {
            int    width = Width, height = Height;
            int    mw = width / 2, mh = height / 2;
            FCRect drawRect = new FCRect(0, 0, width, height);

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

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

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

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

            paint.fillRect(backColor, m_bounds);
        }
Beispiel #14
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;
            FCRect rect      = new FCRect(0, 0, width, height);
            long   backColor = FCDraw.FCCOLORS_WINDOWBACKCOLOR;
            long   foreColor = FCColor.argb(255, 255, 255);

            if (paint.supportTransparent())
            {
                backColor = FCDraw.FCCOLORS_WINDOWBACKCOLOR2;
            }
            long borderColor = FCColor.argb(50, 105, 217);

            if (m_tick >= 200)
            {
                borderColor = FCColor.argb(255 - (m_tick - 200) * 2, 50, 105, 217);
                foreColor   = FCColor.argb(255 - (m_tick - 200) * 2, 255, 255, 255);
            }
            int dw1    = 30;
            int dw2    = 50;
            int dSize  = 10;
            int dSize2 = 20;

            if (m_tick >= 200)
            {
                dw1    += (m_tick - 200) / 6;
                dw2    += (m_tick - 200) / 6;
                dSize  += (m_tick - 200) / 6;
                dSize2 += (m_tick - 200) / 6;
            }
            FCPoint[] points1 = new FCPoint[6];
            points1[0] = new FCPoint(dSize, dw1 + dSize);
            points1[1] = new FCPoint(dSize + dw1, dSize);
            points1[2] = new FCPoint(width - dSize, dSize);
            points1[3] = new FCPoint(width - dSize, height - dw2 - dSize2);
            points1[4] = new FCPoint(width - dSize - dw2, height - dSize2);
            points1[5] = new FCPoint(dSize, height - dSize2);
            paint.fillGradientPolygon(FCColor.argb(255, 9, 30, 42), FCColor.argb(200, 9, 30, 42), points1, m_tick);
            //paint.fillPolygon(backColor, points1);
            paint.drawPolygon(borderColor, 3, 0, points1);
            paint.drawLine(borderColor, 2, 0, width - dSize - 30, 1, width - 1, 1);
            paint.drawLine(borderColor, 2, 0, width - 1, 1, width - 1, dSize * 2);
            paint.drawLine(borderColor, 2, 0, width - dSize - 20, dSize + 5, width - dSize - 5, dSize + 5);
            paint.drawLine(borderColor, 2, 0, width - dSize - 5, dSize + 5, width - dSize - 5, dSize + 20);
            FCPoint[] points2 = new FCPoint[4];
            points2[0] = new FCPoint(dSize + 10, dSize + dw1 + 30);
            points2[1] = new FCPoint(dSize + 10, dSize + dw1 + 2);
            points2[2] = new FCPoint(dSize + dw1 + 2, dSize + 10);
            points2[3] = new FCPoint(dSize + dw1 + 30, dSize + 10);
            paint.drawPolyline(borderColor, 2, 0, points2);
            paint.drawLine(borderColor, 2, 0, dSize + dw1 + 31, dSize + 10, dSize + dw1 + 50, dSize + 10);
            paint.drawLine(borderColor, 2, 0, dSize + dw1 + 10, dSize + 18, dSize + dw1 + 40, dSize + 18);
            paint.drawLine(borderColor, 2, 0, dSize + 10, height - dSize * 2 - 8, dSize + 60, height - dSize * 2 - 8);
            FCPoint[] points3 = new FCPoint[4];
            points3[0] = new FCPoint(dSize + 14, height - dSize2 - 8);
            points3[1] = new FCPoint(dSize + 18, height - dSize2 - 12);
            points3[2] = new FCPoint(dSize + 30, height - dSize2 - 12);
            points3[3] = new FCPoint(dSize + 34, height - dSize2 - 8);
            paint.fillPolygon(borderColor, points3);
            FCPoint[] points4 = new FCPoint[6];
            points4[0] = new FCPoint(dSize, height - dSize2 - 20);
            points4[1] = new FCPoint(dSize - 8, height - dSize2 - 10);
            points4[2] = new FCPoint(dSize - 8, height - 4 - dSize);
            points4[3] = new FCPoint(dSize + 16, height - 4 - dSize);
            points4[4] = new FCPoint(dSize + 20, height - dSize2);
            points4[5] = new FCPoint(dSize, height - dSize2);
            paint.fillPolygon(borderColor, points4);
            FCPoint[] points5 = new FCPoint[4];
            points5[0] = new FCPoint(width - dSize, height - dSize2 - dw2 - 20);
            points5[1] = new FCPoint(width - dSize - 4, height - dSize2 - dw2 - 16);
            points5[2] = new FCPoint(width - dSize - 4, height - dSize2 - dw2);
            points5[3] = new FCPoint(width - dSize, height - dSize2 - dw2);
            paint.fillPolygon(borderColor, points5);
            FCPoint[] points6 = new FCPoint[4];
            points6[0] = new FCPoint(width - dSize, height - dSize2 - dw2);
            points6[1] = new FCPoint(width - dSize - 4, height - dSize2 - dw2 - 2);
            points6[2] = new FCPoint(width - dSize - 22, height - dSize2 - dw2 + 16);
            points6[3] = new FCPoint(width - dSize - 20, height - dSize2 - dw2 + 22);
            paint.fillPolygon(borderColor, points6);
            FCPoint[] points7 = new FCPoint[3];
            points7[0] = new FCPoint(width - 1, height - dSize2 - dw2 - 30);
            points7[1] = new FCPoint(width - 1, height - dSize2 - dw2 + 3);
            points7[2] = new FCPoint(width - 1 - dw2 + 20, height - dSize2 - 16);
            paint.drawPolyline(borderColor, 2, 0, points7);
            FCPoint[] points8 = new FCPoint[3];
            points8[0] = new FCPoint(width - 1 - dw2 + 19, height - dSize2 - 15);
            points8[1] = new FCPoint(width - dSize - dw2 + 1, height - dSize + 3);
            points8[2] = new FCPoint(width - dSize - dw2 - 25, height - dSize + 3);
            paint.drawPolyline(borderColor, 2, 0, points8);
            FCPoint[] points9 = new FCPoint[6];
            points9[0] = new FCPoint(width - dSize - dw2 + 1, height - dSize + 3);
            points9[1] = new FCPoint(width - dSize - dw2 - 14, height - dSize + 3);
            points9[2] = new FCPoint(width - dSize - dw2 - 10, height - dSize + 8);
            points9[3] = new FCPoint(width - dSize - dw2 + 3, height - dSize + 8);
            points9[4] = new FCPoint(width - dSize - dw2 + 16, height - dSize - 6);
            points9[5] = new FCPoint(width - dSize - dw2 + 16, height - dSize - 14);
            paint.fillPolygon(borderColor, points9);

            int rwidth = width * 3 / 5;

            if (rwidth > width - dSize * 2 - dw2)
            {
                rwidth = width - dSize2 * 2 - dw2;
            }
            FCPoint[] points10 = new FCPoint[4];
            points10[0] = new FCPoint(rwidth - 8, height - dSize2 - 6);
            points10[1] = new FCPoint(rwidth - 12, height - dSize2);
            points10[2] = new FCPoint(rwidth + 12, height - dSize2);
            points10[3] = new FCPoint(rwidth + 8, height - dSize2 - 6);
            paint.fillPolygon(borderColor, points10);
            rwidth = width * 7 / 10;
            if (rwidth > width - 30)
            {
                rwidth = width - 30;
            }
            FCPoint[] points11 = new FCPoint[4];
            points11[0] = new FCPoint(rwidth - 16, dSize - 6);
            points11[1] = new FCPoint(rwidth - 20, dSize);
            points11[2] = new FCPoint(rwidth + 20, dSize);
            points11[3] = new FCPoint(rwidth + 16, dSize - 6);
            paint.fillPolygon(borderColor, points11);
            FCDraw.drawText(paint, Text, foreColor, Font, 100, 15);

            if (m_tick > 200)
            {
                int count = (m_tick - 200) / 8 + 1;
                int left  = 80;
                for (int i = 0; i < count; i++)
                {
                    FCRect pRect = new FCRect(left, height - 10, left + 8, height - 6);
                    paint.fillRect(borderColor, pRect);
                    left += 10;
                }
                left = 15;
                int top = 80;
                count = (m_tick - 200) / 10 + 1;
                for (int i = 0; i < count; i++)
                {
                    FCRect pRect = new FCRect(left, top, left + 8, top + 6);
                    paint.fillRect(borderColor, pRect);
                    top += 10;
                }
            }
        }
Beispiel #15
0
        /// <summary>
        /// 重绘背景方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintBackground(FCPaint paint, FCRect clipRect)
        {
            int      width    = Width;
            int      height   = Height;
            FCNative native   = Native;
            FCRect   drawRect = convertBoundsToPRect(new FCRect(0, 0, width, height));
            //绘制选中的点
            int resizePoint = m_resizePoint != -1 ? m_resizePoint : getResizePoint(TouchPoint);

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

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

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

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

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

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

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