本文整理汇总了C++中OnPaint函数的典型用法代码示例。如果您正苦于以下问题:C++ OnPaint函数的具体用法?C++ OnPaint怎么用?C++ OnPaint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OnPaint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPaint
void
Window::OnPaint(Canvas &canvas, const PixelRect &dirty)
{
OnPaint(canvas);
}
示例2: pe
void WindowLevelToolPanel::CreateHistogramImage()
{
// Make sure there is valid histrogram data.
if (histogram_.size() != nbins_)
return;
// Create the image data;
for( unsigned int i=0; i<nbins_ * 125 * 3; ++i )
histogram_image_data_[i] = 0;
float max_values = 1;
// Ignore the first and last bin as it usually contains lots of
// nothing. This gives a better histogram.
for( unsigned int i=1; i<histogram_.size()-1; ++i)
max_values = max_values > histogram_[i] ? max_values : histogram_[i];
// Load the histogram data
for( unsigned int i=0; i<histogram_.size(); ++i)
{
unsigned int height =
(unsigned int) (125.0 * (1.0 - (float) histogram_[i] / max_values));
if( height > 125 )
height = 125;
for( unsigned int j=0; j<height; ++j)
{
histogram_image_data_[(j*nbins_+i)*3 ] = 150;
histogram_image_data_[(j*nbins_+i)*3+1] = 150;
histogram_image_data_[(j*nbins_+i)*3+2] = 150;
}
}
// Now do the window and level bounds.(Divide by 1000 ticks into 200
// bins == 5)
unsigned int window_lower = (unsigned int)
((nbins_- 1.0) *
(float) (mLevelSlider->GetValue() - mWindowSlider->GetValue()/2 ) / 1000.0);
if( window_lower < 0 )
window_lower = 0;
if( window_lower > (nbins_-1) )
window_lower = (nbins_-1);
unsigned int window_upper = (unsigned int)
((nbins_-1.0) *
(float) (mLevelSlider->GetValue() + mWindowSlider->GetValue()/2 ) / 1000.0);
if( window_upper < 0 )
window_upper = 0;
if( window_upper > (nbins_-1) )
window_upper = (nbins_-1);
unsigned int level = (unsigned int)
((nbins_-1.0) * (float) mLevelSlider->GetValue() / 1000.0);
if( level < 0 )
level = 0;
if( level > (nbins_-1) )
level = (nbins_-1);
for( unsigned int j=0; j<125; ++j)
{
histogram_image_data_[(j*nbins_+window_lower)*3 ] = 0;
histogram_image_data_[(j*nbins_+window_lower)*3+1] = 150;
histogram_image_data_[(j*nbins_+window_lower)*3+2] = 0;
}
for( unsigned int j=0; j<125; ++j)
{
histogram_image_data_[(j*nbins_+window_upper)*3 ] = 0;
histogram_image_data_[(j*nbins_+window_upper)*3+1] = 150;
histogram_image_data_[(j*nbins_+window_upper)*3+2] = 0;
}
for( unsigned int j=0; j<125; ++j)
{
histogram_image_data_[(j*nbins_+level)*3 ] = 150;
histogram_image_data_[(j*nbins_+level)*3+1] = 0;
histogram_image_data_[(j*nbins_+level)*3+2] = 0;
}
// Anytime the histogram gets changed throw a paint event so that it
// shows up on the inital view.
wxPaintEvent pe(0);
OnPaint( pe );
}
示例3: WndProcLabelWithClose
static LRESULT CALLBACK WndProcLabelWithClose(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) {
if (WM_ERASEBKGND == msg) {
return TRUE; // tells Windows we handle background erasing so it doesn't do it
}
LabelWithCloseWnd *w = nullptr;
if (WM_NCCREATE == msg) {
LPCREATESTRUCT lpcs = reinterpret_cast<LPCREATESTRUCT>(lp);
w = reinterpret_cast<LabelWithCloseWnd *>(lpcs->lpCreateParams);
w->hwnd = hwnd;
SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast<LPARAM>(w));
goto DoDefault;
} else {
w = reinterpret_cast<LabelWithCloseWnd *>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
}
if (!w) {
goto DoDefault;
}
// to match other controls, preferred way is explict SetFont() call
if (WM_SETFONT == msg) {
SetFont(w, (HFONT)wp);
return 0;
}
if (WM_GETFONT == msg) {
return (LRESULT)w->font;
}
if (WM_SIZE == msg) {
int dx = LOWORD(lp);
int dy = HIWORD(lp);
CalcCloseButtonPos(w, dx, dy);
ScheduleRepaint(hwnd);
return 0;
}
if (WM_MOUSEMOVE == msg) {
ScheduleRepaint(w->hwnd);
if (IsMouseOverClose(w)) {
// ask for WM_MOUSELEAVE notifications
TRACKMOUSEEVENT tme = { 0 };
tme.cbSize = sizeof(tme);
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = hwnd;
TrackMouseEvent(&tme);
}
goto DoDefault;
}
if (WM_MOUSELEAVE == msg) {
ScheduleRepaint(w->hwnd);
return 0;
}
if (WM_LBUTTONUP == msg) {
if (IsMouseOverClose(w)) {
HWND parent = GetParent(w->hwnd);
SendMessage(parent, WM_COMMAND, w->cmd, 0);
}
return 0;
}
if (WM_PAINT == msg) {
OnPaint(w);
return 0;
}
DoDefault:
return DefWindowProc(hwnd, msg, wp, lp);
}
示例4: switch
LRESULT MainWindow::OnReceiveMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
HRESULT hr;
switch (message)
{
case WM_CREATE:
hr = OnCreate();
if (FAILED(hr))
{
// Fail and quit.
NotifyError(m_hwnd, TEXT("Cannot initialize the application."), hr);
return -1;
}
break;
case WM_SIZE:
OnSize();
break;
case WM_PAINT:
OnPaint();
break;
case WM_MOVE:
OnPaint();
break;
case WM_DISPLAYCHANGE:
m_pPlayer->DisplayModeChanged();
break;
case WM_ERASEBKGND:
return 1;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_TIMER:
OnTimer();
break;
case WM_NOTIFY:
OnWmNotify((NMHDR*)lParam);
break;
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
switch (wmId)
{
case IDM_EXIT:
DestroyWindow(m_hwnd);
break;
case ID_FILE_OPENFILE:
OnFileOpen();
break;
case IDC_BUTTON_PLAY:
OnPlay();
break;
case IDC_BUTTON_STOP:
OnStop();
break;
case IDC_BUTTON_PAUSE:
OnPause();
break;
case IDC_BUTTON_MUTE:
OnMute();
break;
}
break;
// Private filter graph message.
case WM_GRAPH_EVENT:
hr = m_pPlayer->HandleGraphEvent(this);
break;
default:
return BaseWindow::OnReceiveMessage(message, wParam, lParam);
}
return 0;
}
示例5: BeginPaint
LRESULT CFrameHolder::OnPaint(HWND hWnd, HDC hdc, UINT uMsg)
{
if (hdc == NULL)
{
LRESULT lRc = 0;
PAINTSTRUCT ps = {0};
hdc = BeginPaint(hWnd, &ps);
if (hdc != NULL)
{
lRc = OnPaint(hWnd, hdc, uMsg);
EndPaint(hWnd, &ps);
}
else
{
_ASSERTE(hdc != NULL);
}
return lRc;
}
#ifdef _DEBUG
RECT rcClientReal = {}; GetClientRect(hWnd, &rcClientReal);
MapWindowPoints(hWnd, NULL, (LPPOINT)&rcClientReal, 2);
#endif
// Если "завис" PostUpdate
if (gpConEmu->mp_TabBar->NeedPostUpdate())
gpConEmu->mp_TabBar->Update();
// Go
RECT wr, cr;
RecalculateFrameSizes();
wr = gpConEmu->GetGuiClientRect();
#ifdef _DEBUG
wchar_t szPaint[140];
_wsprintf(szPaint, SKIPCOUNT(szPaint) L"MainClient %s at {%i,%i}-{%i,%i} screen coords, size (%ix%i) calc (%ix%i)",
(uMsg == WM_PAINT) ? L"WM_PAINT" : (uMsg == WM_PRINTCLIENT) ? L"WM_PRINTCLIENT" : L"UnknownMsg",
LOGRECTCOORDS(rcClientReal), LOGRECTSIZE(rcClientReal), LOGRECTSIZE(wr));
DEBUGSTRPAINT(szPaint);
#endif
#if defined(CONEMU_TABBAR_EX)
#ifdef RED_CLIENT_FILL
HBRUSH h = CreateSolidBrush(RGB(255,0,0));
FillRect(hdc, &wr, h);
DeleteObject(h);
return 0;
#endif
#endif
if (gpSet->isStatusBarShow)
{
int nHeight = gpSet->StatusBarHeight();
if (nHeight < (wr.bottom - wr.top))
{
RECT rcStatus = {wr.left, wr.bottom - nHeight, wr.right, wr.bottom};
gpConEmu->mp_Status->PaintStatus(hdc, &rcStatus);
wr.bottom = rcStatus.top;
}
}
cr = wr;
DEBUGTEST(FrameDrawStyle dt = gpConEmu->DrawType());
#if defined(CONEMU_TABBAR_EX)
RECT tr = {};
if (!gpSet->isTabsInCaption)
{
_ASSERTE(gpConEmu->GetDwmClientRectTopOffset() == 0); // CheckIt, must be zero
if (gpSet->isTabs)
{
RECT captrect = gpConEmu->CalcRect(CER_TAB, wr, CER_MAINCLIENT);
//CalculateCaptionPosition(cr, &captrect);
CalculateTabPosition(cr, captrect, &tr);
PaintDC dc = {false};
RECT pr = {captrect.left, 0, captrect.right, captrect.bottom};
gpConEmu->BeginBufferedPaint(hdc, pr, dc);
gpConEmu->mp_TabBar->PaintTabs(dc, captrect, tr);
gpConEmu->EndBufferedPaint(dc, TRUE);
}
}
else if (dt == fdt_Aero || dt == fdt_Win8)
{
_ASSERTE(gpSet->isTabsInCaption);
int nOffset = gpConEmu->GetDwmClientRectTopOffset();
//.........这里部分代码省略.........
示例6: WndProc
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
switch (wmId)
{
case IDM_COPY:
OnCopy(hWnd);
break;
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case IDM_200X150:
OnChangeSize(hWnd, 200, 150);
sizetype = ST_200X150;
break;
case IDM_320X240:
OnChangeSize(hWnd, 320, 240);
sizetype = ST_320X240;
break;
case IDM_640X480:
OnChangeSize(hWnd, 640, 480);
sizetype = ST_640X480;
break;
case IDM_1024X768:
OnChangeSize(hWnd, 1024, 768);
sizetype = ST_1024X768;
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
}
break;
case WM_INITMENUPOPUP:
OnInitMenuPopup(hWnd, (HMENU)wParam);
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
OnPaint(hWnd, hdc);
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
示例7: InvalidateRgn
void CPipProp::Repaint(HRGN rgn)
{
InvalidateRgn(m_hDlg, rgn, TRUE);
UpdateWindow(m_hDlg);
OnPaint();
}
示例8: OnPaint
void CLkDuiCheckBox::NotifyMouseIn(BOOL bIn)
{
bg_show_index_ = bIn ? 1 : 0;
is_erase_bg_ = TRUE;
OnPaint();
}
示例9: GetEnableState
LRESULT C_SpinButton::OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
C_STLException::install();
try {
BOOL enabled = GetEnableState(m_hWnd);
C_PaintDC dc(*this);
OnPaint(dc);
RECT rEdit;
m_ed.GetWindowRect(&rEdit);
RECT rWnd;
GetWindowRect(&rWnd);
RECT r = { 0, 0, rEdit.left - rWnd.left - 5, rEdit.bottom - rEdit.top };
dc.SetBkMode(TRANSPARENT);
static unsigned int unAlign = DT_RIGHT | DT_VCENTER | DT_SINGLELINE;
if (enabled) {
dc.CreateFontIndirect(m_lFont);
dc.DrawText(m_sTranslation, m_sTranslation.GetLength(), &r, unAlign);
}
else {
r.left += 1;
r.top += 1;
r.right += 1;
r.bottom += 1;
OLE_COLOR col = dc.SetTextColor(GetSysColor(COLOR_BTNFACE));
dc.CreateFontIndirect(m_lFont);
dc.DrawText(m_sTranslation, m_sTranslation.GetLength(), &r, unAlign);
r.left -= 1;
r.top -= 1;
r.right -= 1;
r.bottom -= 1;
dc.SetTextColor(GetSysColor(COLOR_BTNSHADOW));
dc.CreateFontIndirect(m_lFont);
dc.DrawText(m_sTranslation, m_sTranslation.GetLength(), &r, unAlign);
dc.SetTextColor(col);
}
::UpdateWindow(m_btnUp);
::UpdateWindow(m_btnDown);
m_ed.Invalidate();
}
catch (C_STLNonStackException const &exception) {
exception.Log(_T("Exception in C_SpinButton::OnPaint"));
}
catch (...) {
}
return S_OK;
}
示例10: ChildWndProc
/*******************************************************************************
*
* FUNCTION: ChildWndProc(HWND, unsigned, WORD, LONG)
*
* PURPOSE: Processes messages for the child windows.
*
* WM_COMMAND - process the application menu
* WM_PAINT - Paint the main window
* WM_DESTROY - post a quit message and return
*
*/
LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
BOOL Result;
switch (message)
{
case WM_CREATE:
{
WNDPROC oldproc;
HFONT hFont;
WCHAR buffer[MAX_PATH];
/* Load "My Computer" string */
LoadStringW(hInst, IDS_MY_COMPUTER, buffer, COUNT_OF(buffer));
g_pChildWnd = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ChildWnd));
if (!g_pChildWnd) return 0;
wcsncpy(g_pChildWnd->szPath, buffer, MAX_PATH);
g_pChildWnd->nSplitPos = 250;
g_pChildWnd->hWnd = hWnd;
g_pChildWnd->hAddressBarWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Edit", NULL, WS_CHILD | WS_VISIBLE | WS_CHILDWINDOW | WS_TABSTOP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
hWnd, (HMENU)0, hInst, 0);
g_pChildWnd->hAddressBtnWnd = CreateWindowExW(0, L"Button", L"»", WS_CHILD | WS_VISIBLE | WS_CHILDWINDOW | WS_TABSTOP | BS_TEXT | BS_CENTER | BS_VCENTER | BS_FLAT | BS_DEFPUSHBUTTON,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
hWnd, (HMENU)0, hInst, 0);
g_pChildWnd->hTreeWnd = CreateTreeView(hWnd, g_pChildWnd->szPath, (HMENU) TREE_WINDOW);
g_pChildWnd->hListWnd = CreateListView(hWnd, (HMENU) LIST_WINDOW/*, g_pChildWnd->szPath*/);
SetFocus(g_pChildWnd->hTreeWnd);
/* set the address bar and button font */
if ((g_pChildWnd->hAddressBarWnd) && (g_pChildWnd->hAddressBtnWnd))
{
hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
SendMessageW(g_pChildWnd->hAddressBarWnd,
WM_SETFONT,
(WPARAM)hFont,
0);
SendMessageW(g_pChildWnd->hAddressBtnWnd,
WM_SETFONT,
(WPARAM)hFont,
0);
}
/* Subclass the AddressBar */
oldproc = (WNDPROC)(LONG_PTR)GetWindowLongPtr(g_pChildWnd->hAddressBarWnd, GWLP_WNDPROC);
SetWindowLongPtr(g_pChildWnd->hAddressBarWnd, GWLP_USERDATA, (DWORD_PTR)oldproc);
SetWindowLongPtr(g_pChildWnd->hAddressBarWnd, GWLP_WNDPROC, (DWORD_PTR)AddressBarProc);
break;
}
case WM_COMMAND:
if(HIWORD(wParam) == BN_CLICKED)
{
PostMessageW(g_pChildWnd->hAddressBarWnd, WM_KEYUP, VK_RETURN, 0);
}
if (!_CmdWndProc(hWnd, message, wParam, lParam))
{
goto def;
}
break;
case WM_PAINT:
OnPaint(hWnd);
return 0;
case WM_SETCURSOR:
if (LOWORD(lParam) == HTCLIENT)
{
POINT pt;
GetCursorPos(&pt);
ScreenToClient(hWnd, &pt);
if (pt.x>=g_pChildWnd->nSplitPos-SPLIT_WIDTH/2 && pt.x<g_pChildWnd->nSplitPos+SPLIT_WIDTH/2+1)
{
SetCursor(LoadCursorW(0, IDC_SIZEWE));
return TRUE;
}
}
goto def;
case WM_DESTROY:
DestroyTreeView();
DestroyListView(g_pChildWnd->hListWnd);
DestroyMainMenu();
HeapFree(GetProcessHeap(), 0, g_pChildWnd);
g_pChildWnd = NULL;
PostQuitMessage(0);
break;
case WM_LBUTTONDOWN:
{
RECT rt;
int x = (short)LOWORD(lParam);
//.........这里部分代码省略.........
示例11: OnPaint
void CSequenceSetting::paintEvent(QPaintEvent *)
{
OnPaint();
}
示例12: WndMainProc
LRESULT CALLBACK WndMainProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_PAINT:
OnPaint(hWnd);
break;
case WM_DISPLAYCHANGE:
if (pWC)
pWC->DisplayModeChanged();
break;
// Resize the video when the window changes
case WM_MOVE:
case WM_SIZE:
if (hWnd == ghApp)
MoveVideoWindow();
break;
// Enforce a minimum size
case WM_GETMINMAXINFO:
{
LPMINMAXINFO lpmm = (LPMINMAXINFO) lParam;
if (lpmm)
{
lpmm->ptMinTrackSize.x = MINIMUM_VIDEO_WIDTH;
lpmm->ptMinTrackSize.y = MINIMUM_VIDEO_HEIGHT;
}
}
break;
case WM_KEYDOWN:
switch(toupper((int) wParam))
{
case VK_ESCAPE:
case VK_F12:
CloseClip();
break;
}
break;
case WM_COMMAND:
switch(wParam)
{ // Menus
case ID_FILE_OPENCLIP:
// If we have ANY file open, close it and shut down DirectShow
CloseClip();
OpenClip(); // Open the new clip
break;
case ID_FILE_INITCLIP:
OpenClip();
break;
case ID_FILE_EXIT:
CloseClip();
PostQuitMessage(0);
break;
case ID_FILE_CLOSE:
CloseClip();
break;
case ID_DISABLE:
FlipFlag(MARK_DISABLE);
DisableTicker(g_dwTickerFlags);
break;
case ID_SLIDE:
FlipFlag(MARK_SLIDE);
SlideTicker(g_dwTickerFlags);
break;
case ID_TICKER_STATIC_IMAGE:
g_dwTickerFlags |= MARK_STATIC_IMAGE;
g_dwTickerFlags &= ~(MARK_DYNAMIC_TEXT);
BlendApplicationImage(ghApp);
CheckMenuItem(ghMenu, ID_TICKER_STATIC_IMAGE, MF_CHECKED);
CheckMenuItem(ghMenu, ID_TICKER_DYNAMIC_TEXT, MF_UNCHECKED);
break;
case ID_TICKER_DYNAMIC_TEXT:
g_dwTickerFlags |= MARK_DYNAMIC_TEXT;
g_dwTickerFlags &= ~(MARK_STATIC_IMAGE);
BlendApplicationText(ghApp, g_szAppText);
CheckMenuItem(ghMenu, ID_TICKER_STATIC_IMAGE, MF_UNCHECKED);
CheckMenuItem(ghMenu, ID_TICKER_DYNAMIC_TEXT, MF_CHECKED);
break;
case ID_SET_FONT:
g_hFont = UserSelectFont(); // Change the current font
PostMessage(ghApp, WM_COMMAND, ID_TICKER_DYNAMIC_TEXT, 0);
break;
case ID_SET_TEXT:
DialogBox(ghInst, MAKEINTRESOURCE(IDD_DIALOG_TEXT),
//.........这里部分代码省略.........
示例13: WndProc
//.........这里部分代码省略.........
SetWindowPos(hToolTip, HWND_TOPMOST,
tip_rect.left, tip_rect.top,
0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_SHOWWINDOW);
}
#endif
SetCapture(hWnd);
break;
case WM_LBUTTONUP:
ShowWindow(hToolTip, SW_HIDE);
ReleaseCapture();
i = Point2Item(LOWORD(lParam), HIWORD(lParam));
if(i != -1 && i == SelItem) {
if (!is_running) {
is_running = 1;
ShellOpen((FileList + i)->FileName, (FileList + i)->CommandLine);
Sleep(1000);
is_running = 0;
}
}
SelItem = -1;
InvalidateRect(hWnd, NULL, FALSE);
UpdateWindow(hWnd);
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
OnPaint(hWnd, hdc, &ps);
EndPaint(hWnd, &ps);
break;
case WM_ERASEBKGND:
return 1;
case WM_TIMER:
switch(wParam)
{
case ID_ICON_TIMER:
// JMW maybe break here?
KillTimer(hWnd, ID_ICON_TIMER);
InvalidateRect(hWnd, NULL, FALSE);
UpdateWindow(hWnd);
break;
}
break;
default:
return DefWindowProc(hWnd, msg, wParam, lParam);
}
return 0;
}
示例14: switch
LRESULT VDUIHotKeyExControlW32::WndProc(UINT msg, WPARAM wParam, LPARAM lParam) {
switch(msg) {
case WM_NCCREATE:
SetFont(NULL);
break;
case WM_GETDLGCODE:
if (lParam)
return DLGC_WANTMESSAGE;
return DLGC_WANTALLKEYS;
case WM_ERASEBKGND:
return FALSE;
case WM_PAINT:
OnPaint();
return 0;
case WM_GETFONT:
return (LRESULT)wParam;
case WM_SETFONT:
SetFont((HFONT)wParam);
if (LOWORD(lParam))
InvalidateRect(mhwnd, NULL, TRUE);
return 0;
case WM_LBUTTONDOWN:
SetFocus(mhwnd);
return 0;
case WM_SETFOCUS:
CreateCaret(mhwnd, NULL, 0, mFontHeight);
UpdateCaretPosition();
ShowCaret(mhwnd);
break;
case WM_KILLFOCUS:
HideCaret(mhwnd);
DestroyCaret();
break;
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
mAccel.mVirtKey = 0;
mAccel.mModifiers = 0;
if (wParam == VK_CONTROL)
mCurrentMods |= VDUIAccelerator::kModCtrl;
else if (wParam == VK_SHIFT)
mCurrentMods |= VDUIAccelerator::kModShift;
else if (wParam == VK_MENU)
mCurrentMods |= VDUIAccelerator::kModAlt;
else {
mAccel.mVirtKey = wParam;
if (lParam & (1 << 24))
mAccel.mModifiers |= VDUIAccelerator::kModExtended;
}
mAccel.mModifiers |= mCurrentMods;
UpdateText();
UpdateCaretPosition();
mEventOnChange.Raise(this, mAccel);
return 0;
case WM_SYSKEYUP:
case WM_KEYUP:
if (wParam == VK_CONTROL)
mCurrentMods &= ~VDUIAccelerator::kModCtrl;
else if (wParam == VK_SHIFT)
mCurrentMods &= ~VDUIAccelerator::kModShift;
else if (wParam == VK_MENU)
mCurrentMods &= ~VDUIAccelerator::kModAlt;
else
break;
UpdateText();
UpdateCaretPosition();
mEventOnChange.Raise(this, mAccel);
return 0;
}
return DefWindowProc(mhwnd, msg, wParam, lParam);
}
示例15: OnPaint
afx_msg void CMainWin::OnRButtonDown(UINT, CPoint loc)
{
flag = 2,clear=0;
OnPaint();
this->InvalidateRect(0);
}