x957e371151765ec5.cs
上传用户:xlxx0122
上传日期:2015-04-24
资源大小:3904k
文件大小:16k
源码类别:

.net编程

开发平台:

C#

  1. namespace Sunisoft.IrisSkin.InternalControls
  2. {
  3.     using Sunisoft.IrisSkin;
  4.     using System;
  5.     using System.Drawing;
  6.     using System.Drawing.Drawing2D;
  7.     using System.Drawing.Imaging;
  8.     using System.Windows.Forms;
  9.     internal class x957e371151765ec5
  10.     {
  11.         protected static IntPtr halfToneBrush = IntPtr.Zero;
  12.         public static void DrawButtonCommand(Graphics g, xdbfa333b4cd503e0 direction, Rectangle drawRect, x44fcc2f4d57dc4d8 state, Color baseColor, Color trackLight, Color trackBorder)
  13.         {
  14.             Rectangle rect = new Rectangle(drawRect.Left, drawRect.Top, drawRect.Width - 1, drawRect.Height - 1);
  15.             switch (state)
  16.             {
  17.                 case x44fcc2f4d57dc4d8.Normal:
  18.                 {
  19.                     using (SolidBrush brush = new SolidBrush(baseColor))
  20.                     {
  21.                         g.FillRectangle(brush, rect);
  22.                         return;
  23.                     }
  24.                 }
  25.                 case x44fcc2f4d57dc4d8.HotTrack:
  26.                     g.FillRectangle(Brushes.White, rect);
  27.                     using (SolidBrush brush2 = new SolidBrush(trackLight))
  28.                     {
  29.                         g.FillRectangle(brush2, rect);
  30.                     }
  31.                     using (Pen pen = new Pen(trackBorder))
  32.                     {
  33.                         g.DrawRectangle(pen, rect);
  34.                     }
  35.                     return;
  36.                 case x44fcc2f4d57dc4d8.Pushed:
  37.                     return;
  38.                 default:
  39.                     return;
  40.             }
  41.         }
  42.         public static void DrawDragRectangle(Rectangle newRect, int indent)
  43.         {
  44.             Rectangle[] newRects = new Rectangle[] { newRect };
  45.             DrawDragRectangles(newRects, indent);
  46.         }
  47.         public static void DrawDragRectangles(Rectangle[] newRects, int indent)
  48.         {
  49.             if (newRects.Length > 0)
  50.             {
  51.                 IntPtr dest = xa941746b2e12e6c1(newRects[0], indent);
  52.                 for (int i = 1; i < newRects.Length; i++)
  53.                 {
  54.                     IntPtr ptr2 = xa941746b2e12e6c1(newRects[i], indent);
  55.                     x31775329b2a4ff52.CombineRgn(dest, dest, ptr2, 3);
  56.                     x31775329b2a4ff52.DeleteObject(ptr2);
  57.                 }
  58.                 IntPtr dC = x61467fe65a98f20c.GetDC(IntPtr.Zero);
  59.                 x31775329b2a4ff52.SelectClipRgn(dC, dest);
  60.                 xae4dd1cafd2eb77c.RECT rectBox = new xae4dd1cafd2eb77c.RECT();
  61.                 x31775329b2a4ff52.GetClipBox(dC, ref rectBox);
  62.                 IntPtr hObject = xc51886532d6aac02();
  63.                 IntPtr ptr5 = x31775329b2a4ff52.SelectObject(dC, hObject);
  64.                 x31775329b2a4ff52.PatBlt(dC, rectBox.left, rectBox.top, rectBox.right - rectBox.left, rectBox.bottom - rectBox.top, 0x5a0049);
  65.                 x31775329b2a4ff52.SelectObject(dC, ptr5);
  66.                 x31775329b2a4ff52.SelectClipRgn(dC, IntPtr.Zero);
  67.                 x31775329b2a4ff52.DeleteObject(dest);
  68.                 x61467fe65a98f20c.ReleaseDC(IntPtr.Zero, dC);
  69.             }
  70.         }
  71.         public static void DrawPlainRaised(Graphics g, Rectangle boxRect, Color baseColor)
  72.         {
  73.             using (Pen pen = new Pen(ControlPaint.LightLight(baseColor)))
  74.             {
  75.                 using (Pen pen2 = new Pen(ControlPaint.DarkDark(baseColor)))
  76.                 {
  77.                     g.DrawLine(pen, boxRect.Left, boxRect.Bottom, boxRect.Left, boxRect.Top);
  78.                     g.DrawLine(pen, boxRect.Left, boxRect.Top, boxRect.Right, boxRect.Top);
  79.                     g.DrawLine(pen2, boxRect.Right, boxRect.Top, boxRect.Right, boxRect.Bottom);
  80.                     g.DrawLine(pen2, boxRect.Right, boxRect.Bottom, boxRect.Left, boxRect.Bottom);
  81.                 }
  82.             }
  83.         }
  84.         public static void DrawPlainRaisedBorder(Graphics g, Rectangle rect, Color lightLight, Color baseColor, Color dark, Color darkDark)
  85.         {
  86.             if ((rect.Width > 2) && (rect.Height > 2))
  87.             {
  88.                 using (Pen pen = new Pen(lightLight))
  89.                 {
  90.                     using (Pen pen2 = new Pen(baseColor))
  91.                     {
  92.                         using (Pen pen3 = new Pen(dark))
  93.                         {
  94.                             using (Pen pen4 = new Pen(darkDark))
  95.                             {
  96.                                 int left = rect.Left;
  97.                                 int top = rect.Top;
  98.                                 int right = rect.Right;
  99.                                 int bottom = rect.Bottom;
  100.                                 g.DrawLine(pen2, right - 1, top, left, top);
  101.                                 g.DrawLine(pen, (int) (right - 2), (int) (top + 1), (int) (left + 1), (int) (top + 1));
  102.                                 g.DrawLine(pen2, (int) (right - 3), (int) (top + 2), (int) (left + 2), (int) (top + 2));
  103.                                 g.DrawLine(pen2, left, top, left, bottom - 1);
  104.                                 g.DrawLine(pen, (int) (left + 1), (int) (top + 1), (int) (left + 1), (int) (bottom - 2));
  105.                                 g.DrawLine(pen2, (int) (left + 2), (int) (top + 2), (int) (left + 2), (int) (bottom - 3));
  106.                                 g.DrawLine(pen4, (int) (right - 1), (int) (top + 1), (int) (right - 1), (int) (bottom - 1));
  107.                                 g.DrawLine(pen3, (int) (right - 2), (int) (top + 2), (int) (right - 2), (int) (bottom - 2));
  108.                                 g.DrawLine(pen2, (int) (right - 3), (int) (top + 3), (int) (right - 3), (int) (bottom - 3));
  109.                                 g.DrawLine(pen4, right - 1, bottom - 1, left, bottom - 1);
  110.                                 g.DrawLine(pen3, (int) (right - 2), (int) (bottom - 2), (int) (left + 1), (int) (bottom - 2));
  111.                                 g.DrawLine(pen2, (int) (right - 3), (int) (bottom - 3), (int) (left + 2), (int) (bottom - 3));
  112.                             }
  113.                         }
  114.                     }
  115.                 }
  116.             }
  117.         }
  118.         public static void DrawPlainRaisedBorderTopOrBottom(Graphics g, Rectangle rect, Color lightLight, Color baseColor, Color dark, Color darkDark, bool drawTop)
  119.         {
  120.             if ((rect.Width > 2) && (rect.Height > 2))
  121.             {
  122.                 using (Pen pen = new Pen(lightLight))
  123.                 {
  124.                     using (Pen pen2 = new Pen(baseColor))
  125.                     {
  126.                         using (Pen pen3 = new Pen(dark))
  127.                         {
  128.                             using (Pen pen4 = new Pen(darkDark))
  129.                             {
  130.                                 int left = rect.Left;
  131.                                 int top = rect.Top;
  132.                                 int right = rect.Right;
  133.                                 int bottom = rect.Bottom;
  134.                                 if (drawTop)
  135.                                 {
  136.                                     g.DrawLine(pen2, right - 1, top, left, top);
  137.                                     g.DrawLine(pen, right - 1, top + 1, left, top + 1);
  138.                                     g.DrawLine(pen2, right - 1, top + 2, left, top + 2);
  139.                                 }
  140.                                 else
  141.                                 {
  142.                                     g.DrawLine(pen4, right - 1, bottom - 1, left, bottom - 1);
  143.                                     g.DrawLine(pen3, right - 1, bottom - 2, left, bottom - 2);
  144.                                     g.DrawLine(pen2, right - 1, bottom - 3, left, bottom - 3);
  145.                                 }
  146.                             }
  147.                         }
  148.                     }
  149.                 }
  150.             }
  151.         }
  152.         public static void DrawPlainSunken(Graphics g, Rectangle boxRect, Color baseColor)
  153.         {
  154.             using (Pen pen = new Pen(ControlPaint.LightLight(baseColor)))
  155.             {
  156.                 using (Pen pen2 = new Pen(ControlPaint.DarkDark(baseColor)))
  157.                 {
  158.                     g.DrawLine(pen2, boxRect.Left, boxRect.Bottom, boxRect.Left, boxRect.Top);
  159.                     g.DrawLine(pen2, boxRect.Left, boxRect.Top, boxRect.Right, boxRect.Top);
  160.                     g.DrawLine(pen, boxRect.Right, boxRect.Top, boxRect.Right, boxRect.Bottom);
  161.                     g.DrawLine(pen, boxRect.Right, boxRect.Bottom, boxRect.Left, boxRect.Bottom);
  162.                 }
  163.             }
  164.         }
  165.         public static void DrawPlainSunkenBorder(Graphics g, Rectangle rect, Color lightLight, Color baseColor, Color dark, Color darkDark)
  166.         {
  167.             if ((rect.Width > 2) && (rect.Height > 2))
  168.             {
  169.                 using (Pen pen = new Pen(lightLight))
  170.                 {
  171.                     using (Pen pen2 = new Pen(baseColor))
  172.                     {
  173.                         using (Pen pen3 = new Pen(dark))
  174.                         {
  175.                             using (Pen pen4 = new Pen(darkDark))
  176.                             {
  177.                                 int left = rect.Left;
  178.                                 int top = rect.Top;
  179.                                 int right = rect.Right;
  180.                                 int bottom = rect.Bottom;
  181.                                 g.DrawLine(pen3, right - 1, top, left, top);
  182.                                 g.DrawLine(pen4, (int) (right - 2), (int) (top + 1), (int) (left + 1), (int) (top + 1));
  183.                                 g.DrawLine(pen2, (int) (right - 3), (int) (top + 2), (int) (left + 2), (int) (top + 2));
  184.                                 g.DrawLine(pen3, left, top, left, bottom - 1);
  185.                                 g.DrawLine(pen4, (int) (left + 1), (int) (top + 1), (int) (left + 1), (int) (bottom - 2));
  186.                                 g.DrawLine(pen2, (int) (left + 2), (int) (top + 2), (int) (left + 2), (int) (bottom - 3));
  187.                                 g.DrawLine(pen, (int) (right - 1), (int) (top + 1), (int) (right - 1), (int) (bottom - 1));
  188.                                 g.DrawLine(pen2, (int) (right - 2), (int) (top + 2), (int) (right - 2), (int) (bottom - 2));
  189.                                 g.DrawLine(pen2, (int) (right - 3), (int) (top + 3), (int) (right - 3), (int) (bottom - 3));
  190.                                 g.DrawLine(pen, right - 1, bottom - 1, left, bottom - 1);
  191.                                 g.DrawLine(pen2, (int) (right - 2), (int) (bottom - 2), (int) (left + 1), (int) (bottom - 2));
  192.                                 g.DrawLine(pen2, (int) (right - 3), (int) (bottom - 3), (int) (left + 2), (int) (bottom - 3));
  193.                             }
  194.                         }
  195.                     }
  196.                 }
  197.             }
  198.         }
  199.         public static void DrawPlainSunkenBorderTopOrBottom(Graphics g, Rectangle rect, Color lightLight, Color baseColor, Color dark, Color darkDark, bool drawTop)
  200.         {
  201.             if ((rect.Width > 2) && (rect.Height > 2))
  202.             {
  203.                 using (Pen pen = new Pen(lightLight))
  204.                 {
  205.                     using (Pen pen2 = new Pen(baseColor))
  206.                     {
  207.                         using (Pen pen3 = new Pen(dark))
  208.                         {
  209.                             using (Pen pen4 = new Pen(darkDark))
  210.                             {
  211.                                 int left = rect.Left;
  212.                                 int top = rect.Top;
  213.                                 int right = rect.Right;
  214.                                 int bottom = rect.Bottom;
  215.                                 if (drawTop)
  216.                                 {
  217.                                     g.DrawLine(pen3, right - 1, top, left, top);
  218.                                     g.DrawLine(pen4, right - 1, top + 1, left, top + 1);
  219.                                     g.DrawLine(pen2, right - 1, top + 2, left, top + 2);
  220.                                 }
  221.                                 else
  222.                                 {
  223.                                     g.DrawLine(pen, right - 1, bottom - 1, left, bottom - 1);
  224.                                     g.DrawLine(pen2, right - 1, bottom - 2, left, bottom - 2);
  225.                                     g.DrawLine(pen2, right - 1, bottom - 3, left, bottom - 3);
  226.                                 }
  227.                             }
  228.                         }
  229.                     }
  230.                 }
  231.             }
  232.         }
  233.         public static void DrawReverseString(Graphics g, string drawText, Font drawFont, Rectangle drawRect, Brush drawBrush, StringFormat drawFormat)
  234.         {
  235.             GraphicsContainer container = g.BeginContainer();
  236.             g.TranslateTransform((float) ((drawRect.Left * 2) + drawRect.Width), (float) ((drawRect.Top * 2) + drawRect.Height));
  237.             g.RotateTransform(180f);
  238.             g.DrawString(drawText, drawFont, drawBrush, drawRect, drawFormat);
  239.             g.EndContainer(container);
  240.         }
  241.         public static void DrawSeparatorCommand(Graphics g, xdbfa333b4cd503e0 direction, Rectangle drawRect, Color baseColor)
  242.         {
  243.             using (Pen pen = new Pen(ControlPaint.Dark(baseColor)))
  244.             {
  245.                 if (direction == xdbfa333b4cd503e0.Horizontal)
  246.                 {
  247.                     g.DrawLine(pen, drawRect.Left, drawRect.Top, drawRect.Left, drawRect.Bottom - 1);
  248.                 }
  249.                 else
  250.                 {
  251.                     g.DrawLine(pen, drawRect.Left, drawRect.Top, drawRect.Right - 1, drawRect.Top);
  252.                 }
  253.             }
  254.         }
  255.         protected static IntPtr xa941746b2e12e6c1(Rectangle x26545669838eb36e, int x94e516b5d3c734eb)
  256.         {
  257.             xae4dd1cafd2eb77c.RECT rect = new xae4dd1cafd2eb77c.RECT();
  258.             rect.left = x26545669838eb36e.Left;
  259.             rect.top = x26545669838eb36e.Top;
  260.             rect.right = x26545669838eb36e.Right;
  261.             rect.bottom = x26545669838eb36e.Bottom;
  262.             IntPtr ptr = x31775329b2a4ff52.CreateRectRgnIndirect(ref rect);
  263.             if (((x94e516b5d3c734eb <= 0) || (x26545669838eb36e.Width <= x94e516b5d3c734eb)) || (x26545669838eb36e.Height <= x94e516b5d3c734eb))
  264.             {
  265.                 return ptr;
  266.             }
  267.             rect.left += x94e516b5d3c734eb;
  268.             rect.top += x94e516b5d3c734eb;
  269.             rect.right -= x94e516b5d3c734eb;
  270.             rect.bottom -= x94e516b5d3c734eb;
  271.             IntPtr ptr2 = x31775329b2a4ff52.CreateRectRgnIndirect(ref rect);
  272.             xae4dd1cafd2eb77c.RECT rect2 = new xae4dd1cafd2eb77c.RECT();
  273.             rect2.left = 0;
  274.             rect2.top = 0;
  275.             rect2.right = 0;
  276.             rect2.bottom = 0;
  277.             IntPtr dest = x31775329b2a4ff52.CreateRectRgnIndirect(ref rect2);
  278.             x31775329b2a4ff52.CombineRgn(dest, ptr, ptr2, 3);
  279.             x31775329b2a4ff52.DeleteObject(ptr);
  280.             x31775329b2a4ff52.DeleteObject(ptr2);
  281.             return dest;
  282.         }
  283.         protected static IntPtr xc51886532d6aac02()
  284.         {
  285.             if (halfToneBrush == IntPtr.Zero)
  286.             {
  287.                 Bitmap bitmap = new Bitmap(8, 8, PixelFormat.Format32bppArgb);
  288.                 Color color = Color.FromArgb(0xff, 0xff, 0xff, 0xff);
  289.                 Color color2 = Color.FromArgb(0xff, 0, 0, 0);
  290.                 bool flag = true;
  291.                 int x = 0;
  292.                 while (x < 8)
  293.                 {
  294.                     int y = 0;
  295.                     while (y < 8)
  296.                     {
  297.                         bitmap.SetPixel(x, y, flag ? color : color2);
  298.                         y++;
  299.                         flag = !flag;
  300.                     }
  301.                     x++;
  302.                     flag = !flag;
  303.                 }
  304.                 IntPtr hbitmap = bitmap.GetHbitmap();
  305.                 x1439a41cfa24189f.LOGBRUSH brush = new x1439a41cfa24189f.LOGBRUSH();
  306.                 brush.lbStyle = 3;
  307.                 brush.lbHatch = (uint) ((int) hbitmap);
  308.                 halfToneBrush = x31775329b2a4ff52.CreateBrushIndirect(ref brush);
  309.             }
  310.             return halfToneBrush;
  311.         }
  312.     }
  313. }