コード例 #1
0
ファイル: ClientWnd.cpp プロジェクト: Yonsm/RawPlayer
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 缩放所有窗口
VOID CClientWnd::OnPlayZoom(UINT uCmd)
{
	RECT rtMain;
	RECT rtClient;
	RECT rtChild;

	SendMessage(m_hWnd, WM_MDICASCADE, 0, 0);
	HWND hWnd = GetWindow(m_hWnd, GW_CHILD);
	for (hWnd = GetWindow(hWnd, GW_HWNDFIRST); hWnd; )
	{
		_Assert(GetChildWnd(hWnd));
		GetChildWnd(hWnd)->OnPlayZoom(uCmd, FALSE);
		hWnd = GetWindow(hWnd, GW_HWNDNEXT);
	}

	if (m_bScrabble)
	{
		GetWindowRect(CMainWnd::m_hWnd, &rtMain);
		GetClientRect(m_hWnd, &rtClient);
		hWnd = GetWindow(GetWindow(m_hWnd, GW_CHILD), GW_HWNDFIRST);
		GetWindowRect(hWnd, &rtChild);

		MoveWindow(CMainWnd::m_hWnd, rtMain.left, rtMain.top, 
			_RectWidth(rtMain) - _RectWidth(rtClient) + _RectWidth(rtChild),
			_RectHeight(rtMain) - _RectHeight(rtClient) + _RectHeight(rtChild), TRUE);
	}
}
コード例 #2
0
ファイル: ChildWnd.cpp プロジェクト: Yonsm/RawPlayer
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 设置播放窗口尺寸
VOID CChildWnd::SetVideoSize(DWORD dwWidth, DWORD dwHeight)
{
	RECT rtRect;
	RECT rtWindow;

	// 播放窗口非客户区尺寸
	GetClientRect(m_hPlayWnd, &rtRect);
	GetWindowRect(m_hPlayWnd, &rtWindow);
	dwWidth += _RectWidth(rtWindow) - _RectWidth(rtRect);
	dwHeight += _RectHeight(rtWindow) - _RectHeight(rtRect);

	// 子窗口非客户区尺寸
	GetClientRect(m_hWnd, &rtRect);
	GetWindowRect(m_hWnd, &rtWindow);
	dwWidth += _RectWidth(rtWindow) - _RectWidth(rtRect);
	dwHeight += _RectHeight(rtWindow) - _RectHeight(rtRect);

	if (CMainWnd::IsMenuChecked(IDM_View_Toolbar))
	{
		GetWindowRect(m_hToolbar, &rtRect);
		dwHeight += _RectHeight(rtRect);
	}

	if (CMainWnd::IsMenuChecked(IDM_View_StatusBar))
	{
		GetWindowRect(m_hStatusBar, &rtRect);
		dwHeight += _RectHeight(rtRect);
	}

	// 调整窗口大小
	MapWindowPoints(NULL, CMainWnd::m_hWnd, (PPOINT) &rtWindow, 2);
	MoveWindow(m_hWnd, rtWindow.left, rtWindow.top, dwWidth, dwHeight, TRUE);
}
コード例 #3
0
ファイル: ChildWnd.cpp プロジェクト: Yonsm/RawPlayer
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 调整状态栏大小及位置
VOID CChildWnd::AdjustStatusBar(WPARAM wParam, LPARAM lParam)
{
	INT i;
	INT j;
	RECT rtRect;
	INT iParts[] = {-1, 50, 35, 40, 35, 35, 50, 50};

	for (i = 0; i < _NumOf(iParts); i++)
	{
		iParts[i] = LOWORD(lParam);
		_ExIf(wParam != SIZE_MAXIMIZED, iParts[i] -= 16);
		for (j = i + 1; j < _NumOf(iParts); j++)
		{
			iParts[i] -= iParts[j];
		}
	}
	_ExIf(wParam == SIZE_MAXIMIZED, iParts[_NumOf(iParts) - 1] -= -1);

	SendMessage(m_hStatusBar, SB_SETPARTS, _NumOf(iParts), (LPARAM) iParts);
	SendMessage(m_hStatusBar, WM_SIZE, wParam, lParam);

	SendMessage(m_hStatusBar, SB_GETRECT, m_uEditBox, (LPARAM) &rtRect);
	InflateRect(&rtRect, -2, -2);
	MoveWindow(m_hEditBox, rtRect.left, rtRect.top, _RectWidth(rtRect), _RectHeight(rtRect), TRUE);
}
コード例 #4
0
ファイル: MainWnd.cpp プロジェクト: Yonsm/RawPlayer
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 窗口销毁
VOID CMainWnd::OnDestroy()
{
	WINDOWPLACEMENT wpWindow;

	// 保存窗口位置信息
	wpWindow.length = sizeof(WINDOWPLACEMENT);
	GetWindowPlacement(m_hWnd, &wpWindow);
	CIni::SetInt(INI_WindowLeft, wpWindow.rcNormalPosition.left);
	CIni::SetInt(INI_WindowTop, wpWindow.rcNormalPosition.top);
	CIni::SetInt(INI_WindowWidth, _RectWidth(wpWindow.rcNormalPosition));
	CIni::SetInt(INI_WindowHeight, _RectHeight(wpWindow.rcNormalPosition));
	CIni::SetInt(INI_WindowState, wpWindow.showCmd);

	// 保存同步状态
	//CIni::SetInt(INI_Synchronize, CRawPlayer::m_bSync);

	// 保存新近文件列表
	CRecentFile::Save();

	// 销毁相关数据
	CLanguage::Destroy();

	// 退出程序
	PostQuitMessage(0);
}
コード例 #5
0
ファイル: ChildWnd.cpp プロジェクト: Yonsm/RawPlayer
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 大小改变
VOID CChildWnd::OnSize(WPARAM wParam, LPARAM lParam)
{
	RECT rtRect;
	INT iToolbar;
	INT iStatusBar;
	SIZE sizeToolbar;

	// 如果指定要获取窗口大小
	if (lParam == 0)
	{
		GetClientRect(m_hWnd, &rtRect);
		lParam = MAKELONG(_RectWidth(rtRect), _RectHeight(rtRect));
	}

	// 获取工具栏和状态栏的高度
	if (CMainWnd::IsMenuChecked(IDM_View_Toolbar))
	{
		ShowWindow(m_hToolbar, SW_SHOW);
		GetWindowRect(m_hToolbar, &rtRect);
		iToolbar = _RectHeight(rtRect);
	}
	else
	{
		ShowWindow(m_hToolbar, SW_HIDE);
		iToolbar = 0;
	}
	if (CMainWnd::IsMenuChecked(IDM_View_StatusBar))
	{
		ShowWindow(m_hStatusBar, SW_SHOW);
		GetWindowRect(m_hStatusBar, &rtRect);
		iStatusBar = _RectHeight(rtRect);
	}
	else
	{
		ShowWindow(m_hStatusBar, SW_HIDE);
		iStatusBar = 0;
	}

	// 调整播放窗口大小及位置
	MoveWindow(m_hPlayWnd, 0, iToolbar, LOWORD(lParam), HIWORD(lParam) - iToolbar - iStatusBar, TRUE);
	SetDrawRect();

	// 调整状态栏大小及位置
	AdjustStatusBar(wParam, lParam);

	// 调整工具栏大小及位置
	SendMessage(m_hToolbar, TB_AUTOSIZE, 0, 0);

	// 调整定位栏的大小
	SendMessage(m_hToolbar, TB_GETMAXSIZE, 0, (LPARAM) &sizeToolbar);
	MoveWindow(m_hSeekBar, sizeToolbar.cx, 1, LOWORD(lParam) - sizeToolbar.cx, sizeToolbar.cy - 2, TRUE);

	// 调整客户窗口边框
	if (m_hWnd == CClientWnd::GetActive())
	{
		CClientWnd::SetEdge(wParam != SIZE_MAXIMIZED);
	}
}
コード例 #6
0
ファイル: OpenDlg.cpp プロジェクト: oddstone/RawPlayer
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 调整尺寸
VOID COpenDlg::OnSize()
{
	HWND hWnd;
	RECT rtRect;
	DWORD dwValue;

	// 调整边框
	hWnd = GetDlgItem(m_hWnd, IDC_Open_PreviewFrame);
	GetWindowRect(hWnd, &m_rtPreview);
	MapWindowPoints(NULL, m_hWnd, (PPOINT) &m_rtPreview, 2);
	GetWindowRect(GetDlgItem(m_hWnd, IDC_Open_FormatFrame), &rtRect);
	dwValue = _RectWidth(rtRect) + 32;		
	GetClientRect(m_hParent, &rtRect);
	m_rtPreview.right = m_rtPreview.left + _RectWidth(rtRect) - dwValue;
	MoveWindow(hWnd, m_rtPreview.left, m_rtPreview.top, _RectWidth(m_rtPreview), _RectHeight(m_rtPreview), TRUE);

	// 调整状态文本
	hWnd = GetDlgItem(m_hWnd, IDC_Open_StatusText);
	GetWindowRect(hWnd, &rtRect);
	MapWindowPoints(NULL, m_hWnd, (PPOINT) &rtRect, 2);
	MoveWindow(hWnd, 
		m_rtPreview.right - _RectWidth(rtRect) - 10, rtRect.top, _RectWidth(rtRect), _RectHeight(rtRect), TRUE);

	// 调整预览框位置
	m_rtPreview.top += 10;
	InflateRect(&m_rtPreview, -10, -10);
	m_rtPreview.left += 35;	

	// 调整工具栏
	MoveWindow(m_hToolbar, m_rtPreview.left - 33, m_rtPreview.top + 3, 25, _RectHeight(m_rtPreview) - 6, TRUE);

	OnCommand(IDC_RawVideo_Change);

	// 刷新预览
	InvalidateRect(m_hWnd, &m_rtPreview, TRUE);
}
コード例 #7
0
ファイル: ClientWnd.cpp プロジェクト: Yonsm/RawPlayer
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 拼接窗口
VOID CClientWnd::Scrabble()
{
	UINT i;
	RECT rtClient;
	DWORD dwWidth;
	DWORD dwStyle;
	CChildWnd *pWnd;

	_ReturnIf(m_uChildNum == 0);

	// 获取客户矩形
	GetClientRect(m_hWnd, &rtClient);
	dwWidth = _RectWidth(rtClient) / m_uChildNum;
	for (pWnd = CChildWnd::m_pHead, i = 0; pWnd; pWnd = pWnd->m_pNext, i++)
	{
		// 设置子窗口
		dwStyle = GetWindowLong(pWnd->m_hWnd, GWL_STYLE);
		if (m_bScrabble)
		{
			dwStyle &= ~WS_CAPTION;
			dwStyle &= ~WS_THICKFRAME;
		}
		else
		{
			dwStyle |= WS_CAPTION | WS_THICKFRAME;
		}
		SetWindowLong(pWnd->m_hWnd, GWL_STYLE, dwStyle);
		if (m_bScrabble == FALSE)
		{
			SetWindowPos(pWnd->m_hWnd, NULL, 0, 0, 0, 0, 
				SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
		}

		// 设置播放窗口
		dwStyle = GetWindowLong(pWnd->m_hPlayWnd, GWL_EXSTYLE);
		if (m_bScrabble)
		{
			dwStyle &= ~WS_EX_CLIENTEDGE;
		}
		else
		{
			dwStyle |= WS_EX_CLIENTEDGE;
		}
		SetWindowLong(pWnd->m_hPlayWnd, GWL_EXSTYLE, dwStyle);
		if (m_bScrabble == FALSE)
		{
			SetWindowPos(pWnd->m_hPlayWnd, NULL, 0, 0, 0, 0, 
				SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
		}

		if (m_bScrabble)
		{
			// 移动子窗口
			MoveWindow(pWnd->m_hWnd, dwWidth * i, 0, dwWidth, _RectHeight(rtClient), TRUE);
		}

		if (m_bScrabble)
		{
			RECT rtRect;
			rtRect.left = pWnd->m_uWidth * i / m_uChildNum;
			rtRect.right = rtRect.left + (pWnd->m_uWidth / m_uChildNum);
			rtRect.top = 0;
			rtRect.bottom = pWnd->m_uHeight;
			pWnd->SetSrcRect(&rtRect);
		}
		else
		{
			pWnd->SetSrcRect();
		}
	}

	if (m_bScrabble == FALSE)
	{
		SendMessage(m_hWnd, WM_MDICASCADE, 0, 0);
	}
}
コード例 #8
0
ファイル: OpenDlg.cpp プロジェクト: oddstone/RawPlayer
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 命令处理
VOID COpenDlg::OnCommand(WPARAM wParam, LPARAM lParam)
{
	INT i;
	RECT rtRect;
	BOOL bPreview;
	PUINT puValue;
	const UINT c_uFormats[][2] = 
	{
		{352, 288}, {176, 144}, {128, 96},
		{320, 240}, {160, 120},
		{640, 480}, {320, 240}, {160, 120},
		{352, 240}, {352, 288},
		{720, 480}, {720, 576},
	};

	_ExIf((HWND) lParam == m_hToolbar, SetFocus(m_hToolbar));
	switch (LOWORD(wParam))
	{
	case IDC_Open_MulSignText:
		if (m_hFormatMenu == NULL)
		{
			m_hFormatMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_Menu_Format));
		}
		GetWindowRect(GetDlgItem(m_hWnd, IDC_Open_MulSignText), &rtRect);
		TrackPopupMenu(GetSubMenu(m_hFormatMenu, 0), TPM_TOPALIGN, rtRect.left, rtRect.top, 0, m_hWnd, NULL);
		break;

	case IDM_Format_CIF:
	case IDM_Format_QCIF:
	case IDM_Format_SUBQCIF:
	case IDM_Format_SIF:
	case IDM_Format_QSIF:
	case IDM_Format_VGA:
	case IDM_Format_QVGA:
	case IDM_Format_QQVGA:
	case IDM_Format_VCDNTSC:
	case IDM_Format_VCDPAL:
	case IDM_Format_DVDNTSC:
	case IDM_Format_DVDPAL:
		i = LOWORD(wParam) - IDM_Format_CIF;
		SetDlgItemInt(m_hWnd, IDC_Open_Width, c_uFormats[i][0], FALSE);
		SetDlgItemInt(m_hWnd, IDC_Open_Height, c_uFormats[i][1], TRUE);
		OnCommand(MAKELONG(IDC_Open_Width, EN_KILLFOCUS));
		OnCommand(MAKELONG(IDC_Open_Height, EN_KILLFOCUS));
		break;

	case IDC_Open_Preview:
		// 切换预览
		if (HIWORD(wParam) == BN_CLICKED)
		{
			IsPreviewChecked() ? InvalidateRect(m_hWnd, &m_rtPreview, TRUE) : m_pWnd->Stop();
			OnCommand(IDC_RawVideo_Seek);
		}
		break;

	case IDC_Open_Width:
	case IDC_Open_Height:
	case IDC_Open_FrameRate:
	case IDC_Open_FrameStep:
		if (HIWORD(wParam) == EN_KILLFOCUS)
		{
			switch (LOWORD(wParam))
			{
			case IDC_Open_Width:
				puValue = &m_riFormat.m_uWidth;
				break;

			case IDC_Open_Height:
				puValue = (PUINT) &m_riFormat.m_iHeight;
				break;

			case IDC_Open_FrameRate:
				puValue = &m_riFormat.m_uFrameRate;
				break;

			case IDC_Open_FrameStep:
				puValue = (PUINT) &m_riFormat.m_iFrameStep;
				break;
			}

			// 限制尺寸范围
			*puValue = GetDlgItemInt(m_hWnd, LOWORD(wParam), NULL, TRUE);
			m_pWnd->Open(m_pWnd->m_tzFileName, &m_riFormat);
			SetDlgItemInt(m_hWnd, LOWORD(wParam), *puValue, TRUE);
		}
		break;

	case IDM_Play_Play:
		m_pWnd->TogglePlay();
		break;

	case IDM_Play_GotoStart:
		m_pWnd->Stop();
		m_pWnd->Seek(0);
		break;

	case IDM_Play_GotoEnd:
		m_pWnd->Stop();
		m_pWnd->Seek(MAX_Frame);
		break;

	case IDM_Play_StepBackward:
		m_pWnd->Stop();
		m_pWnd->Step(-1);
		break;

	case IDM_Play_StepForward:
		m_pWnd->Stop();
		m_pWnd->Step(1);
		break;

	case IDC_RawVideo_Play:
		SendMessage(m_hToolbar, TB_CHECKBUTTON, IDM_Play_Play, lParam);
		break;

	case IDC_RawVideo_Change:
		bPreview = CanPreview();
		for (i = IDM_Play_Play; i <= IDM_Play_GotoEnd; i++)
		{
			SendMessage(m_hToolbar, TB_ENABLEBUTTON, i, MAKELONG(bPreview, 0));
		}

		i = m_pWnd->m_uTotalFrame ? (m_pWnd->m_uTotalFrame - 1) : 0;
		SendDlgItemMessage(m_hWnd, IDC_Open_FrameStepSpin, UDM_SETRANGE, 0, MAKELONG(i, -i));		
		InvalidateRect(GetDlgItem(m_hWnd, IDC_Open_FrameStepSpin), NULL, FALSE);

		// 计算位置和尺寸
		CopyRect(&rtRect, &m_rtPreview);
		InflateRect(&rtRect, -5, -5);
		i = MulDiv(m_pWnd->m_uWidth, _RectHeight(m_rtPreview), m_pWnd->m_iHeight);
		if (i > _RectWidth(rtRect))
		{
			i = MulDiv(m_pWnd->m_iHeight, _RectWidth(rtRect), m_pWnd->m_uWidth);
			if (_RectHeight(rtRect) > i)
			{
				rtRect.top += (_RectHeight(rtRect) - i) / 2;
				rtRect.bottom = rtRect.top + i;
			}
		}
		else
		{
			rtRect.left += (_RectWidth(rtRect) - i) / 2;
			rtRect.right = rtRect.left + i;
		}
		m_pWnd->SetDrawRect(&rtRect);

		SetDlgItemInt(m_hWnd, IDC_Open_TotalFrame, m_pWnd->m_uTotalFrame, FALSE);
		InvalidateRect(m_hWnd, &m_rtPreview, TRUE);
		break;

	case IDC_RawVideo_Seek:
		if (CanPreview())
		{
			SetDlgItemInt(m_hWnd, IDC_Open_StatusText, m_pWnd->m_uCurFrame + 1, FALSE);
		}
		else
		{
			SetDlgItemText(m_hWnd, IDC_Open_StatusText, NULL);
		}
		break;
	}
}
コード例 #9
0
ファイル: OpenDlg.cpp プロジェクト: oddstone/RawPlayer
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 通知消息
UINT COpenDlg::OnNotify(WPARAM wParam, LPARAM lParam)
{
	RECT rtRect;
	BOOL bPreview;
	RAWIMAGE riFormat;
	TCHAR tzFileName[MAX_PATH];	

	switch (((LPNMHDR) lParam)->code)
	{
	case CDN_INITDONE:
		// 调整父窗口位置,使其居中与屏幕中心
		GetWindowRect(m_hParent, &rtRect);
		MoveWindow(m_hParent, 
			(GetSystemMetrics(SM_CXSCREEN) - _RectWidth(rtRect) - 20) / 2,
			(GetSystemMetrics(SM_CYSCREEN) - _RectHeight(rtRect)) / 2,
			_RectWidth(rtRect), _RectHeight(rtRect), TRUE);

		// 重新调整窗口大小
		GetClientRect(m_hParent, &rtRect);
		MoveWindow(m_hWnd, 0, 0, _RectWidth(rtRect), _RectHeight(rtRect), TRUE);
		//break;

	case CDN_TYPECHANGE:
		OnTypeChange(((LPOFNOTIFY) lParam)->lpOFN);
		break;

	case CDN_SELCHANGE:
		// 获取文件名
		tzFileName[0] = 0;
		SendMessage(m_hParent, CDM_GETFILEPATH, MAX_PATH, (LPARAM) tzFileName);

		// 更改过滤器
		if (m_bFilterChange)
		{
			m_bFilterChange = FALSE;
		}
		// 设置记录的历史格式
		else if (CIni::GetStruct(INI_HistroyFormat, tzFileName, &riFormat, sizeof(RAWIMAGE)))
		{
			if (riFormat.m_csColorSpace != m_riFormat.m_csColorSpace)
			{
				CopyMemory(&m_riFormat, &riFormat, sizeof(RAWIMAGE));
				SendDlgItemMessage(m_hParent, 0x0470, CB_SETCURSEL, m_riFormat.m_csColorSpace, 0);
			}
			CopyMemory(&m_riFormat, &riFormat, sizeof(RAWIMAGE));
		}
		else
		{
			// 猜测尺寸
			GetSize(tzFileName);
		}

		// 打开文件
		m_pWnd->Open(tzFileName, &m_riFormat);

		// 设置校验过的格式		
		SetDlgItemInt(m_hWnd, IDC_Open_Width, m_riFormat.m_uWidth, FALSE);
		SetDlgItemInt(m_hWnd, IDC_Open_Height, m_riFormat.m_iHeight, TRUE);
		SetDlgItemInt(m_hWnd, IDC_Open_FrameRate, m_riFormat.m_uFrameRate, FALSE);
		SetDlgItemInt(m_hWnd, IDC_Open_FrameStep, m_riFormat.m_iFrameStep, TRUE);
		OnCommand(IDC_RawVideo_Seek);
		break;

	case CDN_FILEOK:
		// 验证格式是否正确
		SetFocus(m_hToolbar);
		if (m_pWnd->m_uTotalFrame)
		{
			m_pWnd->Stop();

			// 保存设置			
			bPreview = IsPreviewChecked();
			CIni::SetInt(INI_OpenPeview, bPreview);

			// 记录历史格式
			m_riFormat = *m_pWnd;
			CIni::SetStruct(INI_HistroyFormat, &m_riFormat, sizeof(RAWIMAGE));
			CIni::SetStruct(INI_HistroyFormat, m_pWnd->m_tzFileName, &m_riFormat, sizeof(RAWIMAGE));
			break;
		}
		else
		{
			SetWindowLongPtr(m_hWnd, DWLP_MSGRESULT, S_FALSE);
			return S_FALSE;
		}
		break;

	case TTN_NEEDTEXT:
		// 显示工具栏提示
		GetMenuString(CMainWnd::m_hMenu, (UINT) wParam, ((LPTOOLTIPTEXT) lParam)->szText, 80, MF_BYCOMMAND);
	}

	return 0;
}
コード例 #10
0
ファイル: CXPSpinBox.c プロジェクト: zxlooong/minica
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 绘制旋转控件
VOID CXPDrawSpinBox(PCCLASSXP pCxp)
{
	UINT x;
	UINT y;
	UINT i;
	UINT j;
	HDC hDC;
	RECT rtRect;
	PBYTE pbDib;
	BITMAPINFOHEADER biCmb;

	// 开始绘制
	_CXPBeginDraw(hDC, FALSE, TRUE);

	// 绘制外框
	if (pCxp->lParam)
	{
		_FrameRect(_CXPGetState(CXPS_DISABLED) ? CXPR_DFRAME : CXPR_FRAME);
		InflateRect(&rtRect, -1, -1);

		x = (_CXPGetState(CXPS_LEFTSPIN)) ? rtRect.right : 0;
		i = (((PCLASSXP) pCxp->lParam)->lState & (CXPS_DISABLED | CXPS_READONLY)) ? CXPR_DWINDOW : CXPR_WINDOW;
		_DrawLine(x, rtRect.top, x, rtRect.bottom, i);
	}

	// 绘制内框
	_FillRect(GetSysColor(COLOR_WINDOW));
	InflateRect(&rtRect, -1, -1);

	// 选择图像
	if (_CXPGetState(CXPS_DISABLED))
	{
		i = 0;
		j = 0;
	}
	else
	{
		if (_CXPGetState(CXPS_PRESSED))
		{
			i = 1;
		}
		else if (_CXPGetState(CXPS_HOTLIGHT))
		{
			i = 2;
		}
		else
		{
			i = 3;
		}

		if (_CXPGetState(CXPS_FIRSTPART))
		{
			j = 3;
		}
		else
		{
			j = i;
			i = 3;
		}
	}

	// 绘制图象
	biCmb = c_biCXPCheck;

	if (_CXPGetState(CXPS_HORIZON))
	{
		x = _RectWidth(rtRect);
		biCmb.biWidth = x / 2;
		biCmb.biHeight = _RectHeight(rtRect);
		x = rtRect.left + biCmb.biWidth + (x & 1);
		y = rtRect.top;
	}
	else
	{
		y = _RectHeight(rtRect);
		biCmb.biWidth = _RectWidth(rtRect);
		biCmb.biHeight = y / 2;
		x = rtRect.left;
		y = rtRect.top + biCmb.biHeight + (y & 1);
	}

	biCmb.biSizeImage = biCmb.biWidth * biCmb.biHeight * 4;
	pbDib = (PBYTE) _HeapAlloc(biCmb.biSizeImage);
	if (pbDib)
	{
		CXPDibBlendExt((PBYTE) pbDib, biCmb.biWidth, biCmb.biHeight, (PBYTE) c_crCXPComboBox[i], CXPW_CMB, CXPH_CMB);
		_DrawDIB(rtRect.left, rtRect.top, biCmb.biWidth, biCmb.biHeight, pbDib, &biCmb);

		CXPDibBlendExt((PBYTE) pbDib, biCmb.biWidth, biCmb.biHeight, (PBYTE) c_crCXPComboBox[j], CXPW_CMB, CXPH_CMB);
		_DrawDIB(x, y, biCmb.biWidth, biCmb.biHeight, pbDib, &biCmb);

		_HeapFree(pbDib);
	}

	// 绘制箭头
	i = _CXPGetState(CXPS_DISABLED) ? CXPR_DARROW : CXPR_ARROW;
	x = rtRect.left + (biCmb.biWidth / 2);
	y = rtRect.top + (biCmb.biHeight / 2);
	if (_CXPGetState(CXPS_HORIZON))
	{
		CXPDrawArrow(hDC, x, y, CXPA_SMALLLEFT, i);
		x += biCmb.biWidth;
		CXPDrawArrow(hDC, x, y, CXPA_SMALLRIGHT, i);
	}
	else
	{
		CXPDrawArrow(hDC, x, y, CXPA_SMALLUP, i);
		y += biCmb.biHeight;
		CXPDrawArrow(hDC, x, y, CXPA_SMALLDOWN, i);
	}

	// 结束绘制
	_CXPEndDraw(hDC);
}
コード例 #11
0
ファイル: ChildWnd.cpp プロジェクト: Yonsm/RawPlayer
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 点击状态栏
VOID CChildWnd::OnClickStatusBar(UINT uIndex)
{
	UINT i;
	RECT rtRect;
	DWORD dwStyle;
	TCHAR tzText[512];
	TCHAR tzCSConv[MAX_PATH];

	// 如果是在可以编辑的栏目点击
	_ReturnIf(m_bExporting);
	m_uEditBox = uIndex;
	if ((m_uEditBox >= SBI_ColorSpace) && (m_uEditBox <= SBI_CurFrame))
	{
		// 移动编辑框到相应栏目
		SendMessage(m_hStatusBar, SB_GETRECT, m_uEditBox, (LPARAM) &rtRect);
		InflateRect(&rtRect, -2, -2);
		MoveWindow(m_hEditBox, rtRect.left, rtRect.top, _RectWidth(rtRect), _RectHeight(rtRect), TRUE);

		// 设置编辑框风格和状态栏提示
		dwStyle = GetWindowLong(m_hEditBox, GWL_STYLE);
		dwStyle |= ES_NUMBER;
		switch (m_uEditBox)
		{
		case SBI_ColorSpace:
			tzCSConv[0] = 0;
			for (i = 0; i < _NumOf(c_tzColorSpace); i++)
			{
				if (IsCharUpper(c_tzColorSpace[i][0]))
				{
					lstrcat(tzCSConv, c_tzColorSpace[i]);
					if (i < _NumOf(c_tzColorSpace) - 1)
					{
						lstrcat(tzCSConv, TEXT("/"));
					}
				}
			}
			wsprintf(tzText, LNG_ColorSpaceMsg, tzCSConv);
			dwStyle &= ~ES_NUMBER;
			break;

		case SBI_Width:
			wsprintf(tzText, LNG_FrameWidthMsg, MIN_Resolution, MAX_Resolution);
			break;

		case SBI_Height:
			wsprintf(tzText, LNG_FrameHeightMsg, MAX_Resolution, MIN_Resolution, MIN_Resolution, MAX_Resolution);
			dwStyle &= ~ES_NUMBER;
			break;

		case SBI_FrameRate:
			wsprintf(tzText, LNG_FrameRateMsg, 1, MAX_FrameRate);
			break;

		case SBI_FrameStep:
			wsprintf(tzText, LNG_FrameStepMsg, (INT) (1 - m_uTotalFrame), m_uTotalFrame - 1);
			dwStyle &= ~ES_NUMBER;
			break;

		case SBI_CurFrame:
			wsprintf(tzText, LNG_FrameIndexeMsg, 1, m_uTotalFrame);
			break;
		}
		SetStatusText(tzText);
		SetWindowLong(m_hEditBox, GWL_STYLE, dwStyle);

		// 设置编辑框内容并显示编辑框
		SendMessage(m_hStatusBar, SB_GETTEXT, m_uEditBox, (LPARAM) tzText);
		SetWindowText(m_hEditBox, tzText);
		ShowWindow(m_hEditBox, SW_SHOW);
		SetFocus(m_hEditBox);
		SendMessage(m_hEditBox, EM_SETSEL, 0, -1);
	}
	else
	{
		ShowWindow(m_hEditBox, SW_HIDE);
	}
}