[DllImport("gdi32.dll")]
static extern IntPtr CreatePen(PenStyle fnPenStyle, int nWidth, uint crColor);
<DllImport("gdi32.dll")> _
Private Shared Function CreatePen(fnPenStyle As PenStyle, nWidth As Integer, crColor As UInteger) As IntPtr
End Function
None.
Please add some!
// 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();
}
Do you know one? Please contribute it!