for...in 和 map 在项目中的使用

for …in 遍历数组

      for (const key in invoicesList) {
   
      	if(invoicesList[key].id == object.id){
   
      		invoicesList[key].waivePriceTaxAmount = object
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
要在 MFC 项目建立一个名为 ClockDlg 的对话框类,可以按照以下步骤操作: 1. 打开 MFC 项目,在 Solution Explorer 右键单击项目名称,选择 Add -> Class。 2. 在 Add Class 对话框,选择 MFC Class,然后输入 Class Name 为 ClockDlg。 3. 在基类选择 CDialog,然后单击 Add。 4. 在 ClassWizard 添加 ClockDlg 的消息处理程序。 5. 在 ClockDlg.h 文件添加以下代码: ``` #pragma once #include "afxwin.h" class CClockDlg : public CDialog { // Construction public: CClockDlg(CWnd* pParent = NULL); // standard constructor // Dialog Data enum { IDD = IDD_CLOCK_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support // Implementation protected: HICON m_hIcon; // Generated message map functions virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() }; ``` 6. 在 ClockDlg.cpp 文件添加以下代码: ``` #include "stdafx.h" #include "ClockDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // CClockDlg dialog CClockDlg::CClockDlg(CWnd* pParent /*=NULL*/) : CDialog(CClockDlg::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CClockDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CClockDlg, CDialog) ON_WM_PAINT() ON_WM_QUERYDRAGICON() END_MESSAGE_MAP() // CClockDlg message handlers BOOL CClockDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here return TRUE; // return TRUE unless you set the focus to a control } void CClockDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { CDialog::OnPaint(); } } HCURSOR CClockDlg::OnQueryDragIcon() { return static_cast<HCURSOR>(m_hIcon); } ``` 现在,您已经成功创建了一个名为 ClockDlg 的对话框类。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

都挺好,刚刚好

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值