(cdc* PDC, cwnd* pwnd, UINT nCtlColor){Hbrush HBR = Cdialog::onctlcolor (PDC, pwnd, nCtlColor);return HBR;return m_brush;}
Of course, the function is also predefined in the. h file, where the background color of the dialog box is all blue.
2, if we want to set a dialog box control background and text color, as long as the above return m_brush;
if (Pwnd->getdlgctrlid () ==idc_line_style){Pdc->settextcolor (
As needed, the background color of the GroupBox control and the text control static is set to match.
Set GroupBox background color in Onctrlcolor:
if (Pwnd->getdlgctrlid () ==idc_g) {//groupbox background colorCRect RC;GetDlgItem (Idc_g)->getclientrect (RC);Pdc->fillsolidrect (Rc,rgb (70,219,182));}
if (Pwnd->getdlgctrlid () ==idc_static1) {//static background colorPdc->setbkcolor (RGB (70,219,182));}
Set the effect after:
There is a white background does not meet the requirements:
Need to add
The MFC 4.2 (Visual Studio 6) is easy to implement by simply processing the WM_CTLCOLOR message under the dialog box class, and then the following code:
Copy Code code as follows:
Hbrush Calphaeditboxdlg::onctlcolor (cdc* PDC, cwnd* pwnd, UINT nCtlColor)
{
Hbrush HBR = Cdialog::onctlcolor (PDC, pwnd, nCtlColor);
Todo:change any attributes to the DC here
Pdc->setbkmode (Transparent);
The MFC class library providesCwnd::OnctlcolorFunction. This member function is called when the child window of the working framework is re-painted.Wm_ctlcolorMessage response function. prototype of this function:Afx_msg hbrush onctlcolor (CDC * PDC, cwnd* Pwnd, uint nctlcolor );
ParametersNctlcolor Used to specify the control type, which can be:. Ctlcolor_btn Button Control. Ctlcolor_dlg Dialog Box. Ctlcolor_Edit Edit box. Ctlcolor_listbox List controls. Ctlcolor_msgbox Message Control.
Recently, when I made a checkbox transparent, I encountered a cbutton re-painting. There were many posts on the Internet about this problem and there were many implementation methods.
Here we will only talk about some problems and solutions I have encountered in actual operations.
1. When the wm_ctlcolor is reloaded in the form to achieve transparency, in some systems that use the XP style, the checkbox has a dark background color and does not really achieve the transparency effect, the specific
OnCtlColorThe specific is:1. Set a background brush in the header file
Public
CBrush M_BRUSHBK;
2, add the following sentence in the OnInitDialog
Todo:add Extra initialization here
CBitmap bmp;
Bmp. LoadBitmap (IDB_BITMAP_TEMPBK);
M_brushbk.createpatternbrush (bmp);
M_brushbk.createsolidbrush (RGB (0,255,0)); Use solid color as background
Bmp. DeleteObject ();
3. Return background brush in OnCtlColor function
Hbrush Cxxxxxdlg::onctlcolor (
Here are three ways to implement the default background color for changing dialog boxes: (1) You can set the background color of the update dialog box in Clotteryapp::initinstance () Call SetDialogBkColor (RGB (160,32,240)) That is, you can change the background color Note that the color drawn here is for all dialog boxes in the program SetDialogBkColor (RGB (0,0,255), RGB (255,0,0)); Previous RGB is the background color, the latter RGB is the text colors (2) You can also clotteryd
respond to the actual request, or a message that needs to be pushed to the client.handle_sync_event ({send_xml,packet},_from,statename, #state {http_receiver= undefined} = statedata)Output= [Packet |Statedata#state.output], Reply=OK, {reply, reply, statename, Statedata#state{output=Output}}; Handle_sync_event ({send_xml, Packet}, _from, StateName, Statedata)-Output= [Packet |Statedata#state.output], Cancel_timer (statedata#state.timer), Timer=Set_inactivity_timer (Statedata#state.pause, stateda
The MFC Class Library provides the Cwnd::onctlcolor function, which is called when the child window of the working frame is redrawn. Therefore, you can overload the response function of the wm_ctlcolor message. The prototype of this function:afx_msg hbrush OnCtlColor (CDC *pdc,cwnd *pwnd,uint nCtlColor);The parameter nctlcolor is used to specify the type of control, which can be:. ctlcolor_btn Button controls. ctlcolor_dlg dialog box. Ctlcolor_ edit box. ctlcolor_listbox List control. ctlcolor_m
Overrider onctlcolor for wm_ctlcolor for your dialog like following to Set background and text color:
E.g.
Hbrush cmydlg: onctlcolor (CDC * PDC, cwnd * pwnd, uint nctlcolor){Hbrush HBr = cdialog: onctlcolor (PDC, pwnd, nctlcolor );If (pwnd-> m_hwnd = getdlgitem (idc_text)-> m_hwnd) // use static ID of your static text Control{PDC-> setbkcolor (RGB (255, 0, 0); // red backgroundPDC> settextcolor (RGB (255,255,255); // white textReturn
;Cpaintdc DC (this );Getclientrect (rect );DC. fillsolidrect (rect, RGB (0,255, 0 ));//Set to green
Cdialog: onpaint ();}
----Method 3: OverloadOnctlcolor (CDC * PDC, cwnd * pwnd, uint nctlcolor), That isWm_ctlcolorMessage. The specific steps are as follows (the above project prevails ): ----①InCexampledlgdlgIn the header file, addCbrushMember variables:
Class cexampledlgdlg: Public cdialog{...Protected:Cbrush m_brush;...};
----②InOninitdialog ()Add the following code to the function: Bool cexa
discarded, what is it instead?The WM_CTLCOLOR message is used to complete setting the background and font color for controls such as edit, STATIC, button,Automatic generation of the OnCtlColor () function using the Class wizardThis function sets the desired color and then returns a brush handle to redraw the control background color. The onctlcolor () function handles the control's background color by capturing the corresponding control message. Common types of such messages are:ctlcolor_dlg di
As far as I know. Apex 4.x is not provided with an editable interactive reporting component. This needs to be implemented manually.In fact, this is not very complicated, just a few simple steps.1. Create a interactive report based on the wizard. Query statements can be as follows.
Select Apex_item.hidden (1,e.id) | | E.name as Staff, Apex_item.select_list_from_lov (p_idx=>2,p_value=>e.department_id,p_lov=> ' lov_department ') as department from employee E;
The key here
1. Change the iconCopy the icon to the resource file, load the project, and set the ID.In the dialog constructor, modify the icon's ID.Iconcmfc_framedlg::cmfc_framedlg (cwnd* pparent/*=null*/): CDialog (Cmfc_framedlg::idd, pparent) {M_hIcon = AfxGetApp ()->loadicon (idi_mainframe); Change to New icon ID}2. Direct Skin ChangeSkinshape tools SkinH.dll Skinh.; The IB Skinh.she SkinH.h are copied to the project catalog.Add in StdAfx.hdialog box is called before the add3. Change the backgroundFirst
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service