DrawText Selected?

Is it ppossible to use the DrawText function to draw text to appear selected or do I have to do this manually by filling the rectangle with the selected text color and then draw the text with the highlight color.
LVL 5
JohnMcCannAsked:
Who is Participating?
 
webJoseConnect With a Mentor Commented:
Nope, I am saying:

SetBkColor
SetTextColor
DrawText
...

Try it.  I think that's enough.
0
 
JanusFuryCommented:
the DrawState function can draw text in various states like it can with icons and bitmaps, I believe it can do a selected state for text.
0
 
JohnMcCannAuthor Commented:
I though the same thing but DrawState seems to be for drawing disabled text and images similar to GrayString
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
JohnMcCannAuthor Commented:
I have also tried DrawCaption
0
 
webJoseCommented:
I think it is not necessary as long as the backcolor and forecolor are correct.  Use SetBkColor and SetTextColor before drawing the text.  Assuming you are not drawing transparent text, the DrawText function should draw the text in a previously drawn rectangle, giving you what you are looking for.
0
 
JohnMcCannAuthor Commented:
Are you saying

SetBkColor
SetTextColor
CalcRect
FillRect
DrawText
SetBkColor
SetTextColor

That is what I am doing but would have liked to reduce that to one line.
0
 
JohnMcCannAuthor Commented:
Ok you missed setting the FontTransparent property to false.

But I've now got it working
0
 
JohnMcCannAuthor Commented:
Thankyou
0
All Courses

From novice to tech pro — start learning today.