構析函數

在構造函數中聲明的變量;

BOOL CPropListBoxDlg::CPropertyitem()
{
	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
		
	//Add properties to the property list box

	propItem1 = new CPropertyItem("ToolTip Text","",PIT_EDIT,"");
	m_propList.AddPropItem(propItem1);

	propItem2 = new CPropertyItem("Enabled","true",PIT_COMBO,"true|false|");
	m_propList.AddPropItem(propItem2);

	propItem3 = new CPropertyItem("Visible","true",PIT_COMBO,"true|false|");
	m_propList.AddPropItem(propItem3);

	propItem4 = new CPropertyItem("Fore. Color","",PIT_COLOR,"");
	m_propList.AddPropItem(propItem4);
	
	propItem5 = new CPropertyItem("Back. Color","",PIT_COLOR,"");
	m_propList.AddPropItem(propItem5);
	
	propItem6 = new CPropertyItem("Opaque","false",PIT_COMBO,"true|false|");
	m_propList.AddPropItem(propItem6);
	
	propItem7 = new CPropertyItem("Auto. Scroll","true",PIT_COMBO,"true|false|");
	m_propList.AddPropItem(propItem7);
         return TURE;
}

在構析函數中要delete:

CPropListBoxDlg::~CPropListBoxDlg()
{
 delete propItem1;
 delete propItem2;
 delete propItem3;
 delete propItem4;
 delete propItem5;
 delete propItem6;
 delete propItem7;
}


 


 

發佈了23 篇原創文章 · 獲贊 11 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章