Prev: VC++
Next: "Problems"
From: Peter Olcott on
What is the Windows Presentation Foundation equivalent of
the original Win32 API function TextOut()?

BOOL TextOut(
HDC hdc, // handle to device context
int nXStart, // x-coordinate of starting position
int nYStart, // y-coordinate of starting position
LPCTSTR lpString, // pointer to string
int cbString // number of characters in string
);



From: Seetharam on
WPF is a different paradigm... not like GDI.
You would typically have a "Label"/"Content" element and you woudl
assign the "Text" property with the text you want.

-Seetharam
From: Peter Duniho on
Peter Olcott wrote:
> What is the Windows Presentation Foundation equivalent of
> the original Win32 API function TextOut()?

AFAIK, there is no WPF-specific API for that. WPF has a declarative
object model, not an imperative model. To display text, you have to
create a text output object (e.g. Label) and place it in the appropriate
place within your visual data structures.

That said, I believe that there's nothing to stop you from using either
the Graphics.DrawString() method or the TextRenderer.DrawText() method,
assuming that you do in fact have a Graphics instance to work with or
equivalent.

Pete
From: Andy O'Neill on

"Peter Olcott" <NoSpam(a)OCR4Screen.com> wrote in message
news:OoOdnc505ZPHFOjWnZ2dnUVZ_qednZ2d(a)giganews.com...
> What is the Windows Presentation Foundation equivalent of the original
> Win32 API function TextOut()?
>
> BOOL TextOut(
> HDC hdc, // handle to device context
> int nXStart, // x-coordinate of starting position
> int nYStart, // y-coordinate of starting position
> LPCTSTR lpString, // pointer to string
> int cbString // number of characters in string
> );
>

What do you want to achieve?

To put a piece of text in a specific part of the screen is a rather strange
requirement for WPF.

You could do it by having a canvas that covered the enture screen,
Add a textblock as a child.
Whack your text in .
Position the text box.
Make it on top of everything else.
Done.

From: Peter Olcott on

"Andy O'Neill" <aon14nocannedmeat(a)lycos.co.uk> wrote in
message news:jIidn.44311$zD4.38578(a)newsfe19.ams2...
>
> "Peter Olcott" <NoSpam(a)OCR4Screen.com> wrote in message
> news:OoOdnc505ZPHFOjWnZ2dnUVZ_qednZ2d(a)giganews.com...
>> What is the Windows Presentation Foundation equivalent of
>> the original Win32 API function TextOut()?
>>
>> BOOL TextOut(
>> HDC hdc, // handle to device context
>> int nXStart, // x-coordinate of starting position
>> int nYStart, // y-coordinate of starting position
>> LPCTSTR lpString, // pointer to string
>> int cbString // number of characters in string
>> );
>>
>
> What do you want to achieve?
>
> To put a piece of text in a specific part of the screen is
> a rather strange requirement for WPF.
>
> You could do it by having a canvas that covered the enture
> screen,
> Add a textblock as a child.
> Whack your text in .
> Position the text box.
> Make it on top of everything else.
> Done.

I want to put text on the screen so I can build my
deterministic finite automaton glyph recognizer.
www.OCR4Screen.com

One aspect of this that I think the .NET platform may make
simpler is handling Unicode, is this correct?

If not, then the only reason (that I can currently see) is
to use WPF is for the promised graphics hardware
acceleration.


 |  Next  |  Last
Pages: 1 2 3
Prev: VC++
Next: "Problems"