Button

2016-02-19 12:19 5 1 收藏

下面,图老师小编带您去了解一下Button,生活就是不断的发现新事物,get新技能~

【 tulaoshi.com - 编程语言 】

按钮窗口(控件)在MFC中使用CButton表示,CButton包含了三种样式的按钮,Push Button,Check Box,Radio Box。所以在利用CButton对象生成按钮窗口时需要指明按钮的风格。

创建按钮:BOOL CButton::Create( LPCTSTR lpszCaption, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );其中lpszCaption是按钮上显示的文字,dwStyle为按钮风格,除了Windows风格可以使用外(如WS_CHILD|WS_VISUBLE|WS_BORDER)还有按钮专用的一些风格。

BS_AUTOCHECKBOX 检查框,按钮的状态会自动改变   Same as a check box, except that a check mark appears in the check box when the user selects the box; the check mark 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_AUTO3STATE 允许按钮有三种状态即:选中,未选中,未定   Same as a three-state check box, except that the box changes its state when the user selects it.

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_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_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_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_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.

(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/)

rect为窗口所占据的矩形区域,pParentWnd为父窗口指针,nID为该窗口的ID值。

(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/)

来源:http://www.tulaoshi.com/n/20160219/1600584.html

延伸阅读
方法一 1.放在drawable下的selector.xml文件 代码如下: android="http://schemas.android.com/apk/res/Android"    android:drawable="@drawable/temp2" / 2.布局文件main.xml 代码如下: http://schemas.android.com/apk/res/android"     android:orientation="vertical"     android:layout...
代码如下: package com.demos; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class GetScreenActivity extends Activity { private Button firstBtn = null; private Button secBtn = null; @Override pr...
UIEdgeInsets typedef struct UIEdgeInsets { CGFloat top, left, bottom, right; // specify amount to inset (positive) for each of the edges. values can be negative to 'outset'} UIEdgeInsets; 在UIButton中有三个对EdgeInsets的设置:ContentEdgeInsets、titleEdgeInsets、imageEdgeInsets @property(nonatomic) UIEdgeInsets...
标签: Web开发
代码如下: form onsubmit="aa(this);" input type="text" name="" value="test" /input type="submit" value="提交" / /form iframe src="" name="fA" frameborder="1" scrolling="no"/iframe iframe src="" name="fB" frameborder="1" scrolling="no"/...