How can i eliminate the flicker, but preserve the bitblt'ed transparency effect. I had to make the picturebox to be invisible, to copy the area behind it, otherwise the area will be the picturebox, not the webbrowser control!
Any ideas are welcome
It seems like a subclassing is a way, but there should be something else!
Last edited by Jim Davis; Nov 20th, 2008 at 08:06 AM.
There is a much simplier way of doing it. A UserControl have the MaskColor and MaskPicture properties that is used if the BackStyle is set to Transparent. So by adding a PictureBox to a UserControl and set the BorderStyle to None, the BackColor to some rarely used color. the Visible property to False, and the AutoRedraw property to True you can do the following:
Set the MaskColor of the UserControl to the BackColor of the PictureBox. Set the BackStyle to Transparent. Add the properties you need, like Caption, ForeColor, and Font to the UserControl and add a Redraw Sub to it that you call whenever any of these properties is changed. In this sub print the caption text on the PictureBox. Size the PictureBox to the same size as the UserControl and then set the MaskPicture and Picture properties to the Image property of the PictureBox.
You can see all of this in the attached demo project. I had to remove the background image I had for the Form to allow it to be uploaded, but you can simply set the Picture property of the Form to see the effect (or place this label control above a webbrowser control).
Well, if you see anti-aliasing as a problem you have to do it some other way. But why in the name of everything that is holy would you want to use an anti-aliasing font in this case?
Windows and Macintosh have always taken different approach to font rendering. For Mac they think that the most important factor is WYSIWYG, it should look exactly the same way on the screen as it does in print, and taken account to the fact that Mac have traditionally been used mainly for desktop publishing this makes perfect sense. Windows have gone the other way and thinks that the readability on the screen is more important than having an exact duplication of the look between the screen and the printed result.
In this case the label was supposed to be placed above a WebBrowser (for some reason) and that can't be because the user wants to print the result. The most important here must be that the label is clear and easy to read, which it must be because the background can be very cluthered depending on what the web page looks like.
Mars base one Username: Jim Davis Password: yCrm33
Posts
1,284
Re: Eliminate flicker ?
OK, i agree, the best readability is on a white paper with black letters, thats just right. But in the world of MultiMedia we live in now, the readability is just important as the look and feel! OK, its not an important thing how a font look like, but theres an even more important reason of aliasing! On a paper, you can get a 300/600 dpi printed font, that is got very smooth curves and lines, but nice sharp edges, that is just perfect for the human brain to interpret what is it see, you can read it fast, and easily. On an LCD display, theres only 72/96 dpi that is just the third or sixth of it. To make the text easy to read, the antialiased text is a pretty much acceptable way. Yes, you can read the high-contrast-look rough pixeled curves, that is the all-time-miracle of our brain! But. tell me now "why in the name of everything that is holy would you want to" crack up your eyes, then read these texts slower, because the brain have to pattern match "umm, what is this thing just look alike"?
You have to agree that, the cleartype font rendering is a nice feature of these new windows OS's, that is just fairly improve the readability! Ok, and i also saw this feature in the older Adobe Readers, just before XP came out!
Now i cant imagine, how an Apple can display a 600 dpi font on a lower resolution monitor. Think, they are also use the same aliased rendering methods, that not much differ than the windows cleartype thing.
Just look at here, the same text, with alias enabled/disabled. Which one you can read better and ease?
Last edited by Jim Davis; Nov 21st, 2008 at 06:57 AM.
Reason: Example image attached
I'm not interested in a discussion if anti-aliasing for a font showed on screen is good or bad. I just said that for the particular question you linked to it's not necassary to use anti-aliased font rendering, my quick and simple solution removes the flickering and that what you asked for.
For readability on screen I still say that using anti-aliasing decrease readability. Your little screen shot doesn't do justice since there is not enough text. Have a look at the screen shots of Google displayed with and without anti-aliasing and judge for yourself.
Last edited by Joacim Andersson; Nov 21st, 2008 at 07:20 AM.