Article View: borland.public.cppbuilder.nativeapi
Article #8904Re: Can't paint a static text
From: Ed Mulroy [TeamB]
Date: Tue, 31 Aug 2004 09:06
Date: Tue, 31 Aug 2004 09:06
66 lines
3720 bytes
3720 bytes
Yes, I was painting in a window, in this case a static text window, API code, not VCL or OWL, windows, not "canvases". The control is a window of class "STATIC" and is just used as a window, not used for its controls behavior. You are right, I do not handle several messages when I subclassed but the messages are the ones which set the control's internal values that aren't used here. The TextOut is during WM_PAINT immediately following the FillRect calls. I also handled WM_ERASEBKGND. Depending upon the definition of a macro it wrote directly to the window or wrote to a bitmap in a memory dc and ended by copying that bitmap to the window's dc. With direct writing the flashing appeared as I mentioned. With the memory dc the text appeared but the effects of the FillRect's did not show. The white lines are horizontal, about 2 pixels high, and while they span the whole window, an individual line doesn't necessarily reach all the way across. This started as a 'quicky' program to do something using a dialog as a quick way to define the layout of windows and handle the buttons. Now it's become a pain in the neck because it's not behaving well. As it's something I've not done in a long time, it's become a crusade to conquer whatever it is that I've forgotten. I have found the problem. Buried in the code and unnoticed by me is a call to Rectangle to draw the outline around the window. It came after the FillRect calls and clears the inside. The fight between the FillRect calls and the clearing from the Rectangle call made the flickering white lines I mentioned. . Ed > Bob Gonder wrote in message > news:s7l7j0dc95jakb7hl4u1aff0b1iie7ql9c@4ax.com... > > 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:
<41343fb8@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!newsfeed.icl.net!colt.net!newsfeed.esat.net!zen.net.uk!dedekind.zen.co.uk!news.zanker.org!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4133ad5e@newsgroups.borland.com> <s7l7j0dc95jakb7hl4u1aff0b1iie7ql9c@4ax.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: "Ed Mulroy [TeamB]" <dont_email_me@invalid.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <4133ad5e@newsgroups.borland.com> <s7l7j0dc95jakb7hl4u1aff0b1iie7ql9c@4ax.com> Subject: Re: Can't paint a static text Date: Tue, 31 Aug 2004 05:06:39 -0400 Lines: 69 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 12.161.27.75 Message-ID: <41343fb8@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1093943224 12.161.27.75 (31 Aug 2004 02:07:04 -0700) X-Authenticated-User: edmulroy Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!newsfeed.icl.net!colt.net!newsfeed.esat.net!zen.net.uk!dedekind.zen.co.uk!news.zanker.org!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail