• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ OnPaint函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中OnPaint函数的典型用法代码示例。如果您正苦于以下问题:C++ OnPaint函数的具体用法?C++ OnPaint怎么用?C++ OnPaint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了OnPaint函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: OnPaint

void
Window::OnPaint(Canvas &canvas, const PixelRect &dirty)
{
  OnPaint(canvas);
}
开发者ID:damianob,项目名称:xcsoar,代码行数:5,代码来源:Window.cpp


示例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 );
}
开发者ID:pip010,项目名称:scirun4plus,代码行数:91,代码来源:windowleveltoolpanel.cpp


示例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);
}
开发者ID:nqsnqs,项目名称:sumatrapdf,代码行数:73,代码来源:LabelWithCloseWnd.cpp


示例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;
}
开发者ID:AbdoSalem95,项目名称:WindowsSDK7-Samples,代码行数:91,代码来源:MainWindow.cpp


示例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();
//.........这里部分代码省略.........
开发者ID:huyiice,项目名称:ConEmu,代码行数:101,代码来源:FrameHolder.cpp


示例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;
}
开发者ID:davehorner,项目名称:XScreenSaverWin,代码行数:67,代码来源:debughelper.cpp


示例7: InvalidateRgn

void CPipProp::Repaint(HRGN rgn)
{
    InvalidateRgn(m_hDlg, rgn, TRUE);
    UpdateWindow(m_hDlg);
    OnPaint();
}
开发者ID:chinajeffery,项目名称:dx_sdk,代码行数:6,代码来源:PropSetter.cpp


示例8: OnPaint

	void CLkDuiCheckBox::NotifyMouseIn(BOOL bIn)
	{
		bg_show_index_ = bIn ? 1 : 0;
		is_erase_bg_ = TRUE;
		OnPaint();
	}
开发者ID:Linkai16,项目名称:Interface-Library,代码行数:6,代码来源:LkDuiCheckBox.cpp


示例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;
}
开发者ID:ElliottBignell,项目名称:HeadCase,代码行数:66,代码来源:SpinButton.cpp


示例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);
//.........这里部分代码省略.........
开发者ID:RareHare,项目名称:reactos,代码行数:101,代码来源:childwnd.c


示例11: OnPaint

void CSequenceSetting::paintEvent(QPaintEvent *)
{
   OnPaint(); 
}
开发者ID:zeroCoder1,项目名称:nesicide,代码行数:4,代码来源:SequenceSetting.cpp


示例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),
//.........这里部分代码省略.........
开发者ID:chinajeffery,项目名称:dx_sdk,代码行数:101,代码来源:ticker.cpp


示例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;

}
开发者ID:scottp,项目名称:xcsoar,代码行数:101,代码来源:XCSoarLaunch.c


示例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);
}
开发者ID:KGE-INC,项目名称:VirtualDub,代码行数:89,代码来源:HotKeyExControl.cpp


示例15: OnPaint

afx_msg void CMainWin::OnRButtonDown(UINT, CPoint loc)
{
	flag = 2,clear=0;
	OnPaint();
	this->InvalidateRect(0);
}
开发者ID:anasztazy,项目名称:Laboratory,代码行数:6,代码来源:Исходный+код.cpp


示例16: WndProc

LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int gap = bevelWidth + borderWidth;

	switch (message)
	{
		case WM_PAINT:
		{
			OnPaint(hwnd);
		}
		break;

		// ==========

		case BB_RECONFIGURE:
		{
			if (myMenu){ DelMenu(myMenu); myMenu = NULL;}
			GetStyleSettings();
			InvalidateRect(hwndPlugin, NULL, true);
		}
		break;

		// for bbStylemaker
		case BB_REDRAWGUI:
		{
			GetStyleSettings();
			InvalidateRect(hwndPlugin, NULL, true);
		}
		break;

		case WM_DISPLAYCHANGE:
		{
			if(!inSlit)
			{
				// IntelliMove(tm)... <g>
				// (c) 2003 qwilk
				//should make this a function so it can be used on startup in case resolution changed since
				//the last time blackbox was used.
				int relx, rely;
				int oldscreenwidth = ScreenWidth;
				int oldscreenheight = ScreenHeight;
				ScreenWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
				ScreenHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
				if (xpos > oldscreenwidth / 2)
				{
					relx = oldscreenwidth - xpos;
					xpos = ScreenWidth - relx;
				}
				if (ypos > oldscreenheight / 2)
				{
					rely = oldscreenheight - ypos;
					ypos = ScreenHeight - rely;
				}
				MoveWindow(hwndPlugin, xpos, ypos, width, height, true);
			}
		}
		break;

		// ==========

		case BB_BROADCAST:
		{
			szTemp = (char*)lParam;

			if (!_stricmp(szTemp, "@BBShowPlugins") &&  pluginToggle && !inSlit)
			{
				// Show window and force update...
				ShowWindow( hwndPlugin, SW_SHOW);
				InvalidateRect( hwndPlugin, NULL, true);
			}
			else if (!_stricmp(szTemp, "@BBHidePlugins") && pluginToggle && !inSlit)
			{
				// Hide window...
				ShowWindow( hwndPlugin, SW_HIDE);
			}

			//===================

			if (strnicmp(szTemp, "@BBSeekbar", 10))
				return 0;
			szTemp += 10;

			if (!_stricmp(szTemp, "About"))
			{
				char tmp_str[MAX_LINE_LENGTH];
				SendMessage(hwndBlackbox, BB_HIDEMENU, 0, 0);
				sprintf(tmp_str, "%s", szVersion);
				MessageBox(hwndBlackbox, tmp_str, szAppName, MB_OK | MB_TOPMOST);
			}

			//===================

			else if (!_strnicmp(szTemp, "StyleType", 9))
			{
				styleType = atoi(szTemp + 10);
				GetStyleSettings();
				InvalidateRect(hwndPlugin, NULL, true);
			}
			else if (!_strnicmp(szTemp, "TrackStyle", 10))
			{
//.........这里部分代码省略.........
开发者ID:ejasiunas,项目名称:bbclean-xzero450,代码行数:101,代码来源:bbseekbar.cpp


示例17: WndProc

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;

	switch (message) 
	{
		case WM_TIMER:
			{
				WORD wTimerID	= wParam;
				switch( wTimerID )
				{
					case 0:
						g_dpDBClient.SendPing();
						g_DPCoreClient.SendPing();
						break;
					case 1:
						// g_UserMng.OutputStatistics();
						break;
				}
				break;
			}
		case WM_COMMAND:
			wmId    = LOWORD(wParam);
			wmEvent = HIWORD(wParam); 
			switch (wmId)
			{
				case IDM_EXIT:
				   DestroyWindow(hWnd);
				   break;
				default:
				   return DefWindowProc(hWnd, message, wParam, lParam);
			}
			break;
		case WM_PAINT:
			hdc = BeginPaint( hWnd, &ps );
			OnPaint( hdc );
			EndPaint( hWnd, &ps );
			break;
		case WM_LBUTTONDOWN:
			CRunObject::GetInstance()->ToggleProfiling();
#ifdef __MEM_TRACE
#ifndef _DEBUG
			CMemTrace::Instance()->Print();
#endif	// _DEBUG
#endif	// __MEM_TRACE
#ifdef __VM_0819
			CVMLog::Instance()->Log();
#endif	// __VM_0819
			break;
		case WM_RBUTTONDOWN:
#ifdef __NEW_PROFILE
			CProfileInfo::GetInstance()->SetToggleProfiling();
#endif // __NEW_PROFILE
			break;
		case WM_DESTROY:
			KillTimer( g_hMainWnd, 0 );
			KillTimer( g_hMainWnd, 1 );
			PostQuitMessage(0);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
   }
   return 0;
}
开发者ID:KerwinMa,项目名称:AerothFlyffSource,代码行数:66,代码来源:WorldServer.cpp


示例18: WndProc


//.........这里部分代码省略.........

		case WM_KEYDOWN:
		{
			switch (wParam)
			{
				case VK_UP:
					keyUp = 1;
					//sphere->translate(10.0,10.0,10.0);
					//Rock.translate(10.0,10.0,10.0);
					break;
				
				case VK_LEFT:
					keyLeft = 1; break;
			case VK_RIGHT:
					keyRight = 1; break;
			case VK_DOWN:
					keyDown = 1;
					//sphere->translate(-10.0,10.0,10.0);
					break;

					case 'A':
						cube.translate(10,0,0); 
						break;
				case 'D':
					Rock.rotateY(-10); break;
				case 'S':
					Rock.rotateZ(-50); break;
				case 'W':
					Rock.rotateZ(50,Vertex(50,50,50)); break;
				/*case VK_A:
					keyA = 1; break;
				case VK_S:
					keyS = 1; break;
				case VK_D:
					keyD = 1; break;
				case VK_W:
					keyW = 1; break;
					*/

								default:
					return DefWindowProc(hWnd, message, wParam, lParam);
			}
			refresh(hWnd);
		}

		break;

		case WM_KEYUP:
			
			switch(wParam)
			{
			case VK_UP:
					keyUp = 0; break;
			case VK_DOWN:
					keyDown = 0; break;
			case VK_LEFT:
					keyLeft = 0; break;
			case VK_RIGHT:
					keyRight = 0; break;
			default:
					return DefWindowProc(hWnd, message, wParam, lParam);
			}
		break;

		case WM_CHAR:
			switch(wParam)
			{
			case 'a':
					keyUp = 0; break;
			case 'd':
					keyDown = 0; break;
			case 's':
					keyLeft = 0; break;
			case 'w':
					keyRight = 0; break;
			
			default:
					return DefWindowProc(hWnd, message, wParam, lParam);
			}
		break;
	


	

	case WM_PAINT:
		

		return OnPaint(hWnd);
		// TODO: Add any drawing code here...
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	

}
开发者ID:sunitbelbase,项目名称:rocket_simulation,代码行数:101,代码来源:darts.cpp


示例19: OnPaint

void
TerminalWindow::OnPaint(Canvas &canvas)
{
  OnPaint(canvas, GetClientRect());
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:5,代码来源:TerminalWindow.cpp


示例20: switch

//---------------------------------------------------------------------
// ClientWindowProc(): 
//---------------------------------------------------------------------
LRESULT WPPALLETE::ClientWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{              
   // Process window message.               
   switch (uMsg)
   {
      case WM_CREATE:
         // Store the window handle for use later.
         SetHandle(hWnd);
         // Let notebook object know that create message is being processed.
         // NOTE: Here is where folder objects have a chance to animate
         //       the zoom effect for window creation.
         OnCreate();
         // Return success so we can continue with the creation of window.
         return ((LRESULT)0);
         
      case WM_ACTIVATE:
         OnActivate(((wParam==WA_INACTIVE)? TRUE : FALSE));
         return (TRUE);
            
      case WM_COMMAND:            
         OnCommand((HWND)LOWORD(lParam),HIWORD(lParam));
         break;
                          
      case WM_SYSCOMMAND:
         // A system command has been requested.
         OnSysCommand((WORD)wParam,lParam);
         break;
         
      case WM_SETTEXT:     
         // Set new window caption text.
         DefWindowProc(hWnd,uMsg,wParam,lParam);
         // Update window caption.
         OnNCPaint();
         break;  
         
      case WM_QUERYDRAGICON:
         return (OnQueryDragIcon());

      case WM_ERASEBKGND:
         OnEraseBackground((HDC)wParam);
         break;
         
      case WM_PAINT:
         OnPaint();
         break;

      case WM_NCACTIVATE: 
         // Handle this message ONLY if the non-client area is becoming active OR
         // the window becoming active or inactive is not a notebook page (modeless dialog).
         // else, do not update non-client area to prevent flickering effect with 
         // notebook window caption.
         OnNCActivate((BOOL)wParam);
         return (TRUE);
           
      case WM_NCPAINT:         
         OnNCPaint();
         return (NULL);
         
      case WM_NCMOUSEMOVE:
         OnNCMouseMove((WORD)wParam,MAKEPOINT(lParam));
         break;
         
      case WM_NCLBUTTONUP:       
      case WM_NCLBUTTONDOWN:
         OnNCLButton(uMsg,(WORD)wParam,MAKEPOINT(lParam));
         break;
         
      case WM_MOUSEMOVE:
         OnMouseMove();
         break;
                   
      case WM_MOVE:
         OnMove(MAKEPOINT(lParam));
         break;                      
                                                              
      case WM_SIZE: 
         OnSize((WORD)wParam,LOWORD(lParam),HIWORD(lParam));
         break;
                    
      case WM_CLOSE:        
         OnClose();
         break;
    
      default:                              
         // Call the default window procedure.
         return (DefWindowProc(hWnd,uMsg,wParam,lParam));
  }                           
                                              
  // We are done processing the window message...                                              
  return (NULL);
}
开发者ID:OS2World,项目名称:WIN16-Worplace-Shell-for-Windows,代码行数:94,代码来源:PALETTE.CPP



注:本文中的OnPaint函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ OnPrepareDC函数代码示例发布时间:2022-05-30
下一篇:
C++ OnOK函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap