資源簡介
將二維數(shù)組傳遞給本函數(shù),本函數(shù)會(huì)將數(shù)組顯示為圖像。注意數(shù)組傳遞前需先轉(zhuǎn)換為char型。
圖像顯示是windows編程的基礎(chǔ),本程序可作為一個(gè)子函數(shù)用于調(diào)用,可同時(shí)顯示多張圖像。

代碼片段和文件信息
//?present.cpp?:?Defines?the?entry?point?for?the?application.
//
#include?“stdafx.h“
#include?“present.h“
#include?“presentation.h“
//?Global?Variables:
HINSTANCE?hInst;
TCHAR?lptitle[]?=?L“示例圖像“;
unsigned?char?lpImg[280?*?280];
unsigned?char?lpMaskImg[280?*?280];
//?Message?handler?for?about?box.
INT_PTR?CALLBACK?About(HWND?hDlg?UINT?message?WPARAM?wParam?LPARAM?lParam)
{
UNREFERENCED_PARAMETER(lParam);
HWND?hwnd;
switch?(message)
{
case?WM_INITDIALOG:
?InitImageShow(hInst?hDlg?NULL);
//SetWindowText?(hDlg?TEXT?(“Dialog?Box?Caption“))?;??
return?(INT_PTR)TRUE;
case?WM_COMMAND:
switch?(LOWORD(wParam))
{
case?IDOK:
case?IDCANCEL:
EndDialog(hDlg?LOWORD(wParam));
EndImageShow();
break;
case?IDC_LOAD_DATA:
MessageBox(hDlg?L“你擊了加載數(shù)據(jù)“?L“提示“MB_OK);
//?注意:?下面調(diào)用函數(shù)顯示圖像,著這里將圖像數(shù)組的指針傳遞給lpImg即可!!
//?想要顯示圖像,調(diào)用 OpenImageDisplay(hInstlptitle
//?imagePtr?NULL?200?200?3?NULL?NULL);即可
//?各參數(shù)說明見present函數(shù)。
hwnd?=?OpenImageDisplay(hInst?lptitle
lpImg?NULL?280?280?3?NULL?NULL);
break;
case?IDC_START_RECON:
MessageBox(hDlg?L“你擊了開始重建“?L“提示“MB_OK);
//?注意:?下面調(diào)用函數(shù)顯示圖像,著這里將圖像數(shù)組的指針傳遞給lpImg即可!!
hwnd?=?OpenImageDisplay(hInst?lptitle
lpImg?NULL?280?280?3?NULL?NULL);
AddMaskImageShow(hwnd?280?280?lpMaskImg);
break;
}
}
return?(INT_PTR)FALSE;
}
int?APIENTRY?_tWinMain(HINSTANCE?hInstance
?????????????????????HINSTANCE?hPrevInstance
?????????????????????LPTSTR????lpCmdLine
?????????????????????int???????nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
int?i;
for?(i=0;?i<280?*?280;?i++)
{
lpImg[i]?=?(i?/?280?+?i?%?280)?%?256;
lpMaskImg[i]?=?256?-?(i?/?280?+?i?%?280)?%?256;
}
hInst?=?hInstance;
return?(int)?DialogBoxParam(hInst?MAKEINTRESOURCE(IDD_ABOUTBOX)?NULL?About?NULL);
//return?(int)?DialogBoxParam(hInst?IDABORT?NULL?About?NULL);
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件??????77824??2011-11-17?14:07??present\Debug\present.exe
?????文件?????830464??2011-11-17?14:07??present\Debug\present.pdb
?????文件??????52608??2011-11-17?14:07??present\present\present.aps
?????文件???????2157??2012-03-14?18:10??present\present\present.cpp
?????文件?????????39??2011-11-14?19:38??present\present\present.h
????.......?????23558??2003-07-23?17:52??present\present\present.ico
?????文件???????4139??2011-11-17?14:07??present\present\present.rc
?????文件???????4997??2011-11-14?20:34??present\present\present.vcproj
?????文件???????1427??2012-03-14?18:10??present\present\present.vcproj.302-BAA34190086.zhanghui.user
?????文件???????1409??2011-11-14?21:19??present\present\present.vcproj.hahaha.doumx.user
?????文件??????31275??2011-11-14?21:03??present\present\presentation.cpp
?????文件????????475??2011-11-14?21:09??present\present\presentation.h
?????文件???????2165??2011-11-14?19:38??present\present\ReadMe.txt
?????文件???????1078??2011-11-17?14:07??present\present\resource.h
?????文件??????23558??2003-07-23?17:52??present\present\small.ico
?????文件????????294??2011-11-14?19:38??present\present\stdafx.cpp
?????文件????????529??2011-11-14?19:38??present\present\stdafx.h
?????文件???????1428??2011-11-14?19:38??present\present\targetver.h
?????文件????7523328??2012-03-14?18:10??present\present.ncb
?????文件????????887??2011-11-14?19:38??present\present.sln
????..A..H.?????26624??2012-03-14?18:10??present\present.suo
?????目錄??????????0??2011-11-17?14:07??present\Debug
?????目錄??????????0??2012-03-14?18:10??present\present
?????目錄??????????0??2011-11-14?22:39??present
-----------?---------??----------?-----??----
??????????????8610263????????????????????24
評論
共有 條評論