在vc里
要求用滑杆条来实现对话框背景色的渐变
有什么办法吗?
请大家帮我!最好能够给出示范程序
分不够再加

解决方案 »

  1.   

    WM_CTLCOLORDLG
    The WM_CTLCOLORDLG message is sent to a dialog box before the system draws the dialog box. By responding to this message, the dialog box can set its text and background colors using the specified display device context handle. A window receives this message through its WindowProc function. LRESULT CALLBACK WindowProc(
      HWND hwnd,       // handle to window
      UINT uMsg,       // WM_CTLCOLORDLG
      WPARAM wParam,   // handle to DC (HDC)
      LPARAM lParam    // handle to dialog box (HWND)
    );
    Parameters
    wParam 
    Handle to the device context for the dialog box. 
    lParam 
    Handle to the dialog box. 
    Return Values
    If an application processes this message, it must return a handle to a brush. The system uses the brush to paint the background of the dialog box. Res
    By default, the DefWindowProc function selects the default system colors for the dialog box. The system does not automatically destroy the returned brush. It is the application's responsibility to destroy the brush when it is no longer needed.The WM_CTLCOLORDLG message is never sent between threads. It is sent only within one thread. Note that the WM_CTLCOLORDLG message is sent to the dialog box itself; all of the other WM_CTLCOLOR* messages are sent to the owner of the control. If a dialog box procedure handles this message, it should cast the desired return value to an INT_PTR and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored. 
      

  2.   

    改变背景色的函数为:SetDialogBkColor(COLORREF ,COLORREF);
    在projectnameapp::InitInstance()加入该函数即可,
    怎么用滑竿控制颜色的变化?I DON'T KNOW!
      

  3.   

    用滑竿控制颜色的变化估计有点难度吧。没做过。
    改变背景色用SetDialogBkColor()
      

  4.   

    SetDialogBkColor(),确实是很方便
      

  5.   

    你需要重载OnPaint函数,
       有了DC ,你就可以为所欲为了
      

  6.   

    刚才做了一个粗糙的程序,如果需要我发e-mail给你大致思路是重载OnEraseBkgnd消息,用3个slider获得的RGB值FillSolidRect整个客户区,留下你的e-mail.
      

  7.   

    在WM_ERASEBKGND消息里对对话框背景进行处理
      

  8.   

    谢谢zxyin1(zxyin1) (
    我的email:
    [email protected]
      

  9.   

    对话框中有WM_ERASEBKGND消息吗?