コード例 #1
0
ファイル: LuaCButtonUI.cpp プロジェクト: uvbs/myduilib
	IMPL_LUA_FUNC(LuaCButtonUI, SetForeImage)
	{
		try
		{
			CButtonUI* self;
			self = static_cast<CButtonUI*>(LuaStatic::CheckUserData(l, 1));
			CDuiString pstrText;
			lua_op_t<CDuiString>::lua_to_value(l, 2, pstrText);
			self->SetForeImage(pstrText);
			return 0;
		}
		catch (...)
		{
			DuiException(_T("LuaCButtonUI::SetForeImage"));
			return 0;
		}
	}
コード例 #2
0
void CToolbarBottom::UpdateButtonImage(void* pbutton, wchar_t* strImage, int& nImageRight, int nImageWidth)
{
	CButtonUI* pButton = static_cast<CButtonUI*>(pbutton);
	if (NULL == pButton || NULL == strImage) return;

	int nWidth = max(pButton->GetFixedWidth(), pButton->GetMinWidth());
	wchar_t strDest[128] = {0};
	int nLeft = (nWidth - nImageWidth) / 2;
	nImageRight = nLeft + nImageWidth;
	wsprintf(strDest,_T("dest='%d,4,%d,34'"), nLeft, nImageRight);

	wchar_t strImagePath[128] = {0};
	wsprintf(strImagePath, L"res='%s' restype='ZPIMGRES' source='0,0,%d,30' %s", strImage, nImageWidth, strDest);
	pButton->SetForeImage(strImagePath);
	wsprintf(strImagePath, L"res='%s' restype='ZPIMGRES' source='%d,0,%d,30' %s", strImage, nImageWidth * 2, nImageWidth * 3, strDest);
	pButton->SetHotForeImage(strImagePath);
	wsprintf(strImagePath, L"res='%s' restype='ZPIMGRES' source='%d,0,%d,30' %s", strImage, nImageWidth, nImageWidth * 2, strDest);
	pButton->SetPushedImage(strImagePath);
}