20号开始学习vc++了,预祝学习成功!

20号开始学习vc++,学会了:

列表框加项目和调整行高:

void CListboxDlg::OnButton1()
{
 // TODO: Add your control notification handler code here
 CListBox * plist=(CListBox*)GetDlgItem(IDC_LIST1);
 char ch[1];
 for(int i=1;i<=10;i++)
  
 {
      _itoa(i,ch,10);
 plist->AddString(ch);
 }
 plist->SendMessage(416,0,50);
}

编辑框读写文本:

void CListboxDlg::OnButton2()
{
char str[255];
 // TODO: Add your control notification handler code here
  CEdit * pedit=(CEdit*)GetDlgItem(IDC_EDIT1);
pedit->SetWindowText("ytytytyty/r/nrytytdytdytdty");
pedit->GetWindowText(str,100);
MessageBox(str);

}

标签读写标题:

void CListboxDlg::OnButton5()
{
 // TODO: Add your control notification handler code here
    CStatic * pStatic=(CStatic*)GetDlgItem(IDC_STATIC3);
   pStatic->SetWindowText("33434");
}

void CListboxDlg::OnButton3()
{
char str[255];
 // TODO: Add your control notification handler code here
   CStatic * pStatic=(CStatic*)GetDlgItem(IDC_STATIC1);
   pStatic->GetWindowText(str,100);
   MessageBox(str);
}

按钮读写标题:

void CListboxDlg::OnButton6()
{
 // TODO: Add your control notification handler code here
     CButton  * pbutton =(CButton *)GetDlgItem(IDC_BUTTON6);
   pbutton->SetWindowText("33434");

}

文本文件写出:

void CMainFrame::OnFileWrite()
{
 // TODO: Add your command handler code here
 int i;
 FILE * pfile=fopen("c://1.txt","a");
 for (i=0;i<=10;i++)
 {
 fwrite("werwetwetwetwetewtewtew/n",1,strlen("werwetwetwetwetewtewtew/n"),pfile);
 };
 fclose(pfile);
}

当然还有信息框使用。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值