Article View: borland.public.cppbuilder.nativeapi
Article #8897Re: Can't paint a static text
From: Bob Gonder
Date: Tue, 31 Aug 2004 02:03
Date: Tue, 31 Aug 2004 02:03
38 lines
2212 bytes
2212 bytes
Ed Mulroy [TeamB] wrote: >It's been so long since I played with dialog boxes that I'm rusty and >I'm having trouble painting a static text control. Anyone have a clue >as to what I am doing wrong? (This is all API code, no VCL.) > >The dialog box is a simple *.RC file dialog with a couple of static >texts, a combo, a checkbox and three buttons. Wait, a minute. you are trying to paint a static text control? I don't think so. TextOut, brushes, et al are for canvases. case(WM_PAINT): SendDlgItemMessage(hDlg,CM_Ctrl_ID,WM_SETTEXT,0,(LPARAM)"NewText"); See also (just found these, never used them): WM_CTLCOLORBTN WM_CTLCOLORDLG WM_CTLCOLORSTATIC and several others. case(WM_CTLCOLORSTATIC): HDC h = (HDC)wParam; HWND w = (HWND(lParam); return (HBRUSH); I assume you will get one of these for each static on the dialog. So if you want different colors, you'll need to use the hwnd to decide which control you are working with somehow..... You could also do away with the statics, and just use TextOut in WM_PAINT. You didn't say how big those white lines were. I assumed they were the text background. If they were small lines, like outline, or borders...turn off the control's borders.
Technical Details
Message-ID:
<s7l7j0dc95jakb7hl4u1aff0b1iie7ql9c@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4133ad5e@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,a073ad797ba72502 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Can't paint a static text Date: Mon, 30 Aug 2004 19:03:32 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <s7l7j0dc95jakb7hl4u1aff0b1iie7ql9c@4ax.com> References: <4133ad5e@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 69.34.99.183 X-Trace: newsgroups.borland.com 1093917808 69.34.99.183 (30 Aug 2004 19:03:28 -0700) Lines: 40 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail