473,320 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

DrawTextEx does not work

I have a small rectangle into which I want to display a maximum of 2 lines of text. If the text overflows that second line I want to display the ellipse at the end. The problem is the text drawing functions don't draw an ellipse at the end of the text when the text is displayed on two lines, so I have decided to perform 2 seperate DrawText operations to draw it myself. The only problem is, DrawTextEx does not return anything about the draw operation so when I draw that first line of text I do not know where to begin the second

The DrawTextEx() function is documented to have 2 means of providing the information I need, only neither of them work. The first is to look at the uiLengthDrawn member of the DRAWTEXTPARAMS function but it is always incorrect. The value returned is neither the number of characters processed or the total length of the original string. My second attempt was to use the DT_MODIFYSTRING flag but it does not change my string

What must I do to get back the string that was actually displayed? Will it always break the string at a word?
Nov 17 '05 #1
3 2739
Steve,

Your question would be more appropriate in the
microsoft.public.win32.programmer.gdi newsgroup.

If you re-post there, can you also mention which operating systems
this issue applies to, and perhaps show a snippet of stand-alone code
to illustrate your point.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 17 '05 #2
Hi stephen,

Thanks for posting in the community.

From your description, I understand that the DrawTextEx(...) function
doesn't display a two-line string as expected(with an ellipse) in a small
rectangle, please correct me if there is any misunderstand.

First I want to know what's the usage of the DrawTextEx(...) function in
your program, I tested the following code snippet on my side, it seems well:
...
CDC* pdc(this->GetDC());
CRect rc(50,50,220,80);

CString str("TODO: Add your control notification handler code here");
pdc->DrawTextEx(str, &rc, DT_WORDBREAK | DT_END_ELLIPSIS | DT_VCENTER,
NULL);
...
Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

Nov 17 '05 #3
Hi stephen,

How is the problem going?
If your problem still persists and you have more concerns on it, please
feel free to reply this message.
Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jonas | last post by:
This works fine in Win XP but does not work at all in Win 98. Private WithEvents objIExplorer As InternetExplorer I have to do it like this to get it to work in Win 98 Dim objIExplorer As...
3
by: Julian | last post by:
Hi I am trying to update a date field in my table but some how this simple code does not work, I know the select work because if I write the fields, it will show the data from the table but why...
5
by: me | last post by:
I have a Class Library that contains a Form and several helper classes. A thread gets created that performs processing of data behind the scenes and the Form never gets displayed (it is for debug...
22
by: Robert Bralic | last post by:
CAN anybody tell me any address where I can download some small(1000-2000) lines C++ proghram source. Or send me ,a small(1000-2000) lines C++ program source that I can compille with gpp under...
12
by: Frank Hauptlorenz | last post by:
Hello Out there! I have a DB2 V7.2 Database (Fix11) on Win 2000 Professional. It was before a NT 4 based Domain - now it is a Win 2000 Domain. The database server is a domain member. Now...
0
by: Jarod_24 | last post by:
How does tabindex work in ASP .net pages I dosen't seem to work quite like in regular forms. and there isn't any TabStop property either. 1 .How do you prevent a control form beign "tabbed"....
5
by: Andy Fish | last post by:
Hi, I have an asp.net web application which uses a pop-up form that works a bit like a dialog box. when the user clicks "OK" it does a postback (basically a form post if you don't know .net) to...
14
by: webEater | last post by:
I have a problem, it's not browser specific, and I don't get a solution. I have an (X)HTML document, I show you a part of it: .... <!--<div class="pad">--> <div id="eventImages"><img src=""...
1
by: =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post by:
I get the above error in some of the ASP.NET web applications on a server, and I need some help figuring out how to deal with it. This is a rather long post, and I hope I have enough details that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.