Drawing a splitter with GDI?

BlitzMax Forums/MaxGUI Module/Drawing a splitter with GDI?

JoshK(Posted 2006) [#1]
I finished my splitter control which separates viewports, but I'm not happy with the way its displayed when I am dragging the splitter. In Hammer, the program draws semi-transparent lines as you drag the mouse. I'm assuming this is done with GDI drawing, because the appearance is similar to how mouse icons look.



Here you can see that the lines are somewhat blended with what lies underneath them:


How can I draw lines like these on a window?


Brendane(Posted 2006) [#2]
You need to create a geometric pen (otherwise linesize is always fixed to 1). Using ExtCreatePen()

Set the line width.

Pen style will be dashed/hatched or whatever

Set the foreground mix mode (using SetROP2() in GDI) to do an XOR of the pen with the foreground

Draw the lines

Draw overthem with an XOR mode again to delete them non-destructively


JoshK(Posted 2006) [#3]
Code?


Brendane(Posted 2006) [#4]
Quickly hacked together but you get the idea :-




JoshK(Posted 2006) [#5]
Sweet, thank you. A working code examples saves me hours of looking up functions. :)


JoshK(Posted 2006) [#6]
Hmmm...your example only draws within the panel client area. Even if I draw separately for each affected panel, I still need to be able to draw over the panel borders.

I need to draw on top of everything, not just within a panel client area.

I did figure out how to use a bitmap to get that grey/checker pattern, but I still need to be able to draw on top of everything.


Brendane(Posted 2006) [#7]
Presuming you're only drawing this while dragging a marker you would make a panel - attached to the window client area - all your other gadgets are on the window as usual (not the panel).

Then you would handle the drawing of the marker until the mouse was released - thus preventing redrawing of the other gadgets... let me modify the code to show you what I mean....


there... hold the left mouse to drag the marker....

[edit] actually this example doesn't quite work because it doesn't get the input onto the other controls - but you get the idea - in your case it wouldn't be a problem because you are only handling the input to your splitter[/edit]




JoshK(Posted 2006) [#8]
Well, I can draw directly to the desktop. Maybe that is the way to do it.


Brendane(Posted 2006) [#9]
Yes, that's a better solution, good luck!