@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: The CreatePen API !!!!C# Signature: [DllImport("gdi32.dll")] static extern IntPtr CreatePen(PenStyle fnPenStyle, int nWidth, uint crColor); !!!!VB.NET Signature: <DllImport("gdi32.dll")> _ Private Shared Function CreatePen(fnPenStyle As PenStyle, nWidth As Integer, crColor As UInteger) As IntPtr End Function !!!!User-Defined Types: PenStyle !!!!Notes: None. !!!!Tips & Tricks: Please add some! !!!!Sample Code: // create a bitmap and get a pointer suitable for GDI Bitmap maskImage = new Bitmap (width, height); Graphics maskg = Graphics.FromImage(maskImage); IntPtr maskHbitmap = maskImage.GetHbitmap(); void PaintLine3(IntPtr hbitmap, Point start, Point end, bool erase) { IntPtr pTarget = maskg.GetHdc(); IntPtr pDC = CreateCompatibleDC(pTarget); IntPtr pOrig = SelectObject(pDC, hbitmap); Color penColor = Color.Blue; int penWidth = 20; IntPtr pen = CreatePen(PenStyle.PS_SOLID | PenStyle.PS_GEOMETRIC | PenStyle.PS_ENDCAP_ROUND, penWidth, (uint)ColorTranslator.ToWin32(penColor)); // select the pen into the device context IntPtr oldpen = SelectObject(pDC, pen); MoveToEx(pDC, start.X, start.Y, IntPtr.Zero); LineTo(pDC, end.X, end.Y); // select the old pen back DeleteObject(SelectObject(pDC, oldpen)); SelectObject(pDC, pOrig); maskg.ReleaseHdc(); } !!!!Alternative Managed API: Do you know one? Please contribute it! Documentation: CreatePen@msdn on MSDN
Edit gdi32.createpen
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.