Exemple #1
0
 /// <summary>
 /// 重绘前景方法
 /// </summary>
 /// <param name="paint">绘图对象</param>
 /// <param name="clipRect">裁剪区域</param>
 public override void OnPaintBackground(CPaint paint, RECT clipRect)
 {
     base.OnPaintBackground(paint, clipRect);
     lock (m_barrages)
     {
         int barragesSize = m_barrages.Count;
         for (int i = 0; i < barragesSize; i++)
         {
             Barrage brg  = m_barrages[i];
             FONT    font = brg.Font;
             RECT    rect = brg.Rect;
             String  str  = brg.Text;
             SIZE    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;
                 COLOR.ToARGB(null, color, ref a, ref r, ref g, ref b);
                 a     = a * brg.Tick / 400;
                 color = COLOR.ARGB(a, r, g, b);
             }
             paint.DrawText(str, color, font, rect);
         }
     }
 }
Exemple #2
0
 /// <summary>
 /// 重绘前景方法
 /// </summary>
 /// <param name="paint">绘图对象</param>
 /// <param name="clipRect">裁剪区域</param>
 public override void OnPaintBackground(CPaint paint, RECT clipRect)
 {
     base.OnPaintBackground(paint, clipRect);
     lock (m_barrages)
     {
         int barragesSize = m_barrages.Count;
         for (int i = 0; i < barragesSize; i++)
         {
             Barrage brg  = m_barrages[i];
             FONT    font = brg.Font;
             RECT    rect = brg.Rect;
             String  str  = brg.Text;
             SIZE    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;
                 COLOR.ToARGB(null, color, ref a, ref r, ref g, ref b);
                 a     = a * brg.Tick / 400;
                 color = COLOR.ARGB(a, r, g, b);
             }
             if (mode == 2)
             {
                 POINT[] points = new POINT[5];
                 int     mWidth = rect.right - rect.left, mHeight = rect.bottom - rect.top;
                 points[0] = new POINT(rect.left, rect.top + mHeight / 2 + 1);
                 points[1] = new POINT(rect.left + 20, rect.top);
                 points[2] = new POINT(rect.right, rect.top);
                 points[3] = new POINT(rect.right, rect.bottom);
                 points[4] = new POINT(rect.left + 20, rect.bottom);
                 RECT drawRect = new RECT(rect.left - 30, rect.top - 10, rect.right + 30, rect.bottom + 10);
                 paint.DrawImage("file='fire2.jpg' highcolor='150,150,150' lowcolor='0,0,0'", drawRect);
                 //paint.FillGradientPolygon(COLOR.ARGB(255, 120, 40), COLOR.ARGB(255, 80, 40), points, 90);
             }
             else
             {
                 paint.DrawText(str, color, font, rect);
             }
         }
     }
 }
Exemple #3
0
        /// <summary>
        /// 获取颜色
        /// </summary>
        /// <param name="dwPenColor">整型颜色</param>
        /// <returns>Gdi颜色</returns>
        private Color GetWPFColor(long dwPenColor)
        {
            dwPenColor = GetPaintColor(dwPenColor);
            int a = 0, r = 0, g = 0, b = 0;

            COLOR.ToARGB(this, dwPenColor, ref a, ref r, ref g, ref b);
            Color wpfColor = Color.FromArgb((byte)a, (byte)r, (byte)g, (byte)b);

            if (m_opacity < 1)
            {
                Color opacityColor = Color.FromArgb((byte)(wpfColor.A * m_opacity), (byte)r, (byte)g, (byte)b);
                return(opacityColor);
            }
            else
            {
                return(wpfColor);
            }
        }
Exemple #4
0
 /// <summary>
 /// 重绘背景方法
 /// </summary>
 /// <param name="paint">绘图对象</param>
 public void OnPaintBackground(CPaint paint)
 {
     if (m_k != 0 && m_b != 0)
     {
         if (IsClick)
         {
             int a = 0, r = 0, g = 0, b = 0;
             COLOR.ToARGB(paint, m_backColor, ref a, ref r, ref g, ref b);
             RECT bRect = new RECT(m_location.x - m_tick3, m_location.y - m_tick3, m_location.x + m_tick3, m_location.y + m_tick3);
             if (m_tick3 < 400)
             {
                 paint.FillEllipse(COLOR.ARGB(200 - 200 * m_tick3 / 400, r, g, b), bRect);
             }
             paint.DrawEllipse(m_backColor, 2, 0, bRect);
             m_tick3 += 40;
             bRect    = new RECT(m_location.x - m_tick4, m_location.y - m_tick4, m_location.x + m_tick4, m_location.y + m_tick4);
             if (m_tick4 < 300)
             {
                 paint.FillEllipse(COLOR.ARGB(150 - 150 * m_tick4 / 400, r, g, b), bRect);
             }
             m_tick4 += 20;
             bRect    = new RECT(m_location.x - m_tick5, m_location.y - m_tick5, m_location.x + m_tick5, m_location.y + m_tick5);
             if (m_tick5 < 200)
             {
                 paint.FillEllipse(COLOR.ARGB(100 - 100 * m_tick5 / 400, r, g, b), bRect);
             }
             m_tick5 += 10;
         }
         else
         {
             RECT drawRect = new RECT(m_location.x - m_tick, m_location.y - m_tick, m_location.x + m_tick, m_location.y + m_tick);
             paint.FillGradientEllipse(m_backColor, COLOR.RatioColor(paint, m_backColor, 1.1), drawRect, 90);
             paint.DrawEllipse(m_backColor, 2, 0, new RECT(m_location.x - 20, m_location.y - 20, m_location.x + 20, m_location.y + 20));
         }
         if (m_tick2 % 5 == 0)
         {
             if (m_mode == 0)
             {
                 m_tick++;
                 if (m_tick > 10)
                 {
                     m_mode = 1;
                 }
             }
             else if (m_mode == 1)
             {
                 m_tick--;
                 if (m_tick < 4)
                 {
                     m_mode = 0;
                 }
             }
         }
         m_tick2++;
         if (m_tick2 > 1000)
         {
             m_tick2 = 0;
         }
         if (m_security != null)
         {
             SecurityLatestData latestData = new SecurityLatestData();
             if (SecurityService.GetLatestData(m_security.m_code, ref latestData) == 0)
             {
                 latestData.m_securityName = m_security.m_name;
             }
             if (IsClick)
             {
                 FONT   nFont = new FONT("Arial", 30, true, false, false);
                 FONT   iFont = new FONT("SimSum", 30, true, false, false);
                 String name  = m_security.m_name;
                 SIZE   tSize = paint.TextSize(name, iFont);
                 int    x     = m_location.x - tSize.cx / 2;
                 int    mid   = x + tSize.cx / 2;
                 int    y     = m_location.y - 90;
                 RECT   tRect = new RECT(x, y, x + tSize.cx, y + tSize.cy);
                 paint.DrawText(name, m_backColor, iFont, tRect);
                 double diff = 0;
                 if (latestData.m_lastClose > 0)
                 {
                     diff = 100 * (latestData.m_close - latestData.m_lastClose) / latestData.m_lastClose;
                 }
                 y += tSize.cy;
                 String strClose = latestData.m_close.ToString();
                 tSize = paint.TextSize(strClose, nFont);
                 x     = mid - tSize.cx / 2;
                 tRect = new RECT(x, y, x + tSize.cx, y + tSize.cy);
                 if (diff >= 0)
                 {
                     paint.DrawText(strClose, COLOR.ARGB(255, 82, 82), nFont, tRect);
                 }
                 else
                 {
                     paint.DrawText(strClose, COLOR.ARGB(82, 255, 82), nFont, tRect);
                 }
                 y += tSize.cy;
                 String value = diff.ToString("0.00") + "%";
                 if (diff >= 0)
                 {
                     value = "+" + value;
                 }
                 if (latestData.m_close == 0)
                 {
                     value = "停牌";
                 }
                 tSize = paint.TextSize(value, nFont);
                 x     = mid - tSize.cx / 2;
                 tRect = new RECT(x, y, x + tSize.cx, y + tSize.cy);
                 if (diff >= 0)
                 {
                     paint.DrawText(value, COLOR.ARGB(255, 82, 82), nFont, tRect);
                 }
                 else
                 {
                     paint.DrawText(value, COLOR.ARGB(82, 255, 82), nFont, tRect);
                 }
                 y += tSize.cy;
                 double volume = latestData.m_volume / 100;
                 String unit   = "";
                 if (volume > 100000000)
                 {
                     volume /= 100000000;
                     unit    = "亿";
                 }
                 else if (volume > 10000)
                 {
                     volume /= 10000;
                     unit    = "万";
                 }
                 String strVol = (volume).ToString("0.00") + unit;
                 tSize = paint.TextSize(strVol, nFont);
                 x     = mid - tSize.cx / 2;
                 tRect = new RECT(x, y, x + tSize.cx, y + tSize.cy);
                 paint.DrawText(strVol, COLOR.ARGB(255, 255, 0), nFont, tRect);
             }
             else
             {
                 FONT   iFont = new FONT("SimSum", 30, true, false, false);
                 String name  = m_security.m_name;
                 SIZE   tSize = paint.TextSize(name, iFont);
                 int    x     = m_location.x - tSize.cx / 2;
                 int    mid   = x + tSize.cx / 2;
                 int    y     = m_location.y - 60;
                 RECT   tRect = new RECT(x, y, x + tSize.cx, y + tSize.cy);
                 paint.DrawText(name, m_backColor, iFont, tRect);
             }
         }
     }
 }
Exemple #5
0
        /// <summary>
        /// 获取白色风格的颜色
        /// </summary>
        /// <param name="color">颜色</param>
        /// <returns>新的颜色</returns>
        private static long GetWhiteColor(long dwPenColor)
        {
            long color = dwPenColor;

            if (color < COLOR.EMPTY)
            {
                if (color > PCOLORS_USERCOLOR)
                {
                    if (color == COLOR.CONTROL)
                    {
                        color = COLOR.ARGB(255, 255, 255);
                    }
                    else if (color == COLOR.CONTROLBORDER)
                    {
                        color = COLOR.ARGB(200, 200, 200);
                    }
                    else if (color == COLOR.CONTROLTEXT)
                    {
                        color = COLOR.ARGB(0, 0, 0);
                    }
                    else if (color == COLOR.DISABLEDCONTROL)
                    {
                        color = COLOR.ARGB(25, 255, 255, 255);
                    }
                    else if (color == COLOR.DISABLEDCONTROLTEXT)
                    {
                        color = 3289650;
                    }
                    else if (color == COLOR.HOVEREDCONTROL)
                    {
                        color = COLOR.ARGB(150, 200, 200, 200);
                    }
                    else if (color == COLOR.PUSHEDCONTROL)
                    {
                        color = COLOR.ARGB(150, 150, 150, 150);
                    }
                }
                else if (color == PCOLORS_BACKCOLOR)
                {
                    color = COLOR.ARGB(255, 255, 255);
                }
                else if (color == PCOLORS_BACKCOLOR2)
                {
                    color = COLOR.ARGB(230, 230, 230);
                }
                else if (color == PCOLORS_BACKCOLOR3)
                {
                    color = COLOR.ARGB(25, 100, 100, 100);
                }
                else if (color == PCOLORS_BACKCOLOR4)
                {
                    color = COLOR.ARGB(25, 0, 0, 0);
                }
                else if (color == PCOLORS_BACKCOLOR5)
                {
                    color = COLOR.ARGB(75, 51, 153, 255);
                }
                else if (color == PCOLORS_BACKCOLOR6)
                {
                    color = COLOR.ARGB(50, 51, 153, 255);
                }
                else if (color == PCOLORS_BACKCOLOR7)
                {
                    color = COLOR.ARGB(100, 255, 255, 255);
                }
                else if (color == PCOLORS_BACKCOLOR8)
                {
                    color = COLOR.ARGB(50, 105, 217);
                }
                else if (color == PCOLORS_BACKCOLOR9)
                {
                    color = COLOR.ARGB(75, 215, 99);
                }
                else if (color == PCOLORS_FORECOLOR)
                {
                    color = COLOR.ARGB(0, 0, 0);
                }
                else if (color == PCOLORS_FORECOLOR2)
                {
                    color = COLOR.ARGB(112, 112, 112);
                }
                else if (color == PCOLORS_FORECOLOR3)
                {
                    color = COLOR.ARGB(100, 255, 255, 255);
                }
                else if (color == PCOLORS_FORECOLOR4)
                {
                    color = COLOR.ARGB(255, 255, 255);
                }
                else if (color == PCOLORS_LINECOLOR)
                {
                    color = COLOR.ARGB(100, 100, 100);
                }
                else if (color == PCOLORS_LINECOLOR2)
                {
                    color = COLOR.ARGB(0, 105, 217);
                }
                else if (color == CDraw.PCOLORS_UPCOLOR)
                {
                    color = COLOR.ARGB(255, 82, 82);
                }
                else if (color == CDraw.PCOLORS_DOWNCOLOR)
                {
                    color = COLOR.ARGB(80, 255, 80);
                }
                else if (color == CDraw.PCOLORS_LINECOLOR3)
                {
                    color = COLOR.ARGB(5, 255, 255, 255);
                }
                else if (color == PCOLORS_SELECTEDROWCOLOR)
                {
                    color = COLOR.ARGB(0, 105, 217);
                }
                else if (color == PCOLORS_HOVEREDROWCOLOR)
                {
                    color = COLOR.ARGB(200, 240, 240, 240);
                }
                else if (color == PCOLORS_ALTERNATEROWCOLOR)
                {
                    color = COLOR.ARGB(200, 245, 245, 245);
                }
                else if (color == CDraw.PCOLORS_WINDOWFORECOLOR)
                {
                    color = COLOR.ARGB(0, 0, 0);
                }
                else if (color == CDraw.PCOLORS_WINDOWBACKCOLOR)
                {
                    color = COLOR.ARGB(255, 255, 255);
                }
                else if (color == CDraw.PCOLORS_WINDOWBACKCOLOR2)
                {
                    color = COLOR.ARGB(100, 255, 255, 255);
                }
                else if (color == CDraw.PCOLORS_WINDOWBACKCOLOR3)
                {
                    color = COLOR.ARGB(230, 255, 255, 255);
                }
                else if (color == CDraw.PCOLORS_WINDOWCROSSLINECOLOR)
                {
                    color = COLOR.ARGB(100, 100, 100);
                }
                else if (color == CDraw.PCOLORS_WINDOWCROSSLINECOLOR2)
                {
                    color = COLOR.ARGB(10, 255, 255, 255);
                }
                else if (color == CDraw.PCOLORS_WINDOWCONTENTBACKCOLOR)
                {
                    color = COLOR.ARGB(235, 255, 255, 255);
                }
            }
            if (m_style == 2 || m_style == 3)
            {
                int a = 0, r = 0, g = 0, b = 0;
                COLOR.ToARGB(null, color, ref a, ref r, ref g, ref b);
                if (m_style == 2)
                {
                    return(COLOR.ARGB(a, (r + g + b) / 3, (r + g + b) / 3, (r + g + b) / 3));
                }
                else if (m_style == 3)
                {
                    return(COLOR.ARGB(a, 255 - r, 255 - g, 255 - b));
                }
            }
            return(color);
        }
Exemple #6
0
 /// <summary>
 /// 重绘背景方法
 /// </summary>
 /// <param name="paint">绘图对象</param>
 public void OnPaintBackground(CPaint paint)
 {
     if (m_k != 0 && m_b != 0)
     {
         if (IsClick)
         {
             int a = 0, r = 0, g = 0, b = 0;
             COLOR.ToARGB(paint, m_backColor, ref a, ref r, ref g, ref b);
             RECT bRect = new RECT(m_location.x - m_tick3, m_location.y - m_tick3, m_location.x + m_tick3, m_location.y + m_tick3);
             if (m_tick3 < 400)
             {
                 paint.FillEllipse(COLOR.ARGB(200 - 200 * m_tick3 / 400, r, g, b), bRect);
             }
             paint.DrawEllipse(m_backColor, 2, 0, bRect);
             m_tick3 += 40;
             bRect    = new RECT(m_location.x - m_tick4, m_location.y - m_tick4, m_location.x + m_tick4, m_location.y + m_tick4);
             if (m_tick4 < 300)
             {
                 paint.FillEllipse(COLOR.ARGB(150 - 150 * m_tick4 / 400, r, g, b), bRect);
             }
             m_tick4 += 20;
             bRect    = new RECT(m_location.x - m_tick5, m_location.y - m_tick5, m_location.x + m_tick5, m_location.y + m_tick5);
             if (m_tick5 < 200)
             {
                 paint.FillEllipse(COLOR.ARGB(100 - 100 * m_tick5 / 400, r, g, b), bRect);
             }
             m_tick5 += 10;
         }
         else
         {
             RECT drawRect = new RECT(m_location.x - m_tick - 10, m_location.y - m_tick - 10, m_location.x + m_tick + 10, m_location.y + m_tick + 10);
             paint.FillGradientEllipse(m_backColor, COLOR.RatioColor(paint, m_backColor, 1.1), drawRect, 90);
             paint.DrawEllipse(m_backColor, 2, 0, new RECT(m_location.x - 25, m_location.y - 25, m_location.x + 25, m_location.y + 25));
             paint.DrawLine(m_backColor, 5, 0, m_location.x + 20, m_location.y - 15, m_location.x + 30, m_location.y - 25);
         }
         if (m_tick2 % 5 == 0)
         {
             if (m_mode == 0)
             {
                 m_tick++;
                 if (m_tick > 10)
                 {
                     m_mode = 1;
                 }
             }
             else if (m_mode == 1)
             {
                 m_tick--;
                 if (m_tick < 4)
                 {
                     m_mode = 0;
                 }
             }
         }
         m_tick2++;
         if (m_tick2 > 1000)
         {
             m_tick2 = 0;
         }
     }
 }