資源簡介
win32實(shí)現(xiàn)的畫圖,可對整個(gè)屏幕進(jìn)行截圖,有工具欄和調(diào)色板的子窗口,可進(jìn)行一系列相關(guān)設(shè)置 可保存為bmp格式,并且可以打開 有橡皮功能
代碼片段和文件信息
#include“stdafx.h“
#include“ColorBox.h“
static?TCHAR?szColorBtnClass[]?=?TEXT(“ColorBtn“);
static?TCHAR?szColorBoxClass[]?=?TEXT(“ColorBox“);
ATOM?RegisterColorClass(HINSTANCE?hInstance)
{
WNDCLASSEX?wcex;
wcex.cbSize?=?sizeof(WNDCLASSEX);
wcex.style?=?CS_HREDRAW?|?CS_VREDRAW;
wcex.cbClsExtra?=?0;
wcex.cbWndExtra?=?0;
wcex.hInstance?=?hInstance;
wcex.hIcon?=?NULL;
wcex.hCursor?=?LoadCursor(NULL?IDC_ARROW);
wcex.hbrBackground?=?(HBRUSH)(COLOR_WINDOW?+?1);
wcex.lpszMenuName?=?NULL;
wcex.hIconSm?=?NULL;
wcex.lpszClassName?=?szColorBtnClass;
wcex.lpszMenuName?=?NULL;
wcex.lpfnWndProc?=?WndColorBtnProc;
wcex.cbWndExtra?=?4;
if?(!RegisterClassEx(&wcex))
return?0;
wcex.lpszClassName?=?szColorBoxClass;
wcex.lpszMenuName?=?NULL;
wcex.lpfnWndProc?=?WndColorBoxProc;
wcex.cbWndExtra?=?0;
if?(!RegisterClassEx(&wcex))
return?0;
return?1;
}
LRESULT?CALLBACK?WndColorBtnProc(HWND?hWnd?UINT?message?WPARAM?wParam?LPARAM?lParam)
{
PAINTSTRUCT?ps;
HDC?hdc;
COLORREF?color;
HBRUSH?hBr?hOldBr;
RECT?rt;
switch?(message)
{
case?WM_CREATE:
color?=?(COLORREF)((LPCREATESTRUCT)lParam)->lpCreateParams;
SetWindowLong(hWnd?0?color);
break;
case?WM_PAINT:
hdc?=?BeginPaint(hWnd?&ps);
GetClientRect(hWnd?&rt);
color?=?(COLORREF)GetWindowLong(hWnd?0);
hBr?=?CreateSolidBrush(color);
hOldBr?=?(HBRUSH)Selectobject(hdc?hBr);
Rectangle(hdc?0?0?rt.right?rt.bottom);
//?TODO:?在此添加任意繪圖代碼...
Selectobject(hdc?hOldBr);
Deleteobject(hBr);
EndPaint(hWnd?&ps);
break;
case?WM_LBUTTONDOWN:
color?=?(COLORREF)GetWindowLong(hWnd?0);
SendMessage(GetParent(hWnd)
WM_CHANGE_COLOR?(WPARAM)0?(LPARAM)color);
break;
case?WM_DESTROY:
break;
default:
return?DefWindowProc(hWnd?message?wParam?lParam);
}
return?0;
}
LRESULT?CALLBACK?WndColorBoxProc(HWND?hWnd?UINT?message?WPARAM?wParam?LPARAM?lParam)
{
PAINTSTRUCT?ps;
HDC?hdc;
int?i;
HWND?hWndColor;
static?COLORREF?aColor[24]?=?{
RGB(0?0?0)
RGB(192?192?192)?RGB(128?128?128)
RGB(255?0?0)?RGB(128?0?0)
RGB(255?255?0)?RGB(128?128?0)
RGB(0?255?0)?RGB(0?128?0)
RGB(0?255?255)?RGB(0?128?128)
RGB(0?0?255)?RGB(0?0?128)
RGB(255?0?255)?RGB(128?0?128)
RGB(255?255?128)?RGB(128?128?64)
RGB(0?255?128)?RGB(0?64?64)
RGB(128?255?255)?RGB(0?128?255)
RGB(128?128?255)?RGB(0?64?128)
RGB(255?0?128)
};
static?HWND?hWndSendTo;
switch?(message)
{
case?WM_CREATE:
hWndSendTo?=?(HWND)(((LPCREATESTRUCT)(lParam))
->lpCreateParams);
HINSTANCE?hInsthWnd;
hInsthWnd?=?(HINSTANCE)GetWindowLong(hWnd?GWL_HINSTANCE);
for?(i?=?0;?i?24;?i++)
{
if?(i?12){
hWndColor?=?CreateWindow(szColorBtnClass?NULL
WS_CHILD?i?*?40?0?40?40?hWnd?NULL?hInsthWnd?(LPVOID)aColor[i]);
ShowWindow(hWndColor?SW_NORMAL);
}
else{
hWndColor?=?CreateWindow(szColorBt
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-05-21?18:15??MyPaint3.0?-?副本?(2)\
?????目錄???????????0??2017-05-21?18:13??MyPaint3.0?-?副本?(2)\msvcp120d.i386.pdb\
?????目錄???????????0??2017-05-21?18:13??MyPaint3.0?-?副本?(2)\msvcp120d.i386.pdb\3C05516E57E740EB8D3F9722C5BD80DD1\
?????文件?????1179648??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\msvcp120d.i386.pdb\3C05516E57E740EB8D3F9722C5BD80DD1\download.error
?????目錄???????????0??2017-05-21?18:13??MyPaint3.0?-?副本?(2)\MyPaint\
?????文件????46399488??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint.sdf
?????文件?????????967??2017-05-08?20:10??MyPaint3.0?-?副本?(2)\MyPaint.sln
?????文件???????58880??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint.v12.suo
?????文件????????8177??2017-05-17?15:39??MyPaint3.0?-?副本?(2)\MyPaint\5wwrqarp.dwk
?????文件???????13975??2017-05-18?21:31??MyPaint3.0?-?副本?(2)\MyPaint\bhrrwi5m.0tp
?????文件????????4401??2017-05-19?15:00??MyPaint3.0?-?副本?(2)\MyPaint\ColorBox.cpp
?????文件?????????337??2017-05-15?20:15??MyPaint3.0?-?副本?(2)\MyPaint\ColorBox.h
?????目錄???????????0??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\
?????文件???????12979??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\ColorBox.obj
?????文件??????151811??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\Drawst
?????文件???????14616??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\Drawst
?????文件??????210154??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\FileSaveOpen.obj
?????文件????????1848??2017-05-19?14:10??MyPaint3.0?-?副本?(2)\MyPaint\Debug\MyPaint.Build.CppClean.log
?????文件????????3235??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\MyPaint.log
?????文件??????277766??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\MyPaint.obj
?????文件?????7012352??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\MyPaint.pch
?????文件???????23992??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\MyPaint.res
?????目錄???????????0??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\MyPaint.tlog\
?????文件???????10850??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\MyPaint.tlog\cl.command.1.tlog
?????文件???????90414??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\MyPaint.tlog\CL.read.1.tlog
?????文件???????11620??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\MyPaint.tlog\CL.write.1.tlog
?????文件????????4600??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\MyPaint.tlog\li
?????文件????????8732??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\MyPaint.tlog\li
?????文件????????2680??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\MyPaint.tlog\li
?????文件?????????193??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\MyPaint.tlog\MyPaint.lastbuildstate
?????文件????????1014??2017-05-21?18:14??MyPaint3.0?-?副本?(2)\MyPaint\Debug\MyPaint.tlog\rc.command.1.tlog
............此處省略51個(gè)文件信息
評論
共有 條評論