Article View: borland.public.cppbuilder.nativeapi
Article #7653Re: DrawTextEx
From: Alan Bellingham
Date: Fri, 31 Dec 2004 14:00
Date: Fri, 31 Dec 2004 14:00
32 lines
1818 bytes
1818 bytes
"Petar Popara" <none> wrote: > > I'm using this code: > >char a[200]; >strncpy(a, cFileName.c_str(), 199); > >RECT r; >r.left = 0; >r.top = 0; >r.bottom = lb->ItemHeight; >r.left = lb->Width - 20; > >if (!DrawTextEx(lb->Handle, a, 199, &r, DT_MODIFYSTRING | DT_PATH_ELLIPSIS, >NULL)) > return; >else > lb->Items->Add(a); > > But, it allways fails. "lb" it TListBox control. Am I doing something >wrong? I don't want to draw anything, just to format string. As JD mentioned, you should be passing the Canvas handle. DrawTextEx wants an HDC. You might want to check the ItemHeight and Width values if this still doesn't work. Alan Bellingham -- ACCU Conference 2005 - 20-23 April, Randolph Hotel, Oxford, UK
Technical Details
Message-ID:
<jomat0104rd0d54otjbmqg0n9t6h7ig7r4@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!213.73.255.4.MISMATCH!newsfeed.multikabel.nl!lightspeed.eweka.nl!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<41d5500e$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,42d3caa052e60398 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: Alan Bellingham <alanb@episys.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: DrawTextEx Date: Fri, 31 Dec 2004 14:00:08 +0000 Reply-To: alanb@episys.com Message-ID: <jomat0104rd0d54otjbmqg0n9t6h7ig7r4@4ax.com> References: <41d5500e$1@newsgroups.borland.com> X-Newsreader: Forte Agent 2.0/32.652 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 193.129.251.130 X-Trace: newsgroups.borland.com 1104501607 193.129.251.130 (31 Dec 2004 06:00:07 -0800) Lines: 32 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!213.73.255.4.MISMATCH!newsfeed.multikabel.nl!lightspeed.eweka.nl!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail