vc6 控件

详见msdn
为控件添加一个控件型变量然后访问之
edit
IDC_EDIT1----m_edit1
void CTest1Dlg::OnButton1() 
{
	// TODO: Add your control notification handler code here
	m_edit1.SetWindowText("hello");
	CString str;
	m_edit1.GetWindowText(str);
	MessageBox(str);
}

//也可以直接使用ID访问
CString str;
int i;
GetDlgItemTextW(IDC_EDIT1,str);
AfxMessageBox(str);
i=GetDlgItemInt(IDC_EDIT1);

 comboboxIDC_COMBO1----m_combo1 
void CTest1Dlg::OnButton1() 
{
	// TODO: Add your control notification handler code here
m_combo1.AddString("hello1");
m_combo1.AddString("hello2");
m_combo1.AddString("hello3");
m_combo1.SetCurSel(2);
int nCount=m_combo1.GetCount();
}

IDC_CHECK1----m_check1
void CTest1Dlg::OnButton1() 
{
	// TODO: Add your control notification handler code here
	m_check1.SetCheck(1);
	bool bl=m_check1.GetCheck();
}

listctrl
IDC_LIST1----m_list1
http://blog.csdn.net/luck_good/article/details/6962545
void CTest1Dlg::OnButton1() 
{
	// TODO: Add your control notification handler code here
    m_list1.InsertColumn(0,"姓名",LVCFMT_LEFT,100);  //增加列
    m_list1.InsertColumn(1,"特长",LVCFMT_LEFT,100);  
    int nItem=m_list1.InsertItem(0,"张3",0) ;  //增加内容
    m_list1.SetItemText(nItem,1,"热爱自然");  
    nItem=m_list1.InsertItem(1,"李4",1) ;  
    m_list1.SetItemText(nItem,1,"热爱祖国");  	
    nItem=m_list1.InsertItem(2,"王5",2) ;  
    m_list1.SetItemText(nItem,1,"热爱老婆"); 

	long lStyle;  
	lStyle=GetWindowLong(m_list1.m_hWnd,GWL_STYLE); 
	lStyle&=~LVS_TYPEMASK;
	lStyle|=LVS_REPORT;//显示类型设为详细
	SetWindowLong(m_list1.m_hWnd,GWL_STYLE,lStyle); 
}

treectrl
IDC_TREE1----m_tree1
http://blog.csdn.net/luck_good/article/details/6962547
void CTest1Dlg::OnButton1() 
{
    // TODO: Add your control notification handler code here
    HTREEITEM hItem;//记录节点位置    
    hItem=m_tree1.InsertItem("文学爱好");//插在根节点    
    m_tree1.InsertItem("古诗",hItem);//插在hItem节点    
    m_tree1.InsertItem("散文",hItem);//插在hItem节点    
    
    hItem=m_tree1.InsertItem("体育爱好");//插在根节点    
    m_tree1.InsertItem("乒乓球",hItem);//插在hItem节点    
    m_tree1.InsertItem("足球",hItem);//插在hItem节点
}





                
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值