1、edit control实时显示最新数据,向下滚动
1. Cpublic
::strData
.Format(_T("四边形外的点的个数:0 \r\n"));
2. Cpublic
::curText
+= Cpublic
::strData
;
3. result_data
.SetWindowText(Cpublic
::curText
);
4. result_data
.LineScroll(MAXINT_PTR
);
5.
6.
2、设置进度条颜色
1. if ((pWnd
->GetDlgCtrlID() == IDC_EDIT1
))
2. {
3. pDC
->SetTextColor(RGB(0, 0, 0));
4. pDC
->SetBkMode(TRANSPARENT
);
5. return HBRUSH(GetStockObject(HOLLOW_BRUSH
));
6. }
3、MFC里怎样让check box在初始状态的时候就打上勾
1.
2. ((CButton
*)GetDlgItem(IDC_CHECK2
))->SetCheck(TRUE
);
3. ((CButton
*)GetDlgItem(IDC_CHECK3
))->SetCheck(TRUE
);
4. ((CButton
*)GetDlgItem(IDC_CHECK4
))->SetCheck(TRUE
);
5. ((CButton
*)GetDlgItem(IDC_CHECK6
))->SetCheck(TRUE
);
4、软件窗口默认最小化,
初始化里ShowWindow(SW_MINIMIZE)改为ShowWindow(SW_SHOW)
1.
2. ShowWindow(SW_SHOW
);
5、MFC更换系统图标ICON
6、加载文件
1. Cpublic
::jia
= 0;
2. CFileDialog
dlgOpen(TRUE
,
3. 0,
4. 0,
5. OFN_HIDEREADONLY
| OFN_FILEMUSTEXIST
,
6. "All Files(*.*)|*.*||",
7. NULL);
8. if (dlgOpen
.DoModal() == IDOK
)
9. {
10. Cpublic
::strFile
= dlgOpen
.GetPathName();
11. Cpublic
::jia
= 1;
12. }
13. else {
14. Cpublic
::jia
= 0;
15. return;
16. }
17. CString strInfo
;
18. CString curText
;
19. if (Cpublic
::jia
)
20. {
21. strInfo
.Format(_T("文件加载成功!\r\n"));
22. curText
+= strInfo
;
23. information_printf
.SetWindowText(curText
);
24. }
25. else
26. {
27. strInfo
.Format(_T("文件加载失败!\r\n"));
28. curText
+= strInfo
;
29. information_printf
.SetWindowText(curText
);
30. }
7、添加弹框/提示框
1. INT_PTR nRes
;
2. jiazai jiazai
;
3. nRes
= jiazai
.DoModal();
8、窗口最大化、最小化
转载请注明原文地址:https://tech.qufami.com/read-2190.html