Problem with ClearType text in custom control
-
I'm running into a problem that seems like it must be solvable, but I can't find any documentation that explains it. The basics: I have a custom control that uses a bitmap for a background (either created programmatically, or by loading a resource or file). This is done in an off-screen memory DC to avoid flickering. After the bitmap is rendered, I render some text onto it using DrawText() API. When it's done, the whole thing is blitted back onto the screen. The problem: When ClearType is enabled, the text looks ugly, almost as if every letter has a black outline around it. I'm guessing this is the sub-pixel antialiasing stuff, which has somehow turned black when I blit from the memory DC to the screen. Question: how can I allow and use ClearType in my control and still have it look okay? Apps like IE and Firefox handle ClearType correctly, and I'm pretty sure they're using some kind of off-screen double-buffering scheme for drawing, so it seems to me there should be a way to do it. But I'm darned if I can figure out how. Thanks in advance for any help, Warner Young
-
I'm running into a problem that seems like it must be solvable, but I can't find any documentation that explains it. The basics: I have a custom control that uses a bitmap for a background (either created programmatically, or by loading a resource or file). This is done in an off-screen memory DC to avoid flickering. After the bitmap is rendered, I render some text onto it using DrawText() API. When it's done, the whole thing is blitted back onto the screen. The problem: When ClearType is enabled, the text looks ugly, almost as if every letter has a black outline around it. I'm guessing this is the sub-pixel antialiasing stuff, which has somehow turned black when I blit from the memory DC to the screen. Question: how can I allow and use ClearType in my control and still have it look okay? Apps like IE and Firefox handle ClearType correctly, and I'm pretty sure they're using some kind of off-screen double-buffering scheme for drawing, so it seems to me there should be a way to do it. But I'm darned if I can figure out how. Thanks in advance for any help, Warner Young
I had a similar problem the other day, i found the cause was when drawing of screen, I didn't create a compatible bitmap with the main DC. Have a look at how you are implememnting your double buffer, the problem may be there.
-
I'm running into a problem that seems like it must be solvable, but I can't find any documentation that explains it. The basics: I have a custom control that uses a bitmap for a background (either created programmatically, or by loading a resource or file). This is done in an off-screen memory DC to avoid flickering. After the bitmap is rendered, I render some text onto it using DrawText() API. When it's done, the whole thing is blitted back onto the screen. The problem: When ClearType is enabled, the text looks ugly, almost as if every letter has a black outline around it. I'm guessing this is the sub-pixel antialiasing stuff, which has somehow turned black when I blit from the memory DC to the screen. Question: how can I allow and use ClearType in my control and still have it look okay? Apps like IE and Firefox handle ClearType correctly, and I'm pretty sure they're using some kind of off-screen double-buffering scheme for drawing, so it seems to me there should be a way to do it. But I'm darned if I can figure out how. Thanks in advance for any help, Warner Young
Is the bitmap that is selected in the memory dc a bitmap that is compatible with the screen? Or did you just select the bitmap that you created/loaded into the memory dc and try to draw the text that way? Some sample code would help since I don't have any problem drawing cleartype enabled text on my doublebuffered controls.