vc对话框控件一些操作

隐藏对话框,显示

CDailog * pdailog; if(pdailog) pdailog->ShowWindow(SW_HIDE);

pdailog ->ShowWindow(SW_SHOW);

字符串操作

Constchar* GetPartNameToTree(int index, const char* partname)

{

static CString name;

name.Format("粒子%d(部位:%s)", index, partname);

name.MakeLower();

return name;

}

由路径提取文件全名

const char* GetTextureFileToTree(const char* file)

{

CFilePath filepath;

filepath.Split(file);

static CString filename;

filename = filepath.GetFileName();

filename += filepath.GetExt();

filename.MakeLower();

return filename;

}

对话框控件的数值读取操作

void SetDlgItemFloat(CDialog* pWnd, int nID, float nValue)

{

static CString str;

str.Format("%f", nValue);

pWnd->SetDlgItemText(nID, str);

}

float GetDlgItemFloat(CDialog* pWnd, int nID)

{

static CString str;

pWnd->GetDlgItemText(nID, str);

float ret;

sscanf(str, "%f", &ret);

return ret;

}

颜色对话框提取颜色

void GetColorDialog(CDialog* pWnd, COLORREF& color)

{

CColorDialog colorDlg(color);

if (colorDlg.DoModal() == IDOK)

{

color = colorDlg.GetColor();

pWnd->Invalidate(FALSE);

}

}

CTreeCtrl控件操作

BYTE type

CTreeCtrl m_uTreeEfc;

std::map< BYTE, HTREEITEM > vTreeRoot;

std::map< BYTE, std::vector< HTREEITEM > > vmTreeData;

HTREEITEM htRoot = vTreeRoot[type];

HTREEITEM htree = m_uTreeEfc.InsertItem(pBone->GetName(), htRoot);

m_uTreeEfc.SetItemData(htree, (DWORD_PTR)pBone);

vmTreeData[eRootBone].push_back(htree);

m_uTreeEfc.DeleteItemhtree);

htRoot = m_uTreeEfc.InsertItem("骨骼列表");

m_uTreeEfc.SetItemData(htRoot, eRootBone);

vTreeRoot[eRootBone] = htRoot;

m_uTreeEfc.SetItemText(hItem, pBone->GetName());

HTREEITEM hitem = m_uTreeEfc.GetSelectedItem();

HTREEITEM hparent = m_uTreeEfc.GetParentItem(hitem);

if (!hparent)

return;

assert(m_uTreeEfc.GetParentItem(hparent) == 0);

BYTE type = (BYTE)m_uTreeEfc.GetItemData(hparent);

DWORD_PTR data = m_uTreeEfc.GetItemData(hitem);

获得控件指针

CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_MDX_EFC_PART_BINDPARTNAME);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值