public WindowsPen(DeviceContext dc, WindowsPenStyle style, int width, Color color)
 {
     this.style = style;
     this.width = width;
     this.color = color;
     this.dc = dc;
 }
示例#2
0
        private void CreatePen()
        {
            if (width > 1)    // Geometric pen.
            {
                // From MSDN: if width > 1, the style must be PS_NULL, PS_SOLID, or PS_INSIDEFRAME.
                style |= WindowsPenStyle.Geometric | WindowsPenStyle.Solid;
            }

            if (wndBrush == null)
            {
                nativeHandle = IntSafeNativeMethods.CreatePen((int)style, width, ColorTranslator.ToWin32(color));
            }
            else
            {
                IntNativeMethods.LOGBRUSH lb = new IntNativeMethods.LOGBRUSH
                {
                    lbColor = ColorTranslator.ToWin32(wndBrush.Color),
                    lbStyle = IntNativeMethods.BS_SOLID,
                    lbHatch = 0
                };

                // Note: We currently don't support custom styles, that's why 0 and null for last two params.
                nativeHandle = IntSafeNativeMethods.ExtCreatePen((int)style, width, lb, 0, null);
            }
        }
 public WindowsPen(DeviceContext dc, WindowsPenStyle style, int width, Color color)
 {
     this.style = style;
     this.width = width;
     this.color = color;
     this.dc    = dc;
 }
 public WindowsPen(DeviceContext dc, WindowsPenStyle style, int width, WindowsBrush windowsBrush)
 {
     this.style    = style;
     this.wndBrush = (WindowsBrush)windowsBrush.Clone();
     this.width    = width;
     this.color    = windowsBrush.Color;
     this.dc       = dc;
 }
 public WindowsPen(DeviceContext dc, WindowsPenStyle style, int width, WindowsBrush windowsBrush)
 {
     this.style = style;
     this.wndBrush = (WindowsBrush) windowsBrush.Clone();
     this.width = width;
     this.color = windowsBrush.Color;
     this.dc = dc;
 }
示例#6
0
        public WindowsPen(DeviceContext dc, WindowsPenStyle style, int width, Color color)
        {
            this.style = style;
            this.width = width;
            this.color = color;
            this.dc    = dc;

            // CreatePen() created on demand.
        }
示例#7
0
        public WindowsPen(DeviceContext dc, WindowsPenStyle style, int width, Color color)
        {
            this.style = style;
            this.width = width;
            this.color = color;
            this.dc    = dc;

            // CreatePen() created on demand.
        }
示例#8
0
        public WindowsPen(DeviceContext dc, WindowsPenStyle style, int width, WindowsBrush windowsBrush)
        {
            Debug.Assert(windowsBrush != null, "null windowsBrush");

            this.style    = style;
            this.wndBrush = (WindowsBrush)windowsBrush.Clone();
            this.width    = width;
            this.color    = windowsBrush.Color;
            this.dc       = dc;

            // CreatePen() created on demand.
        }
 private void CreatePen()
 {
     if (this.width > 1)
     {
         this.style |= WindowsPenStyle.Geometric;
     }
     if (this.wndBrush == null)
     {
         this.nativeHandle = IntSafeNativeMethods.CreatePen((int)this.style, this.width, ColorTranslator.ToWin32(this.color));
     }
     else
     {
         IntNativeMethods.LOGBRUSH lplb = new IntNativeMethods.LOGBRUSH {
             lbColor = ColorTranslator.ToWin32(this.wndBrush.Color),
             lbStyle = 0,
             lbHatch = 0
         };
         this.nativeHandle = IntSafeNativeMethods.ExtCreatePen((int)this.style, this.width, lplb, 0, null);
     }
 }
 private void CreatePen()
 {
     if (this.width > 1)
     {
         this.style |= WindowsPenStyle.Geometric;
     }
     if (this.wndBrush == null)
     {
         this.nativeHandle = IntSafeNativeMethods.CreatePen((int) this.style, this.width, ColorTranslator.ToWin32(this.color));
     }
     else
     {
         IntNativeMethods.LOGBRUSH lplb = new IntNativeMethods.LOGBRUSH {
             lbColor = ColorTranslator.ToWin32(this.wndBrush.Color),
             lbStyle = 0,
             lbHatch = 0
         };
         this.nativeHandle = IntSafeNativeMethods.ExtCreatePen((int) this.style, this.width, lplb, 0, null);
     }
 }
示例#11
0
        private void CreatePen()
        {
            if (this.width > 1)    // Geometric pen.
            {
                // From MSDN: if width > 1, the style must be PS_NULL, PS_SOLID, or PS_INSIDEFRAME.
                this.style |= WindowsPenStyle.Geometric | WindowsPenStyle.Solid;
            }

            if (this.wndBrush == null)
            {
                this.nativeHandle = IntSafeNativeMethods.CreatePen((int)this.style, this.width, ColorTranslator.ToWin32(this.color));
            }
            else
            {
                IntNativeMethods.LOGBRUSH lb = new IntNativeMethods.LOGBRUSH();

                lb.lbColor = ColorTranslator.ToWin32(this.wndBrush.Color);
                lb.lbStyle = IntNativeMethods.BS_SOLID;
                lb.lbHatch = 0; // CONSIDER: Check if HatchBrush and get the style if so (If needed in the future).

                // Note: We currently don't support custom styles, that's why 0 and null for last two params.
                this.nativeHandle = IntSafeNativeMethods.ExtCreatePen((int)this.style, this.width, lb, 0, null);
            }
        }
示例#12
0
 public WindowsPen(DeviceContext dc, WindowsPenStyle style, int width, WindowsBrush windowsBrush )
 {
     Debug.Assert(windowsBrush != null, "null windowsBrush" );
     
     this.style    = style;
     this.wndBrush = (WindowsBrush) windowsBrush.Clone();
     this.width    = width;
     this.color    = windowsBrush.Color;
     this.dc       = dc;
     
     // CreatePen() created on demand.
 }
示例#13
0
        private void CreatePen()
        { 
            if (this.width > 1)    // Geometric pen.
            {
                // From MSDN: if width > 1, the style must be PS_NULL, PS_SOLID, or PS_INSIDEFRAME. 
                this.style |= WindowsPenStyle.Geometric | WindowsPenStyle.Solid;
            }

            if (this.wndBrush == null)
            {
                this.nativeHandle = IntSafeNativeMethods.CreatePen((int) this.style, this.width, ColorTranslator.ToWin32(this.color) );
            }
            else
            { 
                IntNativeMethods.LOGBRUSH lb = new IntNativeMethods.LOGBRUSH();

                lb.lbColor = ColorTranslator.ToWin32( this.wndBrush.Color );
                lb.lbStyle = IntNativeMethods.BS_SOLID;
                lb.lbHatch = 0; // CONSIDER: Check if HatchBrush and get the style if so (If needed in the future).
                
                // Note: We currently don't support custom styles, that's why 0 and null for last two params.
                this.nativeHandle = IntSafeNativeMethods.ExtCreatePen((int)this.style, this.width, lb, 0, null );
            }
        }