📄 wpw_wapi_ctrl_95.html
字号:
<HTML>
<HR><A NAME=WINAPI_BUTTON_BITMAP_BCC>
Return to <a href="wpw_wapi_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: Bitmap Button with BC++</H4><PRE>
In article <802975079snz@chrism.demon.co.uk>, Chris Marriott <chris@chrism.demon.co.uk> writes:
|> In article <3rfgk6$nt5@Owl.nstn.ca> miker@fox.nstn.ns.ca "mike richards" writes:
|>
|> >In a dialog box that is called from the Help:About menu, I am trying to
|> >display a bitmap that contains a company logo, and possibly a picture
|> >of the programmer. The dialog is created as a resource using the
|> >resource builder. Any ideas how I can add this picture to the dialog?
Three ways I believe will work:
1. Use a Borland bitmap button:
bitmap ID = 3000/5000 + bitmap button ID
2. Put a static control there and subclass it at run time. When
the your control receives WM_PAINT, bitblt() your favourite
bitmap there.
3. Similar to 2 but you don't subclass the control. Instead, you
bitblt() it when your dialog receives WM_PAINT. I personally
fear that this is unsafe since I don't see why Windows has
to send the dialog WM_PAINT if only a part of the static
control is invalidated, although Mr. John Grant said it
was OK.
|> Sorry - can't help. You broke the Golden Rule.
Excuse me. Who made this rule? I don't remember reading
the prohibition of the use of "Windoze" in the newsgroup's
charter.
--
Kent Tong (tongk@arch.su.edu.au)
Freeman Installer==> ftp.arch.su.edu.au /pub/tongk/finst22.zip
Key Center of Design Computing, Sydney University
</PRE>
<HR><A NAME=WINAPI_CTRL_WS_POPUP>
Return to <a href="wpw_wapi_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: why doesn't LBS_OWNERDRAW work with WS_POPUP (not WS_CHILD)?</H4><PRE>
In article <ebohlmanDAop8o.FBE@netcom.com> ebohlman@netcom.com (Eric Bohlman) writes:
>John Grant (jagrant@emr1.emr.ca) wrote:
>: Perhaps my questions have been too long lately: I'll try to shorten them.
>: I posted this one a week ago, but it got ignored by everybody.
>
>: If I create an LBS_OWNERDRAW | WS_CHILD window with a dialog box as a parent,
>: it works just fine: the dialog box gets WM_MEASUREITEM/WM_DRAWITEM.
>
>: If I create an LBS_OWNERDRAW | WS_POPUP window with a dialog box as a parent,
>: it doesn't work - my dialog box never gets WM_MEASUREITEM/WM_DRAWITEM.
>: WinSight tells me they are sent to the desktop (HWND_DESKTOP, i.e. NULL).
>
>: Why? In both cases, the dialog box is the parent and the docs say that
>: WM_MEASUREITEM/WM_DRAWITEM is sent to the parent. It appears it only works
>: if it is a child of the dialog box, not a 'popup'.
>
>In the second case, the dialog box is the owner, but it's not the
>parent. Only a window with WS_CHILD has a parent. I know I ran across
>an explanation of this behavior (something to do with a field in an
>internal structure being used for two mutually exclusively purposes), but
>I can't remember where.
Ah ha! It didn't occur to me that a 'parent' was not the same
as an 'owner'. Now it makes sense. I should have read it more
carefully... it says messages are sent to the PARENT, not the
OWNER. Children have parents, but non-children (i.e. cars, houses)
only have owners! Of course, dogs have both owners and parents...
Thanks.
--
John A. Grant jagrant@emr1.emr.ca
Airborne Geophysics
Geological Survey of Canada, Ottawa
</PRE>
<HR><A NAME=WINAPI_INIT_LIST>
Return to <a href="wpw_wapi_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: How do I initialise elements of list before popin dialog box</H4><PRE>
In article <3sifbn$6uh@joppa.citr.uq.oz.au> rgupta@nashi (Ram Gupta) writes:
>Hello,
>I am using visual C++ and Windows NT. I have simple question.
>I need to popoup dialog box (modal), which has listbox as one of the control,
>with list box showing few elements.
>I have tried as follows and program is crashing at the time when I am adding
>an item to the list. Appreciate if you could tell me what mistake I am doing
>void CGcwApp::OnGcwFollowup()
>{
> CustFollowup dlg; //Followup dialog
> CstringList* listPtr;
> int count, i;
> listPtr = new CStringList(10);
> if(ReadFollowupFile(FOLLOWUP_FILE_NAME, &count, listPtr)==TRUE){
> for(i=0; i<count; i++) {
> strcpy(buf, (listPtr->GetAt(listPtr->FindIndex(i))));
> dlg.m_followupList.AddString(buf);
> }
> if(dlg.DoModal() == IDOK) {
> TARCE("OK button Pressed\n");
> }
> else
> TRACE("CAncel Button pressed\n");
> }
>}
>/*
>** ReadFollowupFile() function returns the list of lines read from a given file.
>** m_followupList is added as control.
>*/
>Appreciate, your help
>thanks
>with regards
>--ram
You are attempting to add strings to a control which does not (yet) exist -
the dialog box doesn't really exist until "during" the DoModal call!
(This is one of the perils of using a wrapper for the Windows API without
knowing how the underlying system works - you might read "Programming Windows"
by Charles Petzold to get you going.)
Anyway, simply move all your control (listbox in this case) init. code to the
virtual method OnInitDialog, which is called by CDialog objects just before
they become visible to the user.
HTH,
Kit Kauffmann - kitk@mudshark.sunquest.com
AKA 73363,447 (Compu$erve)
Finger me for my public key
</PRE>
<HR><A NAME=WINAPI_RTF>
Return to <a href="wpw_wapi_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: RTF Control for Windows</H4><PRE>
In article <3sj0fi$81s@ixnews4.ix.netcom.com>,
booksys@ix.netcom.com (Mark Jones ) wrote:
>Anyone seen any RTF controls available for purchase?
>I got one from Visual Tools or Visual Components, but it's not
>available in source form. I need the source to cross compile to the
>MAC with MS Portability kit.
>
>I would also entertain offers to write said control for money from
>those with suitable talents.
I don't know if this helps but, there is going to be a RTF control and classes
in the next version of Visual C++. Win 95 and Win NT 3.51 will have a built
in RTF control. I don't know how cross compiling to Mac's are done but you
are suppose to be able to port using Visual C++.
Jeffrey V. Simpson
sysdev@cais.com (w)
Office of the Chief Counsel, IRS
The views expressed here are my own and not those of my agency.
I do not in any way speak for the US Government.
<HR>
In article <3sn0p0$e0v@news.cais.com> sysdev@cais.com (Jeffrey V. Simpson) writes:
>In article <3sj0fi$81s@ixnews4.ix.netcom.com>,
> booksys@ix.netcom.com (Mark Jones ) wrote:
>>Anyone seen any RTF controls available for purchase?
>>I got one from Visual Tools or Visual Components, but it's not
>>available in source form. I need the source to cross compile to the
>>MAC with MS Portability kit.
>>
>>I would also entertain offers to write said control for money from
>>those with suitable talents.
>
>I don't know if this helps but, there is going to be a RTF control and classes
>in the next version of Visual C++. Win 95 and Win NT 3.51 will have a built
>in RTF control. I don't know how cross compiling to Mac's are done but you
>are suppose to be able to port using Visual C++.
Does anyone know if there is or will be an API function to output
RTF?, i.e.:
TextOutRTF(hdc,x,y,"..some rtf code...",..);
It sure would be nice to display a string containing subscripts
and superscripts and other fancy stuff like that. At the moment,
it is incredibly awkard just to draw a formula:
H SO
2 4
or a large number:
6
2.3 X 10
Unless of course there is another solution that exists today.
I don't want a control - just a way to put text on the screen.
--
John A. Grant jagrant@emr1.emr.ca
Airborne Geophysics
Geological Survey of Canada, Ottawa
<HR>
In article <3sn0p0$e0v@news.cais.com>, sysdev@cais.com says...
>
>In article <3sj0fi$81s@ixnews4.ix.netcom.com>,
> booksys@ix.netcom.com (Mark Jones ) wrote:
>>Anyone seen any RTF controls available for purchase?
>>I got one from Visual Tools or Visual Components, but it's not
>>available in source form. I need the source to cross compile to the
>>MAC with MS Portability kit.
>>
>>I would also entertain offers to write said control for money from
>>those with suitable talents.
>
>I don't know if this helps but, there is going to be a RTF control and
classes
>in the next version of Visual C++. Win 95 and Win NT 3.51 will have a
built
>in RTF control. I don't know how cross compiling to Mac's are done but
you
>are suppose to be able to port using Visual C++.
>
>
>
>Jeffrey V. Simpson
>sysdev@cais.com (w)
>Office of the Chief Counsel, IRS
>
>The views expressed here are my own and not those of my agency.
>I do not in any way speak for the US Government.
The header file for the RTF (aka Rich Edit) control has a callback for the
MAC allowing to to be used under the Mac with the portability libraries.
You can also send output from the control, formatted etc to a dc (e.g.
print preview.)
There is an example in the MFC section of cimpuserve.
If anyone would like the header file for the control please e-mail me at
the above address or on 100277.2422@compuserve.com
</PRE>
<HR><A NAME=WINAPI_BG_COLOR>
Return to <a href="wpw_wapi_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: How do I change the background color of a control?</H4><PRE>
colsen@nmsu.edu (Christophe W. Olsen) wrote:
> [...] // stuff deleted
>
> Anyway, I've executed the InvalidateRect and the UpdateWindow func-
>tions before the SetBkColor, but the pgm runs the same regardless of those
>functions existance.
>
> [...] // more stuff deleted
>
> hdc = GetDC(GetDlgItem(hOurDlg,IDC_PASSLABEL));
> InvalidateRect(hdc,NULL,TRUE);
> UpdateWindow(hdc);
> dwBackColor = SetBkColor(hdc,RGB(0,0,0));
> ReleaseDC( hOurDlg, hdc);
>
You need to respond to the WM_CTLCOLOR message in order to do this. Every control sends its parent (usually a dialog
box) this message when it comes time to paint. wParam is the DC of the control, HIWORD(lParam) is the type of the control
and LOWORD(lParam) is the window handle of the control. In response to WM_CTLCOLOR you can check HIWORD(lParam) to see if
this is the control type who's color you want to change then just call SetBkColor((HDC)wParam, RGB(0,0,0)), however, this
will only change the color of the text and not the windows color (you will get text surrounded by black in a white window).
If you also want to change the windows color you must return a handle to a brush. A short example:
case WM_CTLCOLOR
if ( CTLCOLOR_EDIT == HIWORD(lParam) )
{
SetTextColor((HDC)wParam, RGB(255,255,255));
SetBkColor((HDC)wParam, RGB(0, 0, 0));
return hbrBlackBrush;
}
return 0;
This code will change all edit controls in the dialog box to white text on black background in black windows.
---------------------------------------------------------------------
Donald K. Forbes e-mail: don@mythos.com
_ _ ____ ___ ___ ___ ___ ___ ____ ___ ___ ___
/ / //__/ / /__// //__ /__ / //__ / / //__/ /__/ /__
/ / / / / //__/___/ ___//__// / /_/_// / / \ /___
"My opinions are mine and not necessarily that of my employer"
---------------------------------------------------------------------
</PRE>
<HR><A NAME=WINAPI_BG_COLOR>
Return to <a href="wpw_wapi_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: How do I change the background color of a control?</H4><PRE>
colsen@nmsu.edu (Christophe W. Olsen) wrote:
> [...] // stuff deleted
>
> Anyway, I've executed the InvalidateRect and the UpdateWindow func-
>tions before the SetBkColor, but the pgm runs the same regardless of those
>functions existance.
>
> [...] // more stuff deleted
>
> hdc = GetDC(GetDlgItem(hOurDlg,IDC_PASSLABEL));
> InvalidateRect(hdc,NULL,TRUE);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -