Exemplo n.º 1
0
 // Set the background of the window to a solid color.
 void IToolkitWindow.SetBackground(System.Drawing.Color color)
 {
     if (color != background)
     {
         background = color;
         //If there was already a background brush then delete it
         if (backgroundBrush != IntPtr.Zero)
         {
             Win32.Api.DeleteObject(backgroundBrush);
         }
         //Create the new cached brush
         backgroundBrush = DrawingSolidBrush.CreateSolidBrush(background);
         //Console.WriteLine("DrawingControlWindow.SetBackground, hwnd="+hwnd);
     }
 }
Exemplo n.º 2
0
        public DrawingHatchBrush(IToolkit toolkit, HatchStyle style,
                                 System.Drawing.Color foreColor,
                                 System.Drawing.Color backColor) : base(toolkit, backColor)
        {
            this.foreColor = DrawingGraphics.ColorToWin32(foreColor);
            this.backColor = DrawingGraphics.ColorToWin32(backColor);
            IntPtr hBi;

            lock (typeof(DrawingHatchBrush))
            {
                hBi = GetBitmap(style);
            }
            if (hBi != IntPtr.Zero)
            {
                hBrush = Win32.Api.CreatePatternBrush(hBi);
            }
            else
            {
                //not one of the types we recognize, so make it a solid brush
                hBrush = DrawingSolidBrush.CreateSolidBrush(foreColor);
            }
        }