Re: Question regarding SetROP2 and font text output.
- From: "Joe Butler" <ffffh.no.spam@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 24 Sep 2007 16:58:15 +0100
If that don't work, and you'll need it regardless, try compositing the
resultant bar and text in an off-screen dc (where you can blit the text to
the background using an xor operation) and the blitting the result to the
display.
"SmilingJoe88" <SmilingJoe88@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C3D57AA1-30C4-4262-9911-B8645AF88974@xxxxxxxxxxxxxxxx
Ok, I'll give the NONANTIALIASED_QUALITY A shot.
I figured that the MFC was pretty much just a bunch of object oriented
wrappers to Win32, but good to get confirmation on that.
As far as the style guildlines go, I'll be making the text an option - so
it
will be up to the user of the control whether to display it or not.
Personally, I like to display it - and having the option to hide it as
well.
If the quality modifier doesn't do it - I'll play around with shoe-horning
the MFC solution into it.
Thanks again for responding back to me Joe - it's good to get confirmation
on these things. Most of my C# experience has been with ASP.Net, so
programming Windows Forms is still somewhat new to me.
Take care.
"Joe Butler" wrote:
I don't do c#, just Win32 (and MFC if I have to).
It may look horrible if you xor the text due to the output being in clear
type or otherwise smoothed.
You should look at creating your font with NONANTIALIASED_QUALITY in the
fdwQuality field of CreateFont. That should give you a better looking
xor.
The other day, I noticed in the Vista UI guidlines that Microsoft suggest
that you don't overprint a percentage disply on a progress bar.
I can't say I ever remember having to output xor text, but yes, it looks
like SetRop is not applicable to text out functions.
So, check out the non-antialiased font. Also, most of MFC is really a
wrapper around the core Win32 API calls. So, if you find the critical
thing
in the MFC that gives you xor text in the way you like, there'll likely
be a
direct Win32 equivalent.
"SmilingJoe88" <SmilingJoe88@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5983FA6E-00E8-4383-8777-BA292D933AC2@xxxxxxxxxxxxxxxx
Thanks for responding Joe, I guess I was a little vague about my
required
results.
As far as my ability level, pretty good with C# (been coding with it
primarily for over 2 years now), somewhat familiar with C++, and almost
a
complete newb when it comes to Win32/MFC.
Attempting to XOR text onto the screen so that the text would be almost
always visible regardless of background color. This is for a C#
progress
bar
control I am attempting to build. I realize that there are literally
hundreds
of these controls out there and freely available, but I would like to
create
my own for personal use and experience.
Would have liked the entire control to be managed code, but having
difficulty in finding C# code to produce the text output results I
desire.
From what I have read, C# does not provide any mechanism for raster
operations, which I believe it is what I am looking for. As such, it is
my
understanding I would have to use Interop to access Win32 GDI library
calls
directly. This would allow me to use SetROP2.
In my testing I have found that SetROP2 appears to be only applicable
with
Paths, or graphic specific calls (create a line, rectangle, etc). It
appears
to have no impact on TextOut or DrawText, unless the calls are inside
of a
Begin/EndPath block and are displayed using Brushes. Unfortunately,
this
causes the fonts to be displayed in a very unclean manner unless the
font
point sizes are rather large.
Is there a better way to skin this cat using GDI? I realize that I
should
most likely post this question in the C# forum as well, but given what
I've
read so far, this is something that was just not integrated into
version
1.1
of the .NET framework.
After again looking on CodeProject last last night, I have found
another
Progress Bar control example that appears to produce the result I am
looking
for. However it uses MFC and I am not entirely sure if Interop will
work
with
MFC calls. Regardless, the example is located at:
http://www.codeproject.com/miscctrl/text_progressctrl.asp
As you can see, the text over the background where the progress bar has
not
reached yet is rendered in black, while the text over the progress bar
is
rendered in white.
Going to play around with this example a bit, and see if I can
integrate
it
into a custom DLL to be called via Interop. If this method is just
completely
down the wrong track, please feel free to point me in the right
direction.
Thanks again for responding back.
"Joe Butler" wrote:
What _exactly_ are you tryining to do? You might be a beginner
without a
clue or experienced and know what you are doing, but it's difficult to
know
for sure.
If you just want to guarantee that you can read some text on, an
unknown
background, get the text extent, then output a rectangle of this
extent,
perhaps with a bit of an extended border, and then output the text.
Are you trying to xor the text or something similar?
Perhaps you just want to use transparent text drawing?
Is the background a solid colour? Is it a system colour?
etc. etc.
"SmilingJoe88" <SmilingJoe88@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
news:DCA83148-CAB3-4001-8D6F-35E6FF237537@xxxxxxxxxxxxxxxx
Trying to display text regardless of background color. Found an
example
for
using SetROP2 with CreateSolidBrush and TextOut. Problem is that the
text
appears horrible when not displayed in a large font size.
Is there a way to perform a raster operation using TextOut/DrawText
only,
without having to utilizie BeginPath/EndPath and Stroke/Fill
operations?
When I attempt to use SetROP2 with just TextOut/DrawText, it
appears
to
have no impact on the color of the displayed text.
If an example is needed, just let me know and I'll post a follow up.
Thanks for any input anyone might have on this issue - this has been
an
ongoing problem for the better part of two weeks now.
.
- References:
- Re: Question regarding SetROP2 and font text output.
- From: Joe Butler
- Re: Question regarding SetROP2 and font text output.
- From: SmilingJoe88
- Re: Question regarding SetROP2 and font text output.
- From: Joe Butler
- Re: Question regarding SetROP2 and font text output.
- From: SmilingJoe88
- Re: Question regarding SetROP2 and font text output.
- Prev by Date: Re: Question regarding SetROP2 and font text output.
- Next by Date: Re: Question regarding SetROP2 and font text output.
- Previous by thread: Re: Question regarding SetROP2 and font text output.
- Next by thread: Re: Question regarding SetROP2 and font text output.
- Index(es):
Relevant Pages
|