我作了一个IE浏览栏,就像收藏夹那样的,但现在只是一个窗口,这个窗口并不是对话框,想在里面添加几个按钮,如何添加??

解决方案 »

  1.   

    virtual BOOL Create(
       LPCTSTR lpszCaption,
       DWORD dwStyle,
       const RECT& rect,
       CWnd* pParentWnd,
       UINT nID 
    );
     
    Parameters
    lpszCaption
    Specifies the button control's text.dwStyle
    Specifies the button control's style. Apply any combination of button styles to the button.rect
    Specifies the button control's size and position. It can be either a CRect object or a RECT structure.pParentWnd
    Specifies the button control's parent window, usually a CDialog. It must not be NULL.nID
    Specifies the button control's ID.
    Button StylesBS_3STATE   Same as a check box, except that the box can be dimmed as well as checked. The dimmed state typically is used to show that a check box has been disabled.BS_AUTO3STATE   Same as a three-state check box, except that the box changes its state when the user selects it.BS_AUTOCHECKBOX   Same as a check box, except that a check  appears in the check box when the user selects the box; the check  disappears the next time the user selects the box.BS_AUTORADIOBUTTON   Same as a radio button, except that when the user selects it, the button automatically highlights itself and removes the selection from any other radio buttons with the same style in the same group.BS_BITMAP   Specifies that the button displays a bitmap. BS_BOTTOM   Places text at the bottom of the button rectangle. BS_CENTER   Centers text horizontally in the button rectangle. BS_CHECKBOX   Creates a small square that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style).BS_DEFPUSHBUTTON   Creates a button that has a heavy black border. The user can select this button by pressing the ENTER key. This style enables the user to quickly select the most likely option (the default option).BS_FLAT   Specifies that the button is two-dimensional; it does not use the default shading to create a 3-D image. BS_GROUPBOX   Creates a rectangle in which other buttons can be grouped. Any text associated with this style is displayed in the rectangle's upper-left corner.BS_ICON   Specifies that the button displays an icon. BS_LEFT   Left aligns the text in the button rectangle. However, if the button is a check box or radio button that does not have the BS_RIGHTBUTTON style, the text is left aligned on the right side of the check box or radio button. BS_LEFTTEXT   When combined with a radio-button or check-box style, the text appears on the left side of the radio button or check box.BS_MULTILINE   Wraps the button text to multiple lines if the text string is too long to fit on a single line in the button rectangle. BS_NOTIFY   Enables a button to send BN_DBLCLK, BN_KILLFOCUS, and BN_SETFOCUS notification messages to its parent window. Note that buttons send the BN_CLICKED notification message regardless of whether it has this style. BS_OWNERDRAW   Creates an owner-drawn button. The framework calls the DrawItem member function when a visual aspect of the button has changed. This style must be set when using the CBitmapButton class.BS_PUSHBUTTON   Creates a pushbutton that posts a WM_COMMAND message to the owner window when the user selects the button.BS_PUSHLIKE   Makes a button (such as a check box, three-state check box, or radio button) look and act like a push button. The button looks raised when it isn't pushed or checked, and sunken when it is pushed or checked. BS_RADIOBUTTON   Creates a small circle that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style). Radio buttons are usually used in groups of related, but mutually exclusive, choices.BS_RIGHT   Right aligns the text in the button rectangle. However, if the button is a check box or radio button that does not have the BS_RIGHTBUTTON style, the text is right aligned on the right side of the check box or radio button. BS_RIGHTBUTTON   Positions a radio button's circle or a check box's square on the right side of the button rectangle. Same as the BS_LEFTTEXT style. BS_TEXT   Specifies that the button displays text. BS_TOP   Places text at the top of the button rectangle. BS_USERBUTTON   Obsolete, but provided for compatibility with 16-bit versions of Windows. Win32-based applications should use BS_OWNERDRAW instead. BS_VCENTER   Places text in the middle (vertically) of the button rectangle. 
      

  2.   

    你只能动态创建各个按钮了,至于如何创建,用create函数就行了
      

  3.   

    自己Create!
    const RECT& rect 就是你的按钮位置!
      

  4.   

    这个很简单,在h文件里定义一个变量CButton m_Button;
    在Dlialog的OnInitDialog的函数中添加下面代码
    m_button.Create(_T("MyButton"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, CRect( 0,0, 100, 25), this, ID_MYBUTTON );
    要处理点击按钮的事件,要加下面的代码
    WM_MYBUTTON是你自己定义的一个宏,在resource。h文件里面定义
    #define WM_MYBUTTON WM_USER + 1在h文件中添加afx_msg void OnBnClickedMyButton();在cpp文件的BEGIN_MESSAGE_MAP和END_MESSAGE_MAP中间添加
    ON_BN_CLICKED(ID_MYBUTTON, OnBnClickedMyButton);然后在下面实现
    void CMyDialog::OnBnClickedMyButton()
    {
       AfxMessageBox(_T("Clicked"));
    }
      

  5.   

    http://dev.yesky.com/346/2655346.shtml
      

  6.   

    汗你也太懒了吧,在vckbase 里随便下载一些代码例子,看一下就明白,很简单。
      

  7.   

    再白痴的问下,我的窗口是用createwindow创建的,也就是要在这个窗口加按钮