MFC一些控件的基本用法
1.edit control
显示汉字
CString str_hege = "否";
SetDlgItemText(IDC_EDIT5, str_hege);
显示数字
int m ;
CString str_m;
str_m.Format(_T("%d"), m);
SetDlgItemText(IDC_EDIT4, str_m);
显示文件路径
string path; //path1 = "E:\\daoju\\骨料图片\\2\\1.jpg";
CString pathname;
pathname = path.c_str();
SetDlgItemText(IDC_EDIT2, pathname);
2. list box
右键单击控件,选择添加变量,声明控件变量的类别为Control,变量类型为CListBox,变量名为m_ListBox_Content.
CString pathname;
m_ListBox_Content.AddString(pathname);
3.picture control
pc显示iplimage格式图片比较麻烦,需要和mat格式转换
mat转iplimage
IplImage*TheImage = NULL;
if (TheImage) cvReleaseImage(&TheImage);
TheImage = cvLoadImage("E:\\daoju\\骨料图片\\2\\216.bmp");
Mat img = cvarrToMat(TheImage, true);
iplimage转mat
Mat img;
IplImage imgTmp = img;
IplImage *Image = cvCloneImage(&imgTmp);
转来转去容易出错,可以使用下面的方法,把mat格式的imshow在pc上
4.简单的弹窗
CString str3="刀具合格";
MessageBox(str3);