Exemplo n.º 1
0
 /// <summary>
 /// 创建透明按钮
 /// </summary>
 public RuningButton()
 {
     AllowDrag   = true;
     BackColor   = FCColor.argb(50, 50, 50);
     BorderColor = FCColor.argb(100, 100, 100);
     Font        = new FCFont("SimSun", 30, true, false, false);
 }
Exemplo n.º 2
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);
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 绘制前景方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintForeground(FCPaint paint, FCRect clipRect)
        {
            FCRect bounds = Bounds;
            int    width  = bounds.right - bounds.left;
            int    height = bounds.bottom - bounds.top;

            if (width > 0 && height > 0)
            {
                if (m_ssLatestData != null && m_szLatestData != null && m_cyLatestData != null)
                {
                    long   titleColor = FCColor.argb(255, 255, 80);
                    FCFont font       = new FCFont("SimSun", 16, false, false, false);
                    FCFont indexFont  = new FCFont("Arial", 14, true, false, false);
                    long   grayColor  = FCColor.Border;
                    //上证指数
                    long indexColor = FCDraw.getPriceColor(m_ssLatestData.m_close, m_ssLatestData.m_lastClose);
                    int  left       = 1;
                    FCDraw.drawText(paint, "上证", titleColor, font, left, 3);
                    left += 40;
                    paint.drawLine(grayColor, 1, 0, left, 0, left, height);
                    String amount     = (m_ssLatestData.m_amount / 100000000).ToString("0.0") + "亿";
                    FCSize amountSize = paint.textSize(amount, indexFont);
                    FCDraw.drawText(paint, amount, titleColor, indexFont, width / 3 - amountSize.cx, 3);
                    left += (width / 3 - 40 - amountSize.cx) / 4;
                    int length = FCDraw.drawUnderLineNum(paint, m_ssLatestData.m_close, 2, indexFont, indexColor, false, left, 3);
                    left  += length + (width / 3 - 40 - amountSize.cx) / 4;
                    length = FCDraw.drawUnderLineNum(paint, m_ssLatestData.m_close - m_ssLatestData.m_lastClose, 2, indexFont, indexColor, false, left, 3);
                    //深证指数
                    left = width / 3;
                    paint.drawLine(grayColor, 1, 0, left, 0, left, height);
                    indexColor = FCDraw.getPriceColor(m_szLatestData.m_close, m_szLatestData.m_lastClose);
                    FCDraw.drawText(paint, "深证", titleColor, font, left, 3);
                    left += 40;
                    paint.drawLine(grayColor, 1, 0, left, 0, left, height);
                    amount     = (m_szLatestData.m_amount / 100000000).ToString("0.0") + "亿";
                    amountSize = paint.textSize(amount, indexFont);
                    FCDraw.drawText(paint, amount, titleColor, indexFont, width * 2 / 3 - amountSize.cx, 3);
                    left  += (width / 3 - 40 - amountSize.cx) / 4;
                    length = FCDraw.drawUnderLineNum(paint, m_szLatestData.m_close, 2, indexFont, indexColor, false, left, 3);
                    left  += length + (width / 3 - 40 - amountSize.cx) / 4;
                    length = FCDraw.drawUnderLineNum(paint, m_szLatestData.m_close - m_szLatestData.m_lastClose, 2, indexFont, indexColor, false, left, 3);
                    //创业指数
                    left = width * 2 / 3;
                    paint.drawLine(grayColor, 1, 0, left, 0, left, height);
                    indexColor = FCDraw.getPriceColor(m_cyLatestData.m_close, m_cyLatestData.m_lastClose);
                    FCDraw.drawText(paint, "创业", titleColor, font, left, 3);
                    left += 40;
                    paint.drawLine(grayColor, 1, 0, left, 0, left, height);
                    amount     = (m_cyLatestData.m_amount / 100000000).ToString("0.0") + "亿";
                    amountSize = paint.textSize(amount, indexFont);
                    FCDraw.drawText(paint, amount, titleColor, indexFont, width - amountSize.cx, 3);
                    left  += (width / 3 - 40 - amountSize.cx) / 4;
                    length = FCDraw.drawUnderLineNum(paint, m_cyLatestData.m_close, 2, indexFont, indexColor, false, left, 3);
                    left  += (width / 3 - 40 - amountSize.cx) / 4 + length;
                    length = FCDraw.drawUnderLineNum(paint, m_cyLatestData.m_close - m_cyLatestData.m_lastClose, 2, indexFont, indexColor, false, left, 3);
                    paint.drawRect(grayColor, 1, 0, new FCRect(0, 0, width - 1, height - 1));
                }
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 创建标签
 /// </summary>
 public FCToolTip()
 {
     AutoSize    = true;
     BackColor   = FCColor.argb(255, 255, 40);
     BorderColor = FCColor.Border;
     TopMost     = true;
     Visible     = false;
 }
Exemplo n.º 5
0
 /// <summary>
 /// 创建横轴
 /// </summary>
 public HScale()
 {
     //设置日期的自定义颜色
     m_dateColors.put(DateType.Year, FCColor.argb(255, 255, 255));
     m_dateColors.put(DateType.Month, FCColor.argb(150, 0, 0));
     m_dateColors.put(DateType.Day, FCColor.argb(100, 100, 100));
     m_dateColors.put(DateType.Hour, FCColor.argb(82, 82, 255));
     m_dateColors.put(DateType.Minute, FCColor.argb(255, 255, 0));
     m_dateColors.put(DateType.Second, FCColor.argb(255, 0, 255));
     m_dateColors.put(DateType.Millisecond, FCColor.argb(255, 0, 255));
 }
Exemplo n.º 6
0
        /// <summary>
        /// 获取正在绘制的背景色
        /// </summary>
        /// <returns></returns>
        protected override long getPaintingBackColor()
        {
            FCNative native = Native;

            if (m_style == WindowButtonStyle.Close)
            {
                if (native.PushedControl == this)
                {
                    return(FCColor.argb(255, 0, 0));
                }
                else if (native.HoveredControl == this)
                {
                    return(FCColor.argb(255, 150, 150));
                }
                else
                {
                    return(FCColor.argb(255, 80, 80));
                }
            }
            else if (m_style == WindowButtonStyle.Min)
            {
                if (native.PushedControl == this)
                {
                    return(FCColor.argb(0, 255, 0));
                }
                else if (native.HoveredControl == this)
                {
                    return(FCColor.argb(150, 255, 150));
                }
                else
                {
                    return(FCColor.argb(80, 255, 80));
                }
            }
            else
            {
                if (native.PushedControl == this)
                {
                    return(FCColor.argb(255, 255, 0));
                }
                else if (native.HoveredControl == this)
                {
                    return(FCColor.argb(255, 255, 150));
                }
                else
                {
                    return(FCColor.argb(255, 255, 80));
                }
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// 字符转换为颜色
 /// </summary>
 /// <param name="str">字符</param>
 /// <returns>颜色</returns>
 public static long convertStrToColor(String str)
 {
     str = str.ToLower();
     if (str == "empty")
     {
         return(FCColor.None);
     }
     else if (str == "control")
     {
         return(FCColor.Back);
     }
     else if (str == "controlborder")
     {
         return(FCColor.Border);
     }
     else if (str == "controltext")
     {
         return(FCColor.Text);
     }
     else if (str == "disabledcontrol")
     {
         return(FCColor.DisabledBack);
     }
     else if (str == "disabledcontroltext")
     {
         return(FCColor.DisabledText);
     }
     else
     {
         String[] strs = str.Split(',');
         int      a = 255, r = 255, g = 255, b = 255;
         if (strs.Length == 3)
         {
             int.TryParse(strs[0], out r);
             int.TryParse(strs[1], out g);
             int.TryParse(strs[2], out b);
             return(FCColor.argb(r, g, b));
         }
         else if (strs.Length == 4)
         {
             int.TryParse(strs[0], out a);
             int.TryParse(strs[1], out r);
             int.TryParse(strs[2], out g);
             int.TryParse(strs[3], out b);
             return(FCColor.argb(a, r, g, b));
         }
     }
     return(FCColor.None);
 }
Exemplo n.º 8
0
 /// <summary>
 /// »ñÈ¡ÕýÔÚ»æÖƵı³¾°É«
 /// </summary>
 /// <returns></returns>
 protected override long getPaintingBackColor()
 {
     if (Native.PushedControl == this)
     {
         return(FCColor.reverse(null, FCDraw.FCCOLORS_BACKCOLOR8));
     }
     else if (Native.HoveredControl == this)
     {
         return(FCColor.ratioColor(null, FCDraw.FCCOLORS_BACKCOLOR8, 0.95));
     }
     else
     {
         return(FCDraw.FCCOLORS_BACKCOLOR8);
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// 根据价格获取颜色
 /// </summary>
 /// <param name="price">价格</param>
 /// <param name="comparePrice">比较价格</param>
 /// <returns>颜色</returns>
 public static long getPriceColor(double price, double comparePrice)
 {
     if (price != 0)
     {
         if (price > comparePrice)
         {
             return(FCDraw.FCCOLORS_UPCOLOR);
         }
         else if (price < comparePrice)
         {
             return(FCDraw.FCCOLORS_DOWNCOLOR);
         }
     }
     return(FCColor.argb(255, 255, 255));
 }
Exemplo n.º 10
0
 /// <summary>
 /// 绘制控件方法
 /// </summary>
 /// <param name="paint">绘图对象</param>
 /// <param name="rect">区域</param>
 /// <param name="clipRect">裁剪区域</param>
 public override void onPaintControl(FCPaint paint, FCRect rect, FCRect clipRect)
 {
     if (m_control != null)
     {
         m_control.Text        = "C";
         m_control.BorderColor = FCColor.Border;
         if (m_value != null)
         {
             m_control.BackColor = FCStr.convertStrToColor(m_value);
             m_control.TextColor = FCColor.reverse(paint, m_control.BackColor);
         }
         int    buttonWidth = 30;
         FCRect bounds      = new FCRect(rect.right - 1 - buttonWidth, rect.top + 1, rect.right - 2, rect.bottom - 1);
         m_control.Bounds = bounds;
         m_control.Region = new FCRect(0, 0, bounds.right - bounds.left, bounds.bottom - bounds.top);
     }
 }
Exemplo n.º 11
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);
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 13
0
 /// <summary>
 /// 添加控件方法
 /// </summary>
 public override void onLoad()
 {
     base.onLoad();
     if (m_designerTabPage == null)
     {
         m_designerTabPage = new FCTabPage();
         addControl(m_designerTabPage);
         m_designerTabPage.BorderColor         = FCColor.None;
         m_designerTabPage.HeaderButton.Size   = new FCSize(60, 20);
         m_designerTabPage.HeaderButton.Margin = new FCPadding(1, -1, 0, 2);
         m_designerTabPage.ShowHScrollBar      = true;
         m_designerTabPage.ShowVScrollBar      = true;
         m_designerTabPage.Text      = "设计";
         m_designerTabPage.BackColor = FCColor.argb(75, 51, 153, 255);
         m_resizeDiv        = new ResizeDiv();
         m_resizeDiv.Native = Native;
         m_designerTabPage.addControl(m_resizeDiv);
     }
     if (m_sourceCodeTabPage == null)
     {
         m_sourceCodeTabPage             = new FCTabPage();
         m_sourceCodeTabPage.BorderColor = FCColor.None;
         //创建编辑器
         m_scintilla         = new ScintillaX();
         m_scintilla.Visible = false;
         FCNative  native    = Native;
         WinHostEx host      = native.Host as WinHostEx;
         Control   container = Control.FromHandle(host.HWnd);
         container.Controls.Add(m_scintilla);
         m_scintilla.ParentDiv    = m_sourceCodeTabPage;
         m_scintilla.TextChanged += new EventHandler <EventArgs>(scintilla_TextChanged);
         addControl(m_sourceCodeTabPage);
         m_sourceCodeTabPage.Text = "源";
         m_sourceCodeTabPage.HeaderButton.Size   = new FCSize(60, 20);
         m_sourceCodeTabPage.HeaderButton.Margin = new FCPadding(1, -1, 0, 2);
     }
     if (Parent != null)
     {
         Parent.addEvent(m_parentVisibleChangedEvent, FCEventID.VISIBLECHANGED);
     }
     SelectedIndex = 0;
 }
Exemplo n.º 14
0
        /// <summary>
        /// 颜色转换为字符
        /// </summary>
        /// <param name="color">颜色</param>
        /// <returns>字符</returns>
        public static String convertColorToStr(long color)
        {
            if (color == FCColor.None)
            {
                return("Empty");
            }
            else if (color == FCColor.Back)
            {
                return("Control");
            }
            else if (color == FCColor.Border)
            {
                return("ControlBorder");
            }
            else if (color == FCColor.Text)
            {
                return("ControlText");
            }
            else if (color == FCColor.DisabledBack)
            {
                return("DisabledControl");
            }
            else if (color == FCColor.DisabledText)
            {
                return("DisabledControlText");
            }
            int a = 0, r = 0, g = 0, b = 0;

            FCColor.toArgb(null, color, ref a, ref r, ref g, ref b);
            String str = String.Empty;

            if (a == 255)
            {
                str = String.Format("{0},{1},{2}", r, g, b);
            }
            else
            {
                str = String.Format("{0},{1},{2},{3}", a, r, g, b);
            }
            return(str);
        }
Exemplo n.º 15
0
 /// <summary>
 /// 获取黑色风格的颜色
 /// </summary>
 /// <param name="color">颜色</param>
 /// <returns>新的颜色</returns>
 public static long getBlackColor(long color)
 {
     if (color > FCCOLORS_USERCOLOR)
     {
         if (color == FCColor.Back)
         {
             color = FCColor.argb(19, 21, 26);
         }
         else if (color == FCColor.Border)
         {
             color = FCColor.argb(50, 105, 217);
         }
         else if (color == FCColor.Text)
         {
             color = FCColor.argb(255, 255, 255);
         }
         else if (color == FCColor.DisabledBack)
         {
             color = FCColor.argb(25, 255, 255, 255);
         }
         else if (color == FCColor.DisabledText)
         {
             color = 3289650;
         }
         else if (color == FCColor.Hovered)
         {
             color = FCColor.argb(150, 43, 138, 195);
         }
         else if (color == FCColor.Pushed)
         {
             color = FCColor.argb(100, 43, 138, 195);
         }
     }
     if (color == FCCOLORS_BACKCOLOR)
     {
         color = FCColor.argb(180, 43, 138, 195);
     }
     else if (color == FCCOLORS_BACKCOLOR2)
     {
         color = FCColor.argb(130, 43, 138, 195);
     }
     else if (color == FCCOLORS_BACKCOLOR3)
     {
         color = FCColor.argb(25, 100, 100, 100);
     }
     else if (color == FCCOLORS_BACKCOLOR4)
     {
         color = FCColor.argb(255, 255, 255);
     }
     else if (color == FCCOLORS_BACKCOLOR5)
     {
         color = FCColor.argb(25, 255, 255, 255);
     }
     else if (color == FCCOLORS_BACKCOLOR6)
     {
         color = FCColor.argb(25, 0, 0, 0);
     }
     else if (color == FCCOLORS_BACKCOLOR7)
     {
         color = FCColor.argb(200, 255, 0, 0);
     }
     else if (color == FCCOLORS_BACKCOLOR8)
     {
         color = FCColor.argb(200, 0, 0, 0);
     }
     else if (color == FCCOLORS_BACKCOLOR9)
     {
         color = FCColor.argb(9, 30, 42);
     }
     else if (color == FCCOLORS_FORECOLOR)
     {
         color = FCColor.argb(255, 255, 255);
     }
     else if (color == FCCOLORS_FORECOLOR2)
     {
         color = FCColor.argb(0, 255, 255);
     }
     else if (color == FCCOLORS_FORECOLOR3)
     {
         color = FCColor.argb(255, 200, 0);
     }
     else if (color == FCCOLORS_FORECOLOR4)
     {
         color = FCColor.argb(255, 255, 255);
     }
     else if (color == FCCOLORS_LINECOLOR)
     {
         color = FCColor.argb(100, 100, 100);
     }
     else if (color == FCCOLORS_LINECOLOR2)
     {
         color = FCColor.argb(0, 105, 217);
     }
     else if (color == FCCOLORS_LINECOLOR3)
     {
         color = FCColor.argb(5, 255, 255, 255);
     }
     else if (color == FCCOLORS_LINECOLOR4)
     {
         color = FCColor.argb(255, 80, 80);
     }
     else if (color == FCCOLORS_MIDCOLOR)
     {
         color = FCColor.argb(255, 255, 255);
     }
     else if (color == FCCOLORS_UPCOLOR)
     {
         color = FCColor.argb(255, 80, 80);
     }
     else if (color == FCCOLORS_DOWNCOLOR)
     {
         color = FCColor.argb(80, 255, 80);
     }
     else if (color == FCCOLORS_SELECTEDROWCOLOR)
     {
         color = FCColor.argb(200, 43, 138, 195);
     }
     else if (color == FCCOLORS_HOVEREDROWCOLOR)
     {
         color = FCColor.argb(100, 43, 138, 195);
     }
     else if (color == FCDraw.FCCOLORS_WINDOWBACKCOLOR)
     {
         color = FCColor.argb(255, 50, 50, 50);
     }
     else if (color == FCDraw.FCCOLORS_WINDOWBACKCOLOR2)
     {
         color = FCColor.argb(100, 43, 138, 195);
     }
     else if (color == FCDraw.FCCOLORS_WINDOWBACKCOLOR3)
     {
         color = FCColor.argb(230, 43, 138, 195);
     }
     else if (color == FCDraw.FCCOLORS_WINDOWCROSSLINECOLOR)
     {
         color = FCColor.argb(100, 100, 100);
     }
     else if (color == FCDraw.FCCOLORS_WINDOWCROSSLINECOLOR2)
     {
         color = FCColor.argb(10, 255, 255, 255);
     }
     else if (color == FCCOLORS_WINDOWCONTENTBACKCOLOR)
     {
         color = FCColor.argb(235, 9, 30, 42);
     }
     else if (color == FCCOLORS_EXCOLOR1)
     {
         color = FCColor.argb(100, 50, 105, 217);
     }
     else if (color == FCCOLORS_EXCOLOR2)
     {
         color = FCColor.argb(43, 138, 195);
     }
     else if (color == FCCOLORS_EXCOLOR3)
     {
         color = FCColor.argb(50, 50, 105, 217);
     }
     else if (color == FCCOLORS_EXCOLOR4)
     {
         color = FCColor.argb(50, 255, 255, 255);
     }
     else if (color == FCCOLORS_EXCOLOR5)
     {
         color = FCColor.argb(43, 138, 195);
     }
     else if (color == FCCOLORS_EXCOLOR6)
     {
         color = FCColor.argb(100, 50, 105, 217);
     }
     else if (color == FCCOLORS_EXCOLOR7)
     {
         color = FCColor.argb(255, 255, 255);
     }
     else if (color == FCCOLORS_EXCOLOR8)
     {
         color = FCColor.argb(100, 255, 255, 255);
     }
     else if (color == FCCOLORS_EXCOLOR9)
     {
         color = FCColor.argb(50, 105, 217);
     }
     else if (color == FCCOLORS_EXCOLOR10)
     {
         color = FCColor.argb(9, 30, 42);
     }
     return(color);
 }
Exemplo n.º 16
0
        /// <summary>
        /// 获取白色风格的颜色
        /// </summary>
        /// <param name="color">颜色</param>
        /// <returns>新的颜色</returns>
        private static long getWhiteColor(long dwPenColor)
        {
            long color = dwPenColor;

            if (color < FCColor.None)
            {
                if (color > FCCOLORS_USERCOLOR)
                {
                    if (color == FCColor.Back)
                    {
                        color = FCColor.argb(255, 255, 255);
                    }
                    else if (color == FCColor.Border)
                    {
                        color = FCColor.argb(200, 200, 200);
                    }
                    else if (color == FCColor.Text)
                    {
                        color = FCColor.argb(0, 0, 0);
                    }
                    else if (color == FCColor.DisabledBack)
                    {
                        color = FCColor.argb(25, 255, 255, 255);
                    }
                    else if (color == FCColor.DisabledText)
                    {
                        color = 3289650;
                    }
                    else if (color == FCColor.Hovered)
                    {
                        color = FCColor.argb(150, 200, 200, 200);
                    }
                    else if (color == FCColor.Pushed)
                    {
                        color = FCColor.argb(150, 150, 150, 150);
                    }
                }
                else if (color == FCCOLORS_BACKCOLOR)
                {
                    color = FCColor.argb(255, 255, 255);
                }
                else if (color == FCCOLORS_BACKCOLOR2)
                {
                    color = FCColor.argb(230, 230, 230);
                }
                else if (color == FCCOLORS_BACKCOLOR3)
                {
                    color = FCColor.argb(25, 100, 100, 100);
                }
                else if (color == FCCOLORS_BACKCOLOR4)
                {
                    color = FCColor.argb(25, 0, 0, 0);
                }
                else if (color == FCCOLORS_BACKCOLOR5)
                {
                    color = FCColor.argb(75, 51, 153, 255);
                }
                else if (color == FCCOLORS_BACKCOLOR6)
                {
                    color = FCColor.argb(50, 51, 153, 255);
                }
                else if (color == FCCOLORS_BACKCOLOR7)
                {
                    color = FCColor.argb(100, 255, 255, 255);
                }
                else if (color == FCCOLORS_BACKCOLOR8)
                {
                    color = FCColor.argb(50, 105, 217);
                }
                else if (color == FCCOLORS_BACKCOLOR9)
                {
                    color = FCColor.argb(75, 215, 99);
                }
                else if (color == FCCOLORS_TEXTCOLOR)
                {
                    color = FCColor.argb(0, 0, 0);
                }
                else if (color == FCCOLORS_TEXTCOLOR2)
                {
                    color = FCColor.argb(112, 112, 112);
                }
                else if (color == FCCOLORS_TEXTCOLOR3)
                {
                    color = FCColor.argb(100, 255, 255, 255);
                }
                else if (color == FCCOLORS_TEXTCOLOR4)
                {
                    color = FCColor.argb(255, 255, 255);
                }
                else if (color == FCCOLORS_LINECOLOR)
                {
                    color = FCColor.argb(100, 100, 100);
                }
                else if (color == FCCOLORS_LINECOLOR2)
                {
                    color = FCColor.argb(0, 105, 217);
                }
                else if (color == FCDraw.FCCOLORS_UPCOLOR)
                {
                    color = FCColor.argb(255, 82, 82);
                }
                else if (color == FCDraw.FCCOLORS_DOWNCOLOR)
                {
                    color = FCColor.argb(80, 255, 80);
                }
                else if (color == FCDraw.FCCOLORS_LINECOLOR3)
                {
                    color = FCColor.argb(5, 255, 255, 255);
                }
                else if (color == FCCOLORS_SELECTEDROWCOLOR)
                {
                    color = FCColor.argb(0, 105, 217);
                }
                else if (color == FCCOLORS_HOVEREDROWCOLOR)
                {
                    color = FCColor.argb(200, 240, 240, 240);
                }
                else if (color == FCCOLORS_ALTERNATEROWCOLOR)
                {
                    color = FCColor.argb(200, 245, 245, 245);
                }
                else if (color == FCDraw.FCCOLORS_WINDOWTEXTCOLOR)
                {
                    color = FCColor.argb(0, 0, 0);
                }
                else if (color == FCDraw.FCCOLORS_WINDOWBACKCOLOR)
                {
                    color = FCColor.argb(255, 255, 255);
                }
                else if (color == FCDraw.FCCOLORS_WINDOWBACKCOLOR2)
                {
                    color = FCColor.argb(100, 255, 255, 255);
                }
                else if (color == FCDraw.FCCOLORS_WINDOWBACKCOLOR3)
                {
                    color = FCColor.argb(230, 255, 255, 255);
                }
                else if (color == FCDraw.FCCOLORS_WINDOWCROSSLINECOLOR)
                {
                    color = FCColor.argb(100, 100, 100);
                }
                else if (color == FCDraw.FCCOLORS_WINDOWCROSSLINECOLOR2)
                {
                    color = FCColor.argb(10, 255, 255, 255);
                }
                else if (color == FCDraw.FCCOLORS_WINDOWCONTENTBACKCOLOR)
                {
                    color = FCColor.argb(235, 255, 255, 255);
                }
            }
            if (m_style == 2 || m_style == 3)
            {
                int a = 0, r = 0, g = 0, b = 0;
                FCColor.toArgb(null, color, ref a, ref r, ref g, ref b);
                if (m_style == 2)
                {
                    return(FCColor.argb(a, (r + g + b) / 3, (r + g + b) / 3, (r + g + b) / 3));
                }
                else if (m_style == 3)
                {
                    return(FCColor.argb(a, 255 - r, 255 - g, 255 - b));
                }
            }
            return(color);
        }
Exemplo n.º 17
0
        /// <summary>
        /// 单元格点击事件
        /// </summary>
        /// <param name="cell">单元格</param>
        /// <param name="mp">坐标</param>
        /// <param name="button">按钮</param>
        /// <param name="clicks">点击次数</param>
        /// <param name="delta">滚轮值</param>
        public override void onCellClick(FCGridCell cell, FCTouchInfo touchInto)
        {
            base.onCellClick(cell, touchInto);
            List <FCGridRow> rows = m_rows;
            int rowsSize          = rows.Count;

            for (int i = 0; i < rowsSize; i++)
            {
                FCGridRow         row   = rows[i];
                List <FCGridCell> cells = row.getCells();
                int cellsSize           = cells.Count;
                for (int j = 0; j < cellsSize; j++)
                {
                    FCGridControlCell cCell = cells[j] as FCGridControlCell;
                    if (cCell != null)
                    {
                        if (row == cell.Row)
                        {
                            cCell.Control.TextColor = FCDraw.FCCOLORS_TEXTCOLOR4;
                        }
                        else
                        {
                            cCell.Control.TextColor = FCColor.Text;
                        }
                    }
                }
            }
            if (touchInto.m_firstTouch)
            {
                if (touchInto.m_clicks == 1)
                {
                    if (!cell.AllowEdit && cell is GridColorCell)
                    {
                        GridColorCell colorCell   = cell as GridColorCell;
                        ColorDialog   colorDialog = new ColorDialog();
                        colorDialog.AllowFullOpen  = true;
                        colorDialog.AnyColor       = true;
                        colorDialog.SolidColorOnly = false;
                        int a = 0, r = 0, g = 0, b = 0;
                        FCColor.toArgb(Native.Paint, FCStr.convertStrToColor(colorCell.getString()), ref a, ref r, ref g, ref b);
                        colorDialog.Color = Color.FromArgb(a, r, g, b);
                        if (colorDialog.ShowDialog() == DialogResult.OK)
                        {
                            Color newColor = colorDialog.Color;
                            a = newColor.A;
                            r = newColor.R;
                            g = newColor.G;
                            b = newColor.B;
                            colorCell.setString(FCStr.convertColorToStr(FCColor.argb(a, r, g, b)));
                            FCGridCell nameCell = cell.Row.getCell("PROPERTYNAME");
                            if (nameCell != null)
                            {
                                m_designerDiv.saveUndo();
                                String name        = nameCell.Name;
                                String value       = cell.Text;
                                int    targetsSize = m_targets.Count;
                                for (int i = 0; i < targetsSize; i++)
                                {
                                    FCView target = m_targets[i];
                                    m_xml.setProperty(target, name, value);
                                    if (m_collectionWindow != null)
                                    {
                                        m_collectionWindow.onPropertyChanged(name, value);
                                    }
                                    target.update();
                                }
                                //恢复正确的值
                                String rightValue = "", type = "";
                                for (int i = 0; i < targetsSize; i++)
                                {
                                    m_targets[i].getProperty(name.ToLower(), ref rightValue, ref type);
                                }
                                cell.Text = rightValue;
                                Native.update();
                                Native.invalidate();
                            }
                        }
                        colorDialog.Dispose();
                    }
                    //字体单元格
                    else if (!cell.AllowEdit && cell is GridFontCell)
                    {
                        GridFontCell fontCell   = cell as GridFontCell;
                        FontDialog   fontDialog = new FontDialog();
                        fontDialog.Font = getFont(FCStr.convertStrToFont(fontCell.getString()));
                        if (fontDialog.ShowDialog() == DialogResult.OK)
                        {
                            Font newFont = fontDialog.Font;
                            fontCell.setString(FCStr.convertFontToStr(new FCFont(newFont.Name, newFont.Size, newFont.Bold, newFont.Underline, newFont.Italic, newFont.Strikeout)));
                            FCGridCell nameCell = cell.Row.getCell("PROPERTYNAME");
                            if (nameCell != null)
                            {
                                m_designerDiv.saveUndo();
                                String name        = nameCell.Name;
                                String value       = cell.Text;
                                int    targetsSize = m_targets.Count;
                                for (int i = 0; i < targetsSize; i++)
                                {
                                    FCView target = m_targets[i];
                                    m_xml.setProperty(target, name, value);
                                    if (m_collectionWindow != null)
                                    {
                                        m_collectionWindow.onPropertyChanged(name, value);
                                    }
                                    target.update();
                                }
                                //恢复正确的值
                                String rightValue = "", type = "";
                                for (int i = 0; i < targetsSize; i++)
                                {
                                    m_targets[i].getProperty(name.ToLower(), ref rightValue, ref type);
                                }
                                cell.Text = rightValue;
                                Native.update();
                                Native.invalidate();
                            }
                        }
                    }
                    //单击编辑框
                    else if (cell is FCGridButtonCell)
                    {
                        FCButton cButton = (cell as FCGridButtonCell).Button;
                        if (cButton.Tag != null)
                        {
                            String collectionName = cButton.Tag.ToString();
                            int    targetsSize    = m_targets.Count;
                            if (targetsSize > 0)
                            {
                                FCView           target           = m_targets[0];
                                CollectionWindow collectionWindow = new CollectionWindow(m_native);
                                collectionWindow.CollectionName = collectionName;
                                collectionWindow.DesignerDiv    = m_designerDiv;
                                collectionWindow.Target         = target;
                                collectionWindow.Xml            = m_xml;
                                collectionWindow.IsWinForm      = false;
                                collectionWindow.showDialog();
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 18
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;
                }
            }
        }
Exemplo n.º 19
0
 /// <summary>
 /// 创建控件
 /// </summary>
 public IndexDiv()
 {
     BackColor   = FCColor.argb(0, 0, 0);
     BorderColor = FCColor.None;
 }
Exemplo n.º 20
0
 /// <summary>
 /// 获取黑色风格的颜色
 /// </summary>
 /// <param name="color">颜色</param>
 /// <returns>新的颜色</returns>
 public static long getBlackColor(long color)
 {
     if (color > FCDraw.FCCOLORS_USERCOLOR)
     {
         if (color == FCColor.Back)
         {
             color = FCColor.argb(100, 0, 0, 0);
         }
         else if (color == FCColor.Border)
         {
             color = 3289650;
         }
         else if (color == FCColor.Text)
         {
             color = FCColor.argb(255, 255, 255);
         }
         else if (color == FCColor.DisabledBack)
         {
             color = FCColor.argb(50, 255, 255, 255);
         }
         else if (color == FCColor.DisabledText)
         {
             color = 3289650;
         }
         else if (color == FCColor.Hovered)
         {
             color = FCColor.argb(50, 255, 255, 255);
         }
         else if (color == FCColor.Pushed)
         {
             color = FCColor.argb(50, 255, 255, 255);
         }
     }
     else if (color == FCDraw.FCCOLORS_BACKCOLOR)
     {
         color = FCColor.argb(255, 50, 50, 50);
     }
     else if (color == FCDraw.FCCOLORS_BACKCOLOR2)
     {
         color = FCColor.argb(150, 0, 0, 0);
     }
     else if (color == FCDraw.FCCOLORS_BACKCOLOR3)
     {
         color = FCColor.argb(100, 0, 0, 0);
     }
     else if (color == FCDraw.FCCOLORS_BACKCOLOR4)
     {
         color = FCColor.argb(0, 0, 0);
     }
     else if (color == FCDraw.FCCOLORS_BACKCOLOR5)
     {
         color = FCColor.argb(10, 255, 255, 255);
     }
     else if (color == FCDraw.FCCOLORS_BACKCOLOR6)
     {
         color = FCColor.argb(25, 0, 0, 0);
     }
     else if (color == FCDraw.FCCOLORS_BACKCOLOR7)
     {
         color = FCColor.argb(200, 255, 255, 255);
     }
     else if (color == FCDraw.FCCOLORS_FORECOLOR)
     {
         color = FCColor.argb(255, 255, 255);
     }
     else if (color == FCDraw.FCCOLORS_FORECOLOR2)
     {
         color = FCColor.argb(217, 217, 68);
     }
     else if (color == FCDraw.FCCOLORS_FORECOLOR3)
     {
         color = FCColor.argb(80, 255, 255);
     }
     else if (color == FCDraw.FCCOLORS_FORECOLOR4)
     {
         color = FCColor.argb(112, 112, 112);
     }
     else if (color == FCDraw.FCCOLORS_FORECOLOR5)
     {
         color = FCColor.argb(192, 192, 192);
     }
     else if (color == FCDraw.FCCOLORS_FORECOLOR6)
     {
         color = FCColor.argb(0, 0, 0);
     }
     else if (color == FCDraw.FCCOLORS_FORECOLOR7)
     {
         color = FCColor.argb(0, 255, 255);
     }
     else if (color == FCDraw.FCCOLORS_FORECOLOR8)
     {
         color = FCColor.argb(50, 50, 50);
     }
     else if (color == FCDraw.FCCOLORS_FORECOLOR9)
     {
         color = FCColor.argb(255, 255, 0);
     }
     else if (color == FCDraw.FCCOLORS_FORECOLOR10)
     {
         color = FCColor.argb(255, 255, 80);
     }
     else if (color == FCDraw.FCCOLORS_FORECOLOR11)
     {
         color = FCColor.argb(135, 206, 235);
     }
     else if (color == FCDraw.FCCOLORS_LINECOLOR)
     {
         color = FCColor.argb(255, 255, 255);
     }
     else if (color == FCDraw.FCCOLORS_LINECOLOR2)
     {
         color = FCColor.argb(217, 217, 68);
     }
     else if (color == FCDraw.FCCOLORS_LINECOLOR3)
     {
         color = FCColor.argb(50, 255, 255, 255);
     }
     else if (color == FCDraw.FCCOLORS_LINECOLOR4)
     {
         color = FCColor.argb(150, 0, 0);
     }
     else if (color == FCDraw.FCCOLORS_LINECOLOR5)
     {
         color = FCColor.argb(100, 100, 100);
     }
     else if (color == FCDraw.FCCOLORS_MIDCOLOR)
     {
         color = FCColor.argb(255, 255, 255);
     }
     else if (color == FCDraw.FCCOLORS_UPCOLOR)
     {
         color = FCColor.argb(255, 82, 82);
     }
     else if (color == FCDraw.FCCOLORS_DOWNCOLOR)
     {
         color = FCColor.argb(80, 255, 80);
     }
     else if (color == FCDraw.FCCOLORS_DOWNCOLOR2)
     {
         color = FCColor.argb(80, 255, 255);
     }
     else if (color == FCDraw.FCCOLORS_DOWNCOLOR3)
     {
         color = FCColor.argb(100, 0, 255);
     }
     else if (color == FCDraw.FCCOLORS_SELECTEDROWCOLOR)
     {
         color = FCColor.argb(150, 100, 100, 100);
     }
     else if (color == FCDraw.FCCOLORS_HOVEREDROWCOLOR)
     {
         color = FCColor.argb(150, 150, 150, 150);
     }
     else if (color == FCDraw.FCCOLORS_WINDOWFORECOLOR)
     {
         color = FCColor.argb(255, 255, 255);
     }
     else if (color == FCDraw.FCCOLORS_WINDOWBACKCOLOR)
     {
         color = FCColor.argb(255, 50, 50, 50);
     }
     else if (color == FCDraw.FCCOLORS_WINDOWBACKCOLOR2)
     {
         color = FCColor.argb(200, 20, 20, 20);
     }
     else if (color == FCDraw.FCCOLORS_WINDOWCONTENTBACKCOLOR)
     {
         color = FCColor.argb(200, 0, 0, 0);
     }
     return(color);
 }
Exemplo n.º 21
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);
                            }
                        }
                    }
                }
            }
        }