3 answers to this question

Recommended Posts

neowin_hipster 0

Aah, yet another programmer has discovered the stupidity in windows. Not only are you, the coder, responsible for drawing what you want to draw, you are responsible for all paint events. Normally the .net controls handle this for you.

I can't remember exactly what to do at this moment, but you want to make sure that you trap the WM_PAINT messages or create an appropriate delegate.

You may wish to use .net's gdi+ functions for drawRectangle, but be warned they are not hardware accelerated.

There is no clean solution and everything is a hack. Luckily this will change with vista's new graphic framework (which is being backported to XP afaik) bringing windows into the present along with every other operating system.

Share this post

Link to post

Share on other sites

Advertising

Mordkanin 225

Well, I hated using the unmanaged crap and came up with a way to do it with a form once.

Make a form with a background of a specific color, for example, red. Make a 1px by 1px label that is red, and have it follow your mouse around the form. Use one of the events on the form that monitors the mouse moving over it. Hover? Move? Whatever.

Make another label, but set the first one to the highest z-order. This new label will hold the text you want to display. (Or you can override OnPaint and draw on the new form that way. It doesn't matter.)

There we go. You have an OSD, and you can still click through the text, thanks to the 1x1 transparent label.

You can add a timer, position it how you want, autosize, whatever.

Share this post

Link to post

Share on other sites

0

Vorenus 0

Vorenus 0

Well, I hated using the unmanaged crap and came up with a way to do it with a form once.

Make a form with a background of a specific color, for example, red. Make a 1px by 1px label that is red, and have it follow your mouse around the form. Use one of the events on the form that monitors the mouse moving over it. Hover? Move? Whatever.

Make another label, but set the first one to the highest z-order. This new label will hold the text you want to display. (Or you can override OnPaint and draw on the new form that way. It doesn't matter.)

There we go. You have an OSD, and you can still click through the text, thanks to the 1x1 transparent label.

You can add a timer, position it how you want, autosize, whatever.

Thanks this seems to work. I'll be using this until I find a more elegant way of doing things.