MFC工控项目实例之六CFile添加菜单栏

news2024/9/20 8:52:36

本程序基于前期我的博客文章《MFC工控项目实例之五CFile类读写系统参数》
添加两个对话框如下
在这里插入图片描述
在这里插入图片描述

具体添加菜单栏参考我的博客文章MFC_ CFile类实现下拉菜单读写实例(源码下载)

这里给出相关代码
在 SEAL_PRESSURE.h文件中添加

#include <afxtempl.h>
...
class CProductPara
{
public:
	union
	{
		struct
		{
			char	m_strTypeName[24];
			char	m_strBrand[24];			
			char	m_strRemark[64];
		};
		char len[1024];
	};
};
class CSEAL_PRESSUREApp : public CWinApp
{
public:
	...

	int m_nProductSel;
	CArray<CProductPara,CProductPara> m_allPara;
	CString	m_strWorkPath,m_strCurDataPath,m_strDataPath;
	CString m_strControlCFGFileName;
	CString	m_strTypeCFGFileName;
    void LoadTypeCFG(void);
	void SaveTypeCFG(void);
	...

在 SEAL_PRESSUREDlg.h文件中添加

class CSEAL_PRESSUREDlg : public CDialog
{
// Construction
public:
	...
	CMenu m_menuType;
    int m_nProductSel;
	int m_nTypeIndex;
	CArray<CProductPara,CProductPara> m_allPara;
	CString	m_strWorkPath;
	CString m_strControlCFGFileName;
	CString	m_strTypeCFGFileName;
	CBitmap m_bmSel,m_bmList;
	void OnTypeChange(UINT nID);
    void UpdateButton(void);
    ...
    }

在TypDlg.h文件中添加

class CTypDlg : public CDialog
{
// Construction
public:
	CProductPara * m_pPara;
	BOOL UpdatePara(BOOL);
	CTypDlg(CWnd* pParent = NULL);   // standard constructor
    CMenu m_menuType;
    int m_nProductSel;
	int m_nTypeIndex;
// Dialog Data
	//{{AFX_DATA(CTypDlg)
	enum { IDD = IDD_TYP_CHOICE };
	CListCtrl	m_ctrlType;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTypDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CTypDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnButton1();
	afx_msg void OnButton2();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

在TypData.h文件中添加

class CTypData : public CDialog
{
// Construction
public:
	CProductPara * m_pPara;
	BOOL UpdatePara(BOOL);
	CTypData(CWnd* pParent = NULL);   // standard constructor

// Dialog Data
	//{{AFX_DATA(CTypData)
	enum { IDD = IDD_TYP_DATA };
	CString	m_strTypeName;
	CString	m_strBrand;
	CString	m_strRemark;
		// NOTE: the ClassWizard will add data members here
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTypData)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CTypData)
    virtual BOOL OnInitDialog();
	virtual void OnOK();
		// NOTE: the ClassWizard will add member functions here
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

TypDlg.cpp文件中代码

// TypDlg.cpp : implementation file
//

#include "stdafx.h"
#include "SEAL_PRESSURE.h"

#include "TypDlg.h"
#include "TypData.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/
// CTypDlg dialog


CTypDlg::CTypDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CTypDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CTypDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CTypDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTypDlg)
	DDX_Control(pDX, IDC_LIST1, m_ctrlType);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CTypDlg, CDialog)
	//{{AFX_MSG_MAP(CTypDlg)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)

	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/
// CTypDlg message handlers

BOOL CTypDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	DWORD dwExStyles = m_ctrlType.GetExtendedStyle();
	m_ctrlType.SetExtendedStyle(
		dwExStyles |
		LVS_EX_GRIDLINES |
		LVS_EX_FULLROWSELECT | 
		LVS_EX_FLATSB |
		LVS_EX_ONECLICKACTIVATE
		);


	LVCOLUMN cloumn;
	int i;
	cloumn.mask = LVCF_TEXT|LVCF_WIDTH;
	cloumn.pszText = "型号名称";
	cloumn.cx = 90;
	i = m_ctrlType.InsertColumn(0,&cloumn);
	cloumn.mask = LVCF_TEXT|LVCF_WIDTH;
	cloumn.pszText = "产品商标";
	cloumn.cx = 90;
	i = m_ctrlType.InsertColumn(1,&cloumn);
	cloumn.pszText = "      备        注";
	cloumn.cx = 160;
	i = m_ctrlType.InsertColumn(2,&cloumn);
 
int nItem;
	LV_ITEM item;
	item.mask = LVIF_TEXT|LVIF_IMAGE;

	char buf[255];
	for(i = 0; i < theApp.m_allPara.GetSize() ; i ++)
	{
		nItem = m_ctrlType.GetItemCount();
		item.iItem = nItem;
		item.iSubItem = 0;
		sprintf(buf,"%s",theApp.m_allPara[i].m_strTypeName);
		item.pszText = buf;
		item.iImage = 0;
		m_ctrlType.InsertItem(&item);
		item.iSubItem = 1;
		sprintf(buf,"%s",theApp.m_allPara[i].m_strBrand);
		item.pszText = buf;
		m_ctrlType.SetItem(&item);
		item.iSubItem = 2;
		sprintf(buf,"%s",theApp.m_allPara[i].m_strRemark);
		item.pszText = buf;
		m_ctrlType.SetItem(&item);
	}
	
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	
	// TODO: Add extra initialization here
	 
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CTypDlg::OnButton1() 
{
	// TODO: Add your control notification handler code here
	
	  CTypData dlg;
	CProductPara paraBuf;	
	memset(&paraBuf,0,sizeof(CProductPara));
	dlg.m_pPara = &paraBuf;
	if(dlg.DoModal() == IDOK)
	{
		int nItem;
		if(m_nTypeIndex > -1)
			nItem = m_nTypeIndex + 1;
		else
			nItem = theApp.m_allPara.GetSize();
		theApp.m_allPara.InsertAt(nItem,paraBuf);

		LV_ITEM item;
		item.mask = LVIF_TEXT;
		item.iItem = nItem;
		item.iSubItem = 0;
		item.pszText = theApp.m_allPara[nItem].m_strTypeName;
		item.iImage = 0;
		m_ctrlType.InsertItem(&item);
		item.iSubItem = 1;
		item.pszText = theApp.m_allPara[nItem].m_strBrand;
		m_ctrlType.SetItem(&item);
		item.iSubItem = 2;
		item.pszText = theApp.m_allPara[nItem].m_strRemark;
		m_ctrlType.SetItem(&item);

	}	
}



TypData.cpp文件中代码

// TypData.cpp : implementation file
//

#include "stdafx.h"
#include "SEAL_PRESSURE.h"
#include "TypData.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/
// CTypData dialog


CTypData::CTypData(CWnd* pParent /*=NULL*/)
	: CDialog(CTypData::IDD, pParent)
{
	//{{AFX_DATA_INIT(CTypData)
	m_strTypeName = _T("");
	m_strBrand = _T("");
	m_strRemark = _T("");
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CTypData::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTypData)
	DDX_Text(pDX, IDC_EDIT1, m_strTypeName);
	DDX_Text(pDX, IDC_EDIT2, m_strBrand);
	DDX_Text(pDX, IDC_EDIT3, m_strRemark);
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CTypData, CDialog)
	//{{AFX_MSG_MAP(CTypData)
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/
// CTypData message handlers
BOOL CTypData::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	UpdatePara(FALSE);
//	UpdatePara(1);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

BOOL CTypData::UpdatePara(BOOL bUpdate)
{
	if(m_pPara == NULL)
		return TRUE;
	if(bUpdate)
	{
		if(!UpdateData())
			return FALSE;
		sprintf(m_pPara->m_strTypeName,"%s", m_strTypeName);
		sprintf(m_pPara->m_strRemark,"%s", m_strRemark);
		sprintf(m_pPara->m_strBrand,"%s", m_strBrand);
	}
			else
	{
		m_strTypeName = m_pPara->m_strTypeName;
		m_strRemark = m_pPara->m_strRemark;
		m_strBrand = m_pPara->m_strBrand;
		
		UpdateData(FALSE);

	}

	return TRUE;
}



void CTypData::OnOK() 
{
	// TODO: Add extra validation here
	
	if(!UpdatePara(TRUE))
		return;
	
	CDialog::OnOK();
	UpdateData(TRUE);
}

SEAL_PRESSURE.cpp文件代码

// SEAL_PRESSURE.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "SEAL_PRESSURE.h"
#include "SEAL_PRESSUREDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/
// CSEAL_PRESSUREApp

BEGIN_MESSAGE_MAP(CSEAL_PRESSUREApp, CWinApp)
	//{{AFX_MSG_MAP(CSEAL_PRESSUREApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG
	ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

/
// CSEAL_PRESSUREApp construction

CSEAL_PRESSUREApp::CSEAL_PRESSUREApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
		TCHAR exeFullPath[MAX_PATH];
	GetModuleFileName(NULL,exeFullPath,MAX_PATH);
	m_Path = exeFullPath;
	for(int i = m_Path.GetLength() - 1; i > 0 ; i --)
	{
		if(m_Path.GetAt(i) == '\\')
			break;
	}
	SetCurrentDirectory(m_Path);
	m_Path = m_Path.Left(i);
	m_DataPath = m_Path + "\\DATA\\";
	m_TempPath = m_Path + "\\TEMP\\";
	m_LibPath = m_Path + "\\LIB\\";	
	CreateDirectory(m_LibPath,FALSE);
	CreateDirectory(m_DataPath,FALSE);
	CreateDirectory(m_TempPath,FALSE);
	m_CFGFileName = m_Path + "\\CFG.PAR";

	m_strTypeCFGFileName = m_Path + "\\TYPE.CFG";
	m_strDataPath = m_Path + "\\DATA\\";
	CreateDirectory(m_strDataPath,FALSE);
	}

/
// The one and only CSEAL_PRESSUREApp object

CSEAL_PRESSUREApp theApp;

/
// CSEAL_PRESSUREApp initialization

BOOL CSEAL_PRESSUREApp::InitInstance()
{
	AfxEnableControlContainer();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	LoadCFGFile();
   	LoadTypeCFG();
   
	CSEAL_PRESSUREDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
    SaveCFGFile();
	SaveTypeCFG();
	return FALSE;
}

void CSEAL_PRESSUREApp::LoadCFGFile()
{
		CFile file;
	if(file.Open(m_CFGFileName,CFile::modeRead))
	{
		if(!file.Read(&m_sys_data,sizeof(m_sys_data)))
		{
			memset(&m_sys_data,0,sizeof(m_sys_data));
		}
		file.Close();
	}
	else
	{
		memset(&m_sys_data,0,sizeof(m_sys_data));
	}
}

void CSEAL_PRESSUREApp::SaveCFGFile()
{
		CFile file;
	if(file.Open(m_CFGFileName,CFile::modeCreate|CFile::modeWrite))
	{
		file.Write(&m_sys_data,sizeof(m_sys_data));
		file.Close();
	}
}


void CSEAL_PRESSUREApp::SaveTypeCFG()
{
	CFile file;
	CProductPara paraBuf;
	file.Open(m_strTypeCFGFileName,CFile::modeCreate|CFile::modeWrite);
	for(int i = 0 ; i < theApp.m_allPara.GetSize() ; i ++)
	{
		paraBuf = m_allPara[i];
		file.Write(&paraBuf,sizeof(m_allPara[i]));
	}
	file.Close();
}


void CSEAL_PRESSUREApp::LoadTypeCFG()
{
CFile file;
	int nProductCount = 0;
	CProductPara paraBuf;
	if(file.Open(m_strTypeCFGFileName,CFile::modeRead))
	{
		nProductCount = file.GetLength() / sizeof(CProductPara);
	
		for(int i = 0 ; i < nProductCount ; i ++)
		{
			file.Read(&paraBuf,sizeof(m_allPara[i]));
			m_allPara.Add(paraBuf);
		}
		file.Close();
	}

		

	if(nProductCount ==0)
	{
		memset(&paraBuf,0,sizeof(CProductPara));
		strcpy(paraBuf.m_strTypeName,"默认值");
		strcpy(paraBuf.m_strRemark,"默认值");
		strcpy(paraBuf.m_strBrand,"默认值");
		m_allPara.Add(paraBuf);
		}
}

在SEAL_PRESSUREDlg.cpp文件中添加


BOOL CSEAL_PRESSUREDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	...
	 m_menuType.LoadMenu(IDR_MENU1);	
	return TRUE;  // return TRUE  unless you set the focus to a control
}
void CSEAL_PRESSUREDlg::OnTypChoice() 
{
	// TODO: Add your control notification handler code here
//	CTypDlg dlg;
//	dlg.DoModal();
		int	m_nActivePlace = 0;
int	ID_DEF_PRODUCT =5000;

	CRect rect;
	GetDlgItem(IDC_TYP_CHOICE)->GetWindowRect(&rect);
		while(m_menuType.GetSubMenu(0)->GetMenuItemCount() >2)
	{
		m_menuType.GetSubMenu(0)->RemoveMenu(2,MF_BYPOSITION);
	}
	for(int i = 0 ; i < theApp.m_allPara.GetSize() -1; i ++)
	{
		CString str;
		if(strlen(theApp.m_allPara[i + 1].m_strBrand) > 0)
			str.Format("%s(%s)",theApp.m_allPara[i + 1].m_strTypeName,theApp.m_allPara[i + 1].m_strBrand);
		else
			str.Format("%s",theApp.m_allPara[i + 1].m_strTypeName,theApp.m_allPara[i + 1].m_strBrand);
		m_menuType.GetSubMenu(0)->AppendMenu(MF_STRING,ID_DEF_PRODUCT + i,str);
	
	}
	if(theApp.m_nProductSel > 0)
		m_menuType.GetSubMenu(0)->CheckMenuItem(2 + theApp.m_nProductSel - 1,MF_CHECKED|MF_BYPOSITION);
	m_menuType.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN |TPM_RIGHTBUTTON,
	   rect.left,rect.bottom,this);
}
	

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2072724.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

github源码指引:共享内存、数据结构与算法

初级代码游戏的专栏介绍与文章目录-CSDN博客 我的github&#xff1a;codetoys&#xff0c;所有代码都将会位于ctfc库中。已经放入库中我会指出在库中的位置。 这些代码大部分以Linux为目标但部分代码是纯C的&#xff0c;可以在任何平台上使用。 源码目录&#xff1a;shmfc 相…

一键拼图神器CollageIt,让你的照片秒变艺术大作!

前言 嘿&#xff0c;你是否曾对着满屏的照片发愁&#xff0c;想要快速整理成精美的作品集&#xff0c;却又被繁琐的排版搞得头昏脑涨&#xff1f;如果有一款神器&#xff0c;能让你一键搞定这些烦恼&#xff0c;轻松提升办公效率&#xff0c;是不是觉得升职加薪的曙光就在眼前…

Python 进度条tqdm应用记录

tqdm 简介 tqdm 是一个非常流行的 Python 库&#xff0c;用于快速添加进度条到循环中。它可以方便地集成到脚本中&#xff0c;并且支持多种类型的迭代器。 安装 首先确保你安装了 tqdm。如果还没有安装&#xff0c;可以通过 pip 安装它&#xff08;如果要在 jupyter noteboo…

游戏开发设计模式之单例模式

单例模式&#xff08;Singleton Pattern&#xff09;是一种常见的设计模式&#xff0c;其主要目的是确保一个类在整个程序的生命周期中只有一个实例&#xff0c;并提供一个全局访问点来获取这个实例。在游戏开发中&#xff0c;单例模式具有广泛的应用和重要的作用。 单例模式的…

如何评估Redis的性能

如果系统中出现了大 key、热 key 等&#xff0c;往往会导致 Redis 变慢&#xff0c;但是这个慢该如何界定&#xff1f;多久算慢&#xff1f;1秒还是3秒&#xff1f; 这个肯定是没有标准答案&#xff0c;因为这个和你的硬件设备有关。 硬件差一些&#xff0c;平时响应时间都是…

OSPF路由原理详解与关键点

目录 一. OSPF简介: 二. OSPF原理描述: 三. OSPF的核心内容: 四. OSPF的邻居关系和邻接 五. LSA在各区域中传播的支持情况 一. OSPF简介: 开放式最短路径优先OSPF&#xff08;Open Shortest Path First&#xff09;是IETF组织开发的一个基于链路状态的内部网关协议&…

打造编程学习的知识宝库:高效笔记与整理技巧

在编程的海洋中&#xff0c;知识的深度和广度都是难以估量的。要想在这片海洋中航行而不迷失方向&#xff0c;一个高效的笔记系统是不可或缺的。本文将探讨如何建立一个既能快速记录又易于回顾的笔记系统&#xff0c;以及如何在繁忙的学习中保持笔记的条理性。 目录 一、确定笔…

数三角形(二)》-筛除法斜线结论

算法思路&#xff1a; 1、一个直观的思路是筛除法&#xff0c;即&#xff1a;答案总数-三点共线的种数 总数易求得&#xff0c;为组合数C((n1)*(m1),3)&#xff0c;考虑到n、m数值范围&#xff0c;考虑用long long。 2、三点共线的情况有&#xff1a; &#xff08;1&#xff09…

Linux驱动学习之按键读取

按键读取我们需要实现read函数&#xff0c; read 函数的 第二个参数被__user 修饰&#xff0c;原则上在内核层我们不能直接访问&#xff0c;需要调用 copy_to_user()这个函数&#xff0c;从内核获取数据到上层。 copy_to_user(void __user volatile * to, const void * from,…

C语言笔试题(指针、数组、整数在内存中的存储、结构体......)

文章目录 1.选择题2.代码题2.1 模拟实现strncat2.2 模拟实现strncpy2.3 编写判断大小端程序2.4 模拟实现atoi2.5 BC38 变种水仙花数2.6 BC98 序列中删除指定数字 今天我们一起来看一些题目 1.选择题 解析如下&#xff1a; 正确选项&#xff1a;B A.参数错误&#xff1b;D.返回…

什么是Redis集群的脑裂问题?

目录 一、脑裂的发生 二、脑裂的危害 三、如何避免脑裂&#xff1f; 四、能彻底解决脑裂吗&#xff1f; 所谓脑裂&#xff0c;就像他的名字一样&#xff0c;大脑裂开了&#xff0c;一般来说就是指一个分布式系统中有两个子集&#xff0c;然后每个子集都有一个自己的大脑(Le…

【Excal】And函数

奖金评定说明 业绩低于6000&#xff0c;奖金为100 业绩大于等于6000且小于10000&#xff0c;奖金为200 业绩大于等于10000&#xff0c;奖金为500 然后按回车健 下拉填充

BurpSuite2024.7.3专业版

前言 Burp Suite是一个无需安装软件&#xff0c;下载完成后&#xff0c;直接从命令行启用即可。开箱即可使用支持LInux/Windows/Mac 01更新介绍 2024.7.13版本界面大改动此版本引入了重大的性能升级、对拦截功能的重大增强&#xff0c;以及在审计项目表中新增了扫描插入点列。…

【Nature】在科研中应用ChatGPT:如何与数据对话

随着人工智能技术的迅猛发展&#xff0c;大型语言模型&#xff08;LLMs&#xff09;正逐渐成为科研领域的一种创新工具。这些模型通过自然语言处理技术&#xff0c;使得研究人员能够以直观的方式与数据进行交互&#xff0c;从而简化了数据分析和解释的过程。在《自然》杂志2024…

103.二叉树的锯齿形层序遍历

1.题目描述 给你二叉树的根节点 root &#xff0c;返回其节点值的 锯齿形层序遍历 。&#xff08;即先从左往右&#xff0c;再从右往左进行下一层遍历&#xff0c;以此类推&#xff0c;层与层之间交替进行&#xff09;。 示例 1&#xff1a; 输入&#xff1a;root [3,9,20,nul…

Unity-可分组折叠的Editor

Unity-可分组折叠的Editor &#x1f957;功能介绍&#x1f36d;用法 &#x1f957;功能介绍 在序列化的字段上标记特性:[FoldoutGroup(“xxx”)]&#xff0c;inspector上就会被分组折叠显示。 &#xff08;没有被指定的字段自动放到Default组中&#xff09; 传送门&#x1f30…

如何用Java SpringBoot和Vue搭建高效的OA办公管理系统?

✍✍计算机编程指导师 ⭐⭐个人介绍&#xff1a;自己非常喜欢研究技术问题&#xff01;专业做Java、Python、微信小程序、安卓、大数据、爬虫、Golang、大屏等实战项目。 ⛽⛽实战项目&#xff1a;有源码或者技术上的问题欢迎在评论区一起讨论交流&#xff01; ⚡⚡ Java实战 |…

深度学习--复制机制:CopyNet 模型在序列到序列模型中的应用以及代码实现

CopyNet 是一种特别设计的序列到序列&#xff08;Seq2Seq&#xff09;模型&#xff0c;旨在更好地处理那些在输出序列中需要直接复制输入序列中的部分或全部内容的任务。它在机器翻译、摘要生成、文本复述等任务中有广泛的应用&#xff0c;尤其是在输入和输出有显著重叠的场景。…

Spring--三级缓存机制

一、什么是三级缓存 就是在Bean生成流程中保存Bean对象三种形态的三个Map集合&#xff0c;如下&#xff1a; // 一级缓存Map 存放完整的Bean&#xff08;流程跑完的&#xff09; private final Map<String, Object> singletonObjects new ConcurrentHashMap(256);// 二…

51单片机——LED灯控制

1、LED介绍 中文名&#xff1a;发光二极管 外文名&#xff1a;Light Emitting Diode 简称&#xff1a;LED 用途&#xff1a;照明、广告灯、指引灯、屏幕 2、LED原理图 电阻在原理图上标注为1k&#xff0c;表示这是1千欧的电阻&#xff0c;实际在电路板上的表示是102 102解…