Exemple #1
0
        public GDIPen(PenType aType, PenStyle aStyle, PenJoinStyle aJoinStyle, PenEndCap aEndCap, Colorref 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);
        }
Exemple #2
0
        public GPen(PenType aType, PenStyle aStyle, PenJoinStyle aJoinStyle, PenEndCap aEndCap, Colorref colorref, int width, Guid uniqueID)
        {
            TypeOfPen = aType;
            Style = aStyle;
            JoinStyle = aJoinStyle;
            EndCap = aEndCap;
            Width = width;
            Color = colorref;

            this.UniqueID = uniqueID;

            //int combinedStyle = (int)aStyle | (int)aType | (int)aJoinStyle | (int)aEndCap;

            if (PenType.Cosmetic == aType)
            {
                // If it's cosmetic, the width must be 1
                width = 1;
            }
        }
Exemple #3
0
 public static PenHandle CreatePen(PenStyleExtended style, uint width, COLORREF color, PenEndCap endCap = PenEndCap.Round, PenJoin join = PenJoin.Round)
 => GdiMethods.CreatePen(style, width, color, endCap, join);
Exemple #4
0
 public virtual void CreatePen(PenType aType, PenStyle aStyle, PenJoinStyle aJoinStyle, PenEndCap aEndCap, uint colorref, int width, Guid uniqueID)
 {
     GDIPen aPen = DeviceContext.CreatePen(aType, aStyle, aJoinStyle, aEndCap, colorref, width, uniqueID);
     fObjectDictionary.Add(uniqueID, aPen);
 }
 public virtual GDIPen CreatePen(PenType aType, PenStyle aStyle, PenJoinStyle aJoinStyle, PenEndCap aEndCap, Colorref colorref, int width, Guid uniqueID)
 {
     GDIPen aPen = new GDIPen(aType, aStyle, aJoinStyle, aEndCap, colorref, width, uniqueID);
     return aPen;
 }
Exemple #6
0
        public static PenHandle CreatePen(PenStyleExtended style, uint width, COLORREF color, PenEndCap endCap = PenEndCap.Round, PenJoin join = PenJoin.Round)
        {
            LOGBRUSH brush = new LOGBRUSH
            {
                lbColor = color,
                lpStyle = BrushStyle.Solid
            };

            return(Imports.ExtCreatePen(
                       (uint)style | (uint)PenType.Geometric | (uint)endCap | (uint)join,
                       width,
                       ref brush,
                       0,
                       null));
        }