Top left pixel of shape is not drawn
Hi everyone,
I've encountered some weird VB6 behavior, and searching the internet doesn't help much. I doubt that I'm the first with this problem though.
Anyway. Here's how to reproduce it:
1. Create a new VB6 project.
2. Add a new UserControl to the project.
3. Set the BackStyle of this UserControl to 0 - Transparent.
4. Place a rectangle Shape on the UserControl, with, solely for the sake of convenience, Left and Top close to the Left and Top of the UserControl.
5. Don't touch any of the Shape's other properties.
6. Put an instance of the UserControl on the Form and run the project.
The top left pixel of the shape is not drawn. How can this be fixed?
Thanks!
Cooz
Re: Top left pixel of shape is not drawn
An acceptable workaround is the addition of a 1 pixel high and wide line in this top left corner.
Problem solved as far as I'm concerned - although the behavior remains strange.
Kind regards,
Cooz
Re: Top left pixel of shape is not drawn
Interestingly, it seems to only be a problem with the combination of a UC and a shape. It's not just lightweight controls either, as I tried with a label and it works fine. It works fine with a textbox too. It also works fine if you push a line into the top-left corner of a UC.
And, just to say it, a shape works fine if it's not on a UC.
That one is truly a mystery.
Best Regards,
Elroy
EDIT1: A refresh of the shape on the UC doesn't help either. It just repaints it, still with the missing pixel. It's also strange that it's not a problem in the IDE design-mode. It's only during runtime that there's a problem.
Re: Top left pixel of shape is not drawn
Don't know what other controls you plan on adding to that UC. But setting the Windowless property to True fixes that specific problem.
Another option could be to simply use APIs to draw a rectangle, oval, circle.