public GDIPen(PenType aType, PenStyle aStyle, PenJoinStyle aJoinStyle, PenEndCap aEndCap, uint colorref, int width, Guid uniqueID)
: base(true,uniqueID)
{
TypeOfPen = aType;
Style = aStyle;
JoinStyle = aJoinStyle;
EndCap = aEndCap;
Width = width;
Color = colorref;
int combinedStyle = (int)aStyle | (int)aType | (int)aJoinStyle | (int)aEndCap;
fLogBrush = new LOGBRUSH();
fLogBrush.lbColor = colorref;
fLogBrush.lbHatch = IntPtr.Zero;
fLogBrush.lbStyle = (int)BrushStyle.Solid;
if (PenType.Cosmetic == aType)
{
// If it's cosmetic, the width must be 1
width = 1;
// The color must be in the brush structure
// Must mask off the alpha, or we'll get black
fLogBrush.lbColor = colorref & 0x00ffffff;
// The brush style must be solid
fLogBrush.lbStyle = (int)BrushStyle.Solid;
}
IntPtr penHandle = GDI32.ExtCreatePen((uint)combinedStyle, (uint)width, ref fLogBrush, 0, IntPtr.Zero);
SetHandle(penHandle);
}
#endregion