UpgradeWnd.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. // 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
  2. // (“Fluent UI”)。该示例仅供参考,
  3. // 用以补充《Microsoft 基础类参考》和
  4. // MFC C++ 库软件随附的相关电子文档。
  5. // 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
  6. // 若要了解有关 Fluent UI 许可计划的详细信息,请访问
  7. // https://go.microsoft.com/fwlink/?LinkId=238214.
  8. //
  9. // 版权所有(C) Microsoft Corporation
  10. // 保留所有权利。
  11. #include <map>
  12. #pragma once
  13. class CUpgradeBar : public CMFCToolBar
  14. {
  15. public:
  16. virtual void OnUpdateCmdUI(CFrameWnd* /*pTarget*/, BOOL bDisableIfNoHndler)
  17. {
  18. CMFCToolBar::OnUpdateCmdUI((CFrameWnd*) GetOwner(), bDisableIfNoHndler);
  19. }
  20. virtual BOOL AllowShowOnList() const { return FALSE; }
  21. };
  22. class CMyEditBrowseCtrl:public CMFCEditBrowseCtrl
  23. {
  24. public:
  25. CMyEditBrowseCtrl() {};
  26. ~CMyEditBrowseCtrl() {};
  27. virtual void OnBrowse(){
  28. CString TempPathName;
  29. CFileDialog dlg(TRUE, NULL, NULL, NULL, m_strFileFilter, NULL, 0, TRUE);
  30. (dlg.m_ofn).lpstrTitle = _T("打开文件");
  31. dlg.DoModal();
  32. /*if (dlg.DoModal() == IDOK)
  33. {
  34. TempPathName = dlg.GetPathName();
  35. SetWindowText(TempPathName);
  36. }
  37. else
  38. return;*/
  39. TempPathName = dlg.GetPathName();
  40. SetWindowText(TempPathName);
  41. }
  42. private:
  43. protected:
  44. //DECLARE_MESSAGE_MAP()
  45. };
  46. class CUpgradeWnd : public CDockablePane
  47. {
  48. // 构造
  49. public:
  50. CUpgradeWnd() noexcept;
  51. void AdjustLayout();
  52. // 特性
  53. public:
  54. protected:
  55. CFont m_fntPropList;
  56. // 路径编辑框;
  57. CStatic m_text_path;
  58. CMFCEditBrowseCtrl m_edit_path;
  59. //CEdit m_edit_path;
  60. // 升级按钮;
  61. CMFCButton m_btnUpgrade;
  62. // ftp用户名;
  63. CStatic m_text_user;
  64. CEdit m_ftp_user;
  65. // ftp密码;
  66. CStatic m_text_password;
  67. CEdit m_ftp_password;
  68. // 是否记住ftp账号密码;
  69. CButton m_check_remember;
  70. // 提示语
  71. CStatic m_text_notify;
  72. // 实现
  73. public:
  74. virtual ~CUpgradeWnd();
  75. // 去掉关闭按钮;但组合多个pane时无效;
  76. virtual BOOL CanBeClosed() const { return FALSE; };
  77. // 禁止拖动Pane;
  78. virtual BOOL FloatPane(CRect rectFloat, AFX_DOCK_METHOD dockMethod = DM_UNKNOWN, bool bShow = true) { return FALSE; }
  79. // 禁用停靠,双击底部无效(不会停靠)
  80. //virtual BOOL CanFloat() const { return FALSE; };
  81. // 禁用大小;//崩溃;
  82. //virtual BOOL IsResizable() const {return FALSE;}
  83. protected:
  84. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  85. afx_msg void OnSize(UINT nType, int cx, int cy);
  86. // 控件事件;
  87. afx_msg void OnUpgradeBtnClick();
  88. afx_msg void OnUpdateBtnUpgrade(CCmdUI* pCmdUI);
  89. afx_msg void OnCheckRememberFtpClick();
  90. afx_msg void OnUpdateCheckRememberFtp(CCmdUI* pCmdUI);
  91. afx_msg void OnEnChangeEdit();
  92. BOOL _bIsFtpPath = FALSE;
  93. afx_msg void OnUpdateFtpUser(CCmdUI* pCmdUI);
  94. afx_msg void OnUpdateFtpPassword(CCmdUI* pCmdUI);
  95. DECLARE_MESSAGE_MAP()
  96. void SetStaticFont();
  97. void SetCtrlStyle();
  98. int m_nCtrlHeight;
  99. public:
  100. afx_msg void OnPaint();
  101. // 重载(禁用面板自带菜单)
  102. afx_msg void OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/);
  103. afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  104. };