WIN32编程,如何添加控件

如何在已建立的窗口上添加单选按钮控件?希望高人指点下... 如何在已建立的窗口上添加 单选按钮 控件?希望高人指点下 展开
 我来答
80km
推荐于2016-12-02 · TA获得超过101个赞
知道答主
回答量:61
采纳率:100%
帮助的人:0
展开全部
添加控件的话 可以用CreateWindow 来创建 所有的控件都可以看成是子窗口
例如创建一个按钮:
CreateWindow("button","name",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
0,0,
100,20,
hWnd,
(HMENU)ID_CLOSE,
GetModuleHandle(NULL),
NULL);
上面是创建一个按钮
第一个参数必须是下面的几个
BUTTON
Designates a small rectangular child window that represents a button the user can click to turn it on or off. Button controls can be used alone or in groups, and they can either be labeled or appear without text. Button controls typically change appearance when the user clicks them. For more information, see Buttons.

For a table of the button styles you can specify in the dwStyle parameter, see Button Styles.

COMBOBOX
Designates a control consisting of a list box and a selection field similar to an edit control. When using this style, an application should either display the list box at all times or enable a drop-down list box. If the list box is visible, typing characters into the selection field highlights the first list box entry that matches the characters typed. Conversely, selecting an item in the list box displays the selected text in the selection field.

For more information, see Combo Boxes. For a table of the combo box styles you can specify in the dwStyle parameter, see Combo Box Styles.

EDIT
Designates a rectangular child window into which the user can type text from the keyboard. The user selects the control and gives it the keyboard focus by clicking it or moving to it by pressing the TAB key. The user can type text when the edit control displays a flashing caret; use the mouse to move the cursor, select characters to be replaced, or position the cursor for inserting characters; or use the BACKSPACE key to delete characters. For more information, see Edit Controls.

For a table of the edit control styles you can specify in the dwStyle parameter, see Edit Control Styles.

LISTBOX
Designates a list of character strings. Specify this control whenever an application must present a list of names, such as file names, from which the user can choose. The user can select a string by clicking it. A selected string is highlighted, and a notification message is passed to the parent window. For more information, see List Boxes.

For a table of the list box styles you can specify in the dwStyle parameter, see List Box Styles.

MDICLIENT
Designates an MDI client window. This window receives messages that control the MDI application's child windows. The recommended style bits are WS_CLIPCHILDREN and WS_CHILD. Specify the WS_HSCROLL and WS_VSCROLL styles to create an MDI client window that allows the user to scroll MDI child windows into view.

For more information, see Multiple Document Interface.

RichEdit
Designates a Microsoft Rich Edit 1.0 control. This window lets the user view and edit text with character and paragraph formatting, and can include embedded Component Object Model (COM) objects. For more information, see Rich Edit Controls.

For a table of the rich edit control styles you can specify in the dwStyle parameter, see Rich Edit Control Styles.

RICHEDIT_CLASS
Designates a Rich Edit 2.0 control. This controls let the user view and edit text with character and paragraph formatting, and can include embedded COM objects. For more information, see Rich Edit Controls.

For a table of the rich edit control styles you can specify in the dwStyle parameter, see Rich Edit Control Styles.

SCROLLBAR
Designates a rectangle that contains a scroll box and has direction arrows at both ends. The scroll bar sends a notification message to its parent window whenever the user clicks the control. The parent window is responsible for updating the position of the scroll box, if necessary. For more information, see Scroll Bars.

For a table of the scroll bar control styles you can specify in the dwStyle parameter, see Scroll Bar Control Styles.

STATIC
Designates a simple text field, box, or rectangle used to label, box, or separate other controls. Static controls take no input and provide no output. For more information, see Static Controls.

For a table of the static control styles you can specify in the dwStyle parameter, see Static Control Styles

上面来自MSDN
你创建的时候 注意要加入WS_VISIBLE 和相应的按钮风格
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式