Tech Support > Microsoft Windows > Development Resources > TextOut-Question
TextOut-Question
Posted by Matthias Matker on September 24th, 2007


Hello together,

with this simple sheet of code, I draw simple text to the windows's dc.

(WindowProc)
....
case WM_PAINT:
dc = BeginPaint(hWnd, &ps);
TextOut(dc, 100, 100, "test", 4);
EndPaint(hWnd,&ps);
return 0;
break;
....


This works of course, but the text is, however, not markable with the mouse, so far, "copy&paste" doesn't work.

Any how to get marking to work?

thanks

c ya

Posted by Scott Seligman on September 24th, 2007


Matthias Matker <kernkoenig@arcor.de> wrote:
You're either going to need to write quite a bit of code to handle the
mouse events, updating your application's window to show selection,
and possible create a pop-up menu and handle some keyboard events to
get copy and paste to work.

On the other hand, instead of drawing the text directly, if you just
used CreateWindow to create a static or text box window and display
the text in that window, the common control will do all of this work
for you.

--
--------- Scott Seligman <scott at <firstname> and michelle dot net> ---------
The American Republic will endure, until politicians realize they can
bribe the people with their own money.
-- Alexis de Tocqueville

Posted by Matthias Matker on September 24th, 2007


Scott Seligman schrieb:
Thanks for your quick reply.

Befor I use the STATIC:

Is it possible to draw the Text in a static in different colors?
E.G. the word "test": All "t"s should be red, the rest blue, etc.
Is this possible?

c ya


Posted by Scott Seligman on September 24th, 2007


Matthias Matker <kernkoenig@arcor.de> wrote:
Yes, apply the SS_OWNERDRAW to the static control and handle the
WM_DRAWITEM message that the static will generate to draw the text
however you'd like.

--
--------- Scott Seligman <scott at <firstname> and michelle dot net> ---------
The most difficult thing in the world is to know how to do a thing
and to watch someone else do it wrong without comment.
-- Theodore H. White

Posted by Matthias Matker on September 25th, 2007


Scott Seligman schrieb:
Thank you, I will try it.

c ya


Posted by Sten Westerback \(MVP SDK 2005-6 :\) on September 26th, 2007



"Matthias Matker" <kernkoenig@arcor.de> wrote in message
news:46f8f501$0$7693$9b4e6d93@newsspool2.arcor-online.net...
you can also opt to use a "EDIT" instead and make it RichText variant for
more formatting control. You could remove border to make it staticlike but
then again, text that you want to be selectaböe should give feedback to that
effect.

- Sten




Similar Posts