Hello all. I've been trying to create a paintbrush with win32, but to no avail. The best that I've been able to do is plot a few pixels here and there (with SetPixel(), but never in a straight, seamless line (the way the pencil tool works in Microsoft paint for example).

Using SetPixel(), I created something that represents a paintbrush, however, the paintbrush skips pixels, and does not draw lines, but dots rather.

WM_CREATE:
global_dc = GetDC(hWnd);
break;

WM_MOUSEMOVE:
SetPixel(global_dc, LOWORD(lParam), HIWORD(lParam), Color::black);
break;

Can someone please tell me how to create a pencil, or paintbrush like tool using Win32/C++?. The above code will create something similar to what I'm looking for, however, the above also creates a paintbrush which skips pixels. Rather than creating seamless lines, the above code creates a paintbrush that skips pixels every now and then within a single line creation. Please help.

I don't know the Win32 API, but I would recommend Googling, and searching Microsoft's documentation (http://msdn.com, I think). It works for me almost every time!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.