当前位置: 首页>>代码示例>>C++>>正文


C++ InvalidateRect函数代码示例

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


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

示例1: ConvertTexMatWithQTexture


//.........这里部分代码省略.........
	char	sz[128];
	texdef_t *pt;
	brushprimit_texdef_t	*bpt;
	// local copy if a width=2 height=2 qtetxture_t is needed
	brushprimit_texdef_t	local_bp;
	int		i;

	if (!g_surfwin)
		return;

	m_bPatchMode = false;

	if (OnlyPatchesSelected())
	{
		pt = &g_qeglobals.d_texturewin.texdef;
		if (QE_SingleBrush())
    {
			//strcpy(g_patch_texdef.name, Patch_GetTextureName());
			g_patch_texdef.SetName(Patch_GetTextureName());
    }
		else
    {
			//strcpy(g_patch_texdef.name, pt->name);
			g_patch_texdef.SetName(pt->name);
    }
		g_patch_texdef.contents = pt->contents;
		g_patch_texdef.flags = pt->flags;
		g_patch_texdef.value = pt->value;
		pt = &g_patch_texdef;
		m_bPatchMode = true;
	}
	else
	{
		if (g_bNewFace && g_ptrSelectedFaces.GetSize() > 0)
		{
      face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(0));
			pt = &selFace->texdef;
			if (g_qeglobals.m_bBrushPrimitMode)
			{
				// compute a texture matrix related to the default matrix width=2 height=2
				ConvertTexMatWithQTexture( &selFace->brushprimit_texdef, selFace->d_texture, &local_bp, NULL );
				bpt = &local_bp;
			}
		}
		else
		{
			pt = &g_qeglobals.d_texturewin.texdef;
			if (g_qeglobals.m_bBrushPrimitMode)
			{
				bpt = &g_qeglobals.d_texturewin.brushprimit_texdef;
			}
		}
		// brush primitive mode : compute fake shift scale rot representation
		if (g_qeglobals.m_bBrushPrimitMode)
			TexMatToFakeTexCoords( bpt->coords, m_shift, &m_rotate, m_scale );
	}

	SendMessage (WM_SETREDRAW, 0, 0);

	::SetWindowText(GetDlgItem(IDC_TEXTURE)->GetSafeHwnd(), pt->name);

	if (m_bPatchMode)
		sprintf(sz, "%4.6f", pt->shift[0]);
	else
		if (g_qeglobals.m_bBrushPrimitMode)
			sprintf(sz, "%d", (int)m_shift[0]);
		else
			sprintf(sz, "%d", (int)pt->shift[0]);
	::SetWindowText(GetDlgItem(IDC_HSHIFT)->GetSafeHwnd(), sz);

	if (m_bPatchMode)
		sprintf(sz, "%4.6f", pt->shift[1]);
	else
		if (g_qeglobals.m_bBrushPrimitMode)
			sprintf(sz, "%d", (int)m_shift[1]);
		else
			sprintf(sz, "%d", (int)pt->shift[1]);
	::SetWindowText(GetDlgItem(IDC_VSHIFT)->GetSafeHwnd(), sz);

	sprintf(sz, m_bPatchMode ? "%4.6f" : "%4.6f", g_qeglobals.m_bBrushPrimitMode ? m_scale[0] : pt->scale[0]);
	::SetWindowText(GetDlgItem(IDC_HSCALE)->GetSafeHwnd(), sz);

	sprintf(sz, m_bPatchMode ? "%4.6f" : "%4.6f", g_qeglobals.m_bBrushPrimitMode ? m_scale[1] : pt->scale[1]);
	::SetWindowText(GetDlgItem(IDC_VSCALE)->GetSafeHwnd(), sz);

	//++timo compute BProtate as int ..
	sprintf(sz, "%d", g_qeglobals.m_bBrushPrimitMode ? (int)m_rotate : (int)pt->rotate);
	::SetWindowText(GetDlgItem(IDC_ROTATE)->GetSafeHwnd(), sz);

	sprintf(sz, "%d", (int)pt->value);
	::SetWindowText(GetDlgItem(IDC_VALUE)->GetSafeHwnd(), sz);

	for (i=0 ; i<32 ; i++)
		::SendMessage(GetDlgItem(g_checkboxes[i])->GetSafeHwnd(), BM_SETCHECK, !!(pt->flags&(1<<i)), 0 );
	for (i=0 ; i<32 ; i++)
		::SendMessage(GetDlgItem(g_checkboxes[32+i])->GetSafeHwnd(), BM_SETCHECK, !!(pt->contents&(1<<i)), 0 );

	SendMessage (WM_SETREDRAW, 1, 0);
	InvalidateRect (NULL, true);
}
开发者ID:Izhido,项目名称:qrevpak,代码行数:101,代码来源:SurfaceDlg.cpp

示例2: WndProc


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


		apt[2].x = cxClient / 2 ;

		apt[2].y = 3 * cyClient / 4 ;



		apt[3].x = 3 * cxClient / 4 ;

		apt[3].y = cyClient / 2 ;



		return 0 ;


	case WM_LBUTTONDOWN:

	case WM_RBUTTONDOWN:

	case WM_MOUSEMOVE:

		if (wParam & MK_LBUTTON || wParam & MK_RBUTTON)

		{

			hdc = GetDC (hwnd) ;

			SelectObject (hdc, GetStockObject (WHITE_PEN)) ;

			DrawBezier (hdc, apt) ;



			if (wParam & MK_LBUTTON)

			{

				apt[1].x = LOWORD (lParam) ;

				apt[1].y = HIWORD (lParam) ;

			}



			if (wParam & MK_RBUTTON)

			{

				apt[2].x = LOWORD (lParam) ;

				apt[2].y = HIWORD (lParam) ;

			}



			SelectObject (hdc, GetStockObject (BLACK_PEN)) ;

			DrawBezier (hdc, apt) ;

			ReleaseDC (hwnd, hdc) ;

		}

		return 0 ;

	case   WM_PAINT:

		InvalidateRect (hwnd, NULL, TRUE) ;



		hdc = BeginPaint (hwnd, &ps) ;



		DrawBezier (hdc, apt) ;



		EndPaint (hwnd, &ps) ;

		return 0 ;



	case WM_DESTROY:

		PostQuitMessage (0) ;

		return 0 ;

	}

	return DefWindowProc (hwnd, message, wParam, lParam) ;

}
开发者ID:chenhz2284,项目名称:cpp_lib,代码行数:101,代码来源:main4.cpp

示例3: BrowseNamesDlgProc

/* Handles browse names dialog box */
LRESULT CALLBACK BrowseNamesDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
  static              List namesList = NIL;
  List                names=NIL;
  struct strName      nm;
  Name                n;
  UINT                theName;
  WORD                NotifyCode, wId;
  RECT                aRect, DlgRect;
  HBITMAP             hBitmap;
  HBITMAP             hBmp;
  BITMAP	      bm;
  static HBITMAP      hPBm, hPSelBm, hDBm, hDSelBm, hMBm, hMSelBm, hNBm, hNSelBm,
		      hSBm, hSSelBm;
  CHAR	              Buffer[300];
  DRAWITEMSTRUCT FAR *lpdis;
  LPMEASUREITEMSTRUCT lpmis;
  BOOL                Selected = FALSE;

  NotifyCode = HIWORD (wParam);
  wId        = LOWORD (wParam);

  switch (msg) {

    case WM_INITDIALOG:
      CenterDialogInParent(hDlg);
      SetDialogFont (hDlg, hDialogFont);
      namesList = addNamesMatching((String)0, NIL);

      /* Clear the redraw flag */
      SendDlgItemMessage(hDlg, LB_NAMES ,WM_SETREDRAW, FALSE, 0L);

      for (names=namesList; nonNull(names); names=tl(names)) {
	if (nonNull(names)) {
	  nm = name(hd(names));
	  fprintf(stdstr, "%s   -- in %s\n",textToStr(nm.text),textToStr(module(nm.mod).text));
	  SendDlgItemMessage(hDlg, LB_NAMES ,LB_ADDSTRING, 0, (LONG)(LPSTR) stdstrbuff);
	  SendDlgItemMessage(hDlg, LB_NAMES, LB_SETCURSEL, 0, 0L);
	}
      }

      /* Set the redraw flag and force repaint. */
      SendDlgItemMessage(hDlg, LB_NAMES ,WM_SETREDRAW, TRUE, 0L);
      InvalidateRect(GetDlgItem(hDlg, LB_NAMES), NULL, TRUE);

      theName = 0;
      SetName(hDlg, theName, namesList);

      hPBm = LoadBitmap (hThisInstance, "PRIMBMP");
      MapBitmap (hPBm, RGB(0,128,128), GetSysColor(COLOR_WINDOW));
      hPSelBm = LoadBitmap (hThisInstance, "PRIMBMP");
      MapBitmap (hPSelBm, RGB(0,128,128), GetSysColor(COLOR_HIGHLIGHT));
      hDBm = LoadBitmap (hThisInstance, "DATACONSBMP");
      MapBitmap (hDBm, RGB(0,128,128), GetSysColor(COLOR_WINDOW));
      hDSelBm = LoadBitmap (hThisInstance, "DATACONSBMP");
      MapBitmap (hDSelBm, RGB(0,128,128), GetSysColor(COLOR_HIGHLIGHT));
      hMBm = LoadBitmap (hThisInstance, "MEMBERBMP");
      MapBitmap (hMBm, RGB(0,128,128), GetSysColor(COLOR_WINDOW));
      hMSelBm = LoadBitmap (hThisInstance, "MEMBERBMP");
      MapBitmap (hMSelBm, RGB(0,128,128), GetSysColor(COLOR_HIGHLIGHT));
      hNBm = LoadBitmap (hThisInstance, "NAMEBMP");
      MapBitmap (hNBm, RGB(0,128,128), GetSysColor(COLOR_WINDOW));
      hNSelBm = LoadBitmap (hThisInstance, "NAMEBMP");
      MapBitmap (hNSelBm, RGB(0,128,128), GetSysColor(COLOR_HIGHLIGHT));
      hSBm = LoadBitmap (hThisInstance, "SELECTORBMP");
      MapBitmap (hSBm, RGB(0,128,128), GetSysColor(COLOR_WINDOW));
      hSSelBm = LoadBitmap (hThisInstance, "SELECTORBMP");
      MapBitmap (hSSelBm, RGB(0,128,128), GetSysColor(COLOR_HIGHLIGHT));

      /* set focus to search box (must return FALSE) */
      SetFocus (GetDlgItem(hDlg, IDC_SEARCHNAME));
      return FALSE;

    case WM_DESTROY:
      DeleteObject(hPBm);
      DeleteObject(hPSelBm);
      DeleteObject(hDBm);
      DeleteObject(hDSelBm);
      DeleteObject(hMBm);
      DeleteObject(hMSelBm);
      DeleteObject(hNBm);
      DeleteObject(hNSelBm);
      DeleteObject(hSBm);
      DeleteObject(hSSelBm);
      break;

    case WM_CTLCOLORBTN:
    case WM_CTLCOLORDLG:
    case WM_CTLCOLOREDIT:
    case WM_CTLCOLORLISTBOX:
    case WM_CTLCOLORMSGBOX:
    case WM_CTLCOLORSCROLLBAR:
    case WM_CTLCOLORSTATIC:
      break;

    case WM_MEASUREITEM:

      lpdis = (DRAWITEMSTRUCT FAR *) lParam;

//.........这里部分代码省略.........
开发者ID:OS2World,项目名称:DEV-UTIL-HUGS,代码行数:101,代码来源:Winbrows.c

示例4: MainWinProc


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

v = v0;
x = x0;

SelectObject(hDC, Pen5);

for(t = -6.0; t <= 11; t = t + 0.1 ){
    k1=-(g*v +w1*w1*x)+a*cos(w2*t);
	k2=-(g*(v+k1/2)+w1*w1*x) + a*cos(w2*(t+0.05));
	k3=-(g*(v+k2/2)+w1*w1*x) + a*cos(w2*(t+0.05));
	k4=-(g*(v+k3)+w1*w1*x) + a*cos(w2*(t+0.1));

	v=v+(k1+2*k2+2*k3+k4)/60;
	x=x+0.1*v;

	k1n=-(g*v +w1*w1*x)+a*cos(w2*t);
	k2n=-(g*(v+k1/2)+w1*w1*x) + a*cos(w2*(t+0.05));
	k3n=-(g*(v+k2/2)+w1*w1*x) + a*cos(w2*(t+0.05));
	k4n=-(g*(v+k3)+w1*w1*x) + a*cos(w2*(t+0.1));

	vn=v+(k1n+2*k2n+2*k3n+k4n)/60;
	xn=x+0.1*v;

if(((20*t+150)<370) && ((-20*x+360)>240) && ((20*(t+0.1)+150)<370) && ((-20*xn+360)>240)){
	MoveToEx( hDC, 20*t+150, -20*x+360, NULL );
	LineTo( hDC, 20*(t+0.1)+150, -20*xn+360 );
	}

if(((20*t+150)<370) && ((-20*v+120)<240) && ((20*(t+0.1)+150)<370) && ((-20*vn+120)<240)){
	MoveToEx( hDC, 20*t+150, -20*v+120, NULL );
	LineTo( hDC, 20*(t+0.1)+150, -20*vn+120);
}

if(((20*x+555)>370) && ((-20*v+120)<240) && ((20*xn+555)>370) && ((-20*vn+120)<240)){
	MoveToEx( hDC, 20*x+555, -20*v+120, NULL );
	LineTo( hDC, 20*xn+555, -20*vn+120);
	}
}

}

EndPaint(hw, &ps);
return 0;
break;

  case WM_COMMAND:
   /* нажата наша кнопочка? */
   if ((HIWORD(wp)==0) && (LOWORD(wp)==ID_MYBUTTON)){
   // MessageBox(hw,"You pressed my button","MessageBox",MB_OK|MB_ICONWARNING);

      GetDlgItemText(hw, ID_STARTSPD, LPSTR(V0), 80 );
      GetDlgItemText(hw, ID_STARTPOS, LPSTR(X0), 80 );
      GetDlgItemText(hw, ID_MAINFREQ, LPSTR(W1), 80 );
      GetDlgItemText(hw, ID_ATTCONST, LPSTR(G), 80 );
      GetDlgItemText(hw, ID_PWFREQUE, LPSTR(W2), 80 );
      GetDlgItemText(hw, ID_PWAMPLIT, LPSTR(A), 80 );

      if(V0[0] == 0){
         MessageBox(hw,"Input start speed","ERROR",MB_OK|MB_ICONERROR);
      }
      if(X0[0] == 0){
         MessageBox(hw,"Input start position","ERROR",MB_OK|MB_ICONERROR);
      }
      if(W1[0] == 0){
         MessageBox(hw,"Input main frequency","ERROR",MB_OK|MB_ICONERROR);
      }
      if(G[0] == 0){
         MessageBox(hw,"Input attenuation constant","ERROR",MB_OK|MB_ICONERROR);
      }
      if(W2[0] == 0){
         MessageBox(hw,"Input driving force's frequency","ERROR",MB_OK|MB_ICONERROR);
      }
      if(A[0] == 0){
         MessageBox(hw,"Input driving force's amplitude","ERROR",MB_OK|MB_ICONERROR);
      }

      v0 = atof(V0);
      x0 = atof(X0);
      w1 = atof(W1);
      g = atof(G);
      w2 = atof(W2);
      a = atof(A);

      v = v0;
      x = x0;

        InvalidateRect(hw, NULL, FALSE);
    //  UpdateWindow(hw);
    //MoveWindow(hw, 0, 0, 740, 480, true);
   }
return 0;
  case WM_DESTROY:
   /* пользователь закрыл окно, программа может завершаться */
   PostQuitMessage(0);
   return 0;
 }
 return DefWindowProc(hw,msg,wp,lp);
}
开发者ID:VulpesCorsac,项目名称:Mathematical-Modelling-DPQE-MIPT,代码行数:101,代码来源:Колебания.cpp

示例5: GetClientRect

void debugview_info::update()
{
	RECT bounds, vscroll_bounds, hscroll_bounds;
	debug_view_xy totalsize, visiblesize, topleft;
	bool show_vscroll, show_hscroll;
	SCROLLINFO scrollinfo;

	// get the view window bounds
	GetClientRect(m_wnd, &bounds);
	visiblesize.x = (bounds.right - bounds.left) / metrics().debug_font_width();
	visiblesize.y = (bounds.bottom - bounds.top) / metrics().debug_font_height();

	// get the updated total rows/cols and left row/col
	totalsize = m_view->total_size();
	topleft = m_view->visible_position();

	// determine if we need to show the scrollbars
	show_vscroll = show_hscroll = false;
	if (totalsize.x > visiblesize.x && bounds.bottom >= metrics().hscroll_height())
	{
		bounds.bottom -= metrics().hscroll_height();
		visiblesize.y = (bounds.bottom - bounds.top) / metrics().debug_font_height();
		show_hscroll = true;
	}
	if (totalsize.y > visiblesize.y && bounds.right >= metrics().vscroll_width())
	{
		bounds.right -= metrics().vscroll_width();
		visiblesize.x = (bounds.right - bounds.left) / metrics().debug_font_width();
		show_vscroll = true;
	}
	if (!show_vscroll && totalsize.y > visiblesize.y && bounds.right >= metrics().vscroll_width())
	{
		bounds.right -= metrics().vscroll_width();
		visiblesize.x = (bounds.right - bounds.left) / metrics().debug_font_width();
		show_vscroll = true;
	}

	// compute the bounds of the scrollbars
	GetClientRect(m_wnd, &vscroll_bounds);
	vscroll_bounds.left = vscroll_bounds.right - metrics().vscroll_width();
	if (show_hscroll)
		vscroll_bounds.bottom -= metrics().hscroll_height();

	GetClientRect(m_wnd, &hscroll_bounds);
	hscroll_bounds.top = hscroll_bounds.bottom - metrics().hscroll_height();
	if (show_vscroll)
		hscroll_bounds.right -= metrics().vscroll_width();

	// if we hid the scrollbars, make sure we reset the top/left corners
	if (topleft.y + visiblesize.y > totalsize.y)
		topleft.y = std::max(totalsize.y - visiblesize.y, 0);
	if (topleft.x + visiblesize.x > totalsize.x)
		topleft.x = std::max(totalsize.x - visiblesize.x, 0);

	// fill out the scroll info struct for the vertical scrollbar
	scrollinfo.cbSize = sizeof(scrollinfo);
	scrollinfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
	scrollinfo.nMin = 0;
	scrollinfo.nMax = totalsize.y - 1;
	scrollinfo.nPage = visiblesize.y;
	scrollinfo.nPos = topleft.y;
	SetScrollInfo(m_vscroll, SB_CTL, &scrollinfo, TRUE);

	// fill out the scroll info struct for the horizontal scrollbar
	scrollinfo.cbSize = sizeof(scrollinfo);
	scrollinfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
	scrollinfo.nMin = 0;
	scrollinfo.nMax = totalsize.x - 1;
	scrollinfo.nPage = visiblesize.x;
	scrollinfo.nPos = topleft.x;
	SetScrollInfo(m_hscroll, SB_CTL, &scrollinfo, TRUE);

	// update window info
	visiblesize.y++;
	visiblesize.x++;
	m_view->set_visible_size(visiblesize);
	m_view->set_visible_position(topleft);

	// invalidate the bounds
	InvalidateRect(m_wnd, nullptr, FALSE);

	// adjust the bounds of the scrollbars and show/hide them
	if (m_vscroll)
	{
		if (show_vscroll)
			smart_set_window_bounds(m_vscroll, m_wnd, vscroll_bounds);
		smart_show_window(m_vscroll, show_vscroll);
	}
	if (m_hscroll)
	{
		if (show_hscroll)
			smart_set_window_bounds(m_hscroll, m_wnd, hscroll_bounds);
		smart_show_window(m_hscroll, show_hscroll);
	}
}
开发者ID:RalfVB,项目名称:mame,代码行数:95,代码来源:debugviewinfo.cpp

示例6: WindowProcedure

LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	osdmsg *ms;

	switch (message) {
	case WM_CREATE:
		logmsg("WindowProcedure::CREATE");
		SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&defstr);
		return 0;

	case WM_DESTROY:
		logmsg("WindowProcedure::DESTROY");
		return 0;

	case WM_PAINT:
		logmsg("WindowProcedure::PAINT");

		ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
		if (ms)
			return DrawMe(hwnd, ms->text, ms->color);

		PAINTSTRUCT ps;
		BeginPaint(hwnd, &ps);
		EndPaint(hwnd, &ps);
		return 0;

	case WM_NCRBUTTONDOWN:
		logmsg("WindowProcedure::NCRBUTTONDOWN");

		ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
		if (ms) {
			if (ms->callback) ms->callback(ms->param);
			SendMessage(hwnd, WM_USER + 3, 0, 0);
		}
		return 0;

	case WM_TIMER:
		logmsg("WindowProcedure::TIMER");
		SendMessage(hwnd, WM_USER + 3, wParam, 0);
		return 0;

	case WM_USER + 1: //draw text ((char *)string, (int) timeout
		logmsg("WindowProcedure::USER+1");

		ms = (osdmsg*)mir_alloc(sizeof(osdmsg));
		ms->text = mir_tstrdup((TCHAR *)wParam);
		if (lParam == 0)
			lParam = db_get_dw(NULL, THIS_MODULE, "timeout", DEFAULT_TIMEOUT);
		ms->timeout = lParam;
		ms->callback = 0;
		ms->color = db_get_dw(NULL, THIS_MODULE, "clr_msg", DEFAULT_CLRMSG);
		ms->param = 0;
		SendMessage(hwnd, WM_USER + 4, (WPARAM)ms, 0);
		mir_free(ms->text);
		mir_free(ms);
		return 0;

	case WM_USER + 2: //show
		logmsg("WindowProcedure::USER+2");
		SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOACTIVATE);
		return 0;

	case WM_USER + 3: //hide
		ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
		logmsg("WindowProcedure::USER+3");
		if (!ms)
			return 0;

		logmsg("WindowProcedure::USER+3/om");
		KillTimer(hwnd, (UINT_PTR)ms);
		mir_free(ms->text);
		mir_free(ms);
		SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
		ShowWindow(hwnd, SW_HIDE);
		return 0;

	case WM_USER + 4:
		logmsg("WindowProcedure::USER+4");

		ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
		if (ms != 0) {
			logmsg("WindowProcedure::USER+4/old");
			KillTimer(hwnd, (UINT_PTR)ms);
			mir_free(ms->text);
			mir_free(ms);
			SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
		}

		ms = (osdmsg*)mir_alloc(sizeof(osdmsg));
		memcpy(ms, (osdmsg*)wParam, sizeof(osdmsg));
		ms->text = mir_tstrdup(ms->text);

		SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)ms);
		SetTimer(hwnd, (UINT_PTR)ms, (UINT)ms->timeout, 0);
		InvalidateRect(hwnd, 0, TRUE);
		SendMessage(hwnd, WM_USER + 2, 0, 0);
		return 0;

	case WM_NCHITTEST:
		{
//.........这里部分代码省略.........
开发者ID:Seldom,项目名称:miranda-ng,代码行数:101,代码来源:wbOSD.cpp

示例7: ProcessPageWndProc

INT_PTR CALLBACK
ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    RECT    rc;
    int        nXDifference;
    int        nYDifference;
    int        cx, cy;

    switch (message) {
    case WM_INITDIALOG:
        /*
         * Save the width and height
         */
        GetClientRect(hDlg, &rc);
        nProcessPageWidth = rc.right;
        nProcessPageHeight = rc.bottom;

        /* Update window position */
        SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);

        /*
         * Get handles to the controls
         */
        hProcessPageListCtrl = GetDlgItem(hDlg, IDC_PROCESSLIST);
        hProcessPageHeaderCtrl = (HWND)SendMessageW(hProcessPageListCtrl, LVM_GETHEADER, 0, 0);
        hProcessPageEndProcessButton = GetDlgItem(hDlg, IDC_ENDPROCESS);
        hProcessPageShowAllProcessesButton = GetDlgItem(hDlg, IDC_SHOWALLPROCESSES);

        /* Enable manual column reordering, set full select */
        SendMessageW(hProcessPageListCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP,
            LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP);

        AddColumns();

        /*
         * Subclass the process list control so we can intercept WM_ERASEBKGND
         */
        OldProcessListWndProc = (WNDPROC)SetWindowLongPtrW(hProcessPageListCtrl, GWLP_WNDPROC, (LONG_PTR)ProcessListWndProc);

        /* Start our refresh thread */
        CloseHandle( CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, NULL));

        return TRUE;

    case WM_DESTROY:
        /* Close the event handle, this will make the */
        /* refresh thread exit when the wait fails */
        CloseHandle(hProcessPageEvent);

        SaveColumnSettings();

        break;

    case WM_COMMAND:
        /* Handle the button clicks */
        switch (LOWORD(wParam))
        {
                case IDC_ENDPROCESS:
                        ProcessPage_OnEndProcess();
        }
        break;

    case WM_SIZE:
        if (wParam == SIZE_MINIMIZED)
            return 0;

        cx = LOWORD(lParam);
        cy = HIWORD(lParam);
        nXDifference = cx - nProcessPageWidth;
        nYDifference = cy - nProcessPageHeight;
        nProcessPageWidth = cx;
        nProcessPageHeight = cy;

        /* Reposition the application page's controls */
        GetWindowRect(hProcessPageListCtrl, &rc);
        cx = (rc.right - rc.left) + nXDifference;
        cy = (rc.bottom - rc.top) + nYDifference;
        SetWindowPos(hProcessPageListCtrl, NULL, 0, 0, cx, cy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOMOVE|SWP_NOZORDER);
        InvalidateRect(hProcessPageListCtrl, NULL, TRUE);
        
        GetClientRect(hProcessPageEndProcessButton, &rc);
        MapWindowPoints(hProcessPageEndProcessButton, hDlg, (LPPOINT)(&rc), (sizeof(RECT)/sizeof(POINT)) );
           cx = rc.left + nXDifference;
        cy = rc.top + nYDifference;
        SetWindowPos(hProcessPageEndProcessButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
        InvalidateRect(hProcessPageEndProcessButton, NULL, TRUE);
        
        GetClientRect(hProcessPageShowAllProcessesButton, &rc);
        MapWindowPoints(hProcessPageShowAllProcessesButton, hDlg, (LPPOINT)(&rc), (sizeof(RECT)/sizeof(POINT)) );
           cx = rc.left;
        cy = rc.top + nYDifference;
        SetWindowPos(hProcessPageShowAllProcessesButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
        InvalidateRect(hProcessPageShowAllProcessesButton, NULL, TRUE);

        break;

    case WM_NOTIFY:
        ProcessPageOnNotify(lParam);
        break;
    }
//.........这里部分代码省略.........
开发者ID:AlexSteel,项目名称:wine,代码行数:101,代码来源:procpage.c

示例8: WndProc

//
//  函数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  目的: 处理主窗口的消息。
//
//  WM_COMMAND	- 处理应用程序菜单
//  WM_PAINT	- 绘制主窗口
//  WM_DESTROY	- 发送退出消息并返回
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;
	RECT rect;

	switch (message)
	{
	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		
		// 分析菜单选择:
		switch (wmId)
		{
		case IDM_ABOUT:
			DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
			break;
		case IDM_EXIT:
			DestroyWindow(hWnd);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}
		break;
	//画图
	case WM_PAINT:
		hdc = BeginPaint(hWnd, &ps);
		// TODO: 在此添加任意绘图代码...
		
		//MoveToEx(hdc,50,50,0);
		//LineTo(hdc,100,100);
		for (int i=1;i<nCount;i++)
		{
			MoveToEx(hdc,xPosition[i-1],yPosition[i-1],0);
			LineTo(hdc,xPosition[i],yPosition[i]);
		}

		//MoveToEx(hdc,xPosition[nCount-1],yPosition[nCount-1],0);
		//LineTo(hdc,xPosition[0],yPosition[0]);

		EndPaint(hWnd, &ps);
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	case WM_MOUSEMOVE:
		xPosition[nCount] = GET_X_LPARAM(lParam); 
		yPosition[nCount] = GET_Y_LPARAM(lParam); 
		nCount++;

		GetClientRect(hWnd,&rect);
		InvalidateRect(hWnd,&rect,TRUE);

		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
开发者ID:soulsheng,项目名称:soulsheng-windows,代码行数:71,代码来源:WinPaint.cpp

示例9: LOWORD

/// <summary>
/// Handle windows messages for the class instance
/// </summary>
/// <param name="hWnd">window message is for</param>
/// <param name="uMsg">message</param>
/// <param name="wParam">message data</param>
/// <param name="lParam">additional message data</param>
/// <returns>result of message processing</returns>
LRESULT CALLBACK CFaceBasics::DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    //UNREFERENCED_PARAMETER(wParam);
    //UNREFERENCED_PARAMETER(lParam);
	UINT wmId = LOWORD(wParam);
	UINT wmEvent = HIWORD(wParam);
	UINT lwmId = LOWORD(lParam);
	UINT lwmEvent = HIWORD(lParam);

	bool result = false;
	hMenu = GetMenu(hWnd);

	DWORD errResult;

    switch (message)
    {
    case WM_INITDIALOG:
        {
            // Bind application window handle
            m_hWnd = hWnd;

            // Init Direct2D
            D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pD2DFactory);

            // Create and initialize a new Direct2D image renderer (take a look at ImageRenderer.h)
            // We'll use this to draw the data we receive from the Kinect to the screen
            m_pDrawDataStreams = new ImageRenderer();
            HRESULT hr = m_pDrawDataStreams->Initialize(GetDlgItem(m_hWnd, IDC_VIDEOVIEW), m_pD2DFactory, cColorWidth, cColorHeight, cColorWidth * sizeof(RGBQUAD)); 
            if (FAILED(hr))
            {
                SetStatusMessage(L"Failed to initialize the Direct2D draw device.", 10000, true);
            }

            // Get and initialize the default Kinect sensor
            InitializeDefaultSensor();
        }
        break;

	case WM_COMMAND:
		switch (wmId)
		{
		case ID_OPTIONS_SHOWFACEBOX:			
			errResult = GetMenuState(hMenu, ID_OPTIONS_SHOWFACEBOX,
				MF_BYCOMMAND);
			if (!(errResult & MF_CHECKED))
			{
				CheckMenuItem(hMenu, ID_OPTIONS_SHOWFACEBOX,
					MF_BYCOMMAND | MF_CHECKED);

				m_pDrawDataStreams->m_drawFaceBox = true;

			}
			else
			{
				CheckMenuItem(hMenu, ID_OPTIONS_SHOWFACEBOX,
					MF_BYCOMMAND | MF_UNCHECKED);

				m_pDrawDataStreams->m_drawFaceBox = false;

			}
						
			InvalidateRect(hWnd, 0, TRUE);
			break;

		case ID_OPTIONS_SHOWFACEPOINTS:
			errResult = GetMenuState(hMenu, ID_OPTIONS_SHOWFACEPOINTS,
				MF_BYCOMMAND);
			if (!(errResult & MF_CHECKED))
			{
				CheckMenuItem(hMenu, ID_OPTIONS_SHOWFACEPOINTS,
					MF_BYCOMMAND | MF_CHECKED);

				m_pDrawDataStreams->m_drawFacePoints = true;

			}
			else
			{
				CheckMenuItem(hMenu, ID_OPTIONS_SHOWFACEPOINTS,
					MF_BYCOMMAND | MF_UNCHECKED);

				m_pDrawDataStreams->m_drawFacePoints = false;

			}

			InvalidateRect(hWnd, 0, TRUE);
			break;

		case ID_OPTIONS_SHOWHDFACEPOINTS:
			errResult = GetMenuState(hMenu, ID_OPTIONS_SHOWHDFACEPOINTS,
				MF_BYCOMMAND);
			if (!(errResult & MF_CHECKED))
			{
//.........这里部分代码省略.........
开发者ID:dngoins,项目名称:KinectFaceStudio,代码行数:101,代码来源:FaceBasics.cpp

示例10: AnimationCtrlProc


//.........这里部分代码省略.........
        if (!anim_info->mem_dc)
            break;

        hdc = BeginPaint (hwnd);
        src_dc = anim_info->mem_dc;

        if (GetWindowStyle (hwnd) & ANS_SCALED) {
            GetClientRect (hwnd, &rc_anim);
        } else {
            SetRect (&rc_anim, 0, 0, anim_info->anim->width,
                     anim_info->anim->height);
        }

        if (RECTW (rc_anim) == anim_info->anim->width
            && RECTH (rc_anim) == anim_info->anim->height) {
            BitBlt (anim_info->mem_dc, 0, 0, 0, 0, hdc, 0, 0, 0);
        } else {
            StretchBlt (anim_info->mem_dc, 0, 0,
                        anim_info->anim->width, anim_info->anim->height,
                        hdc,
                        0, 0,
                        RECTW (rc_anim), RECTH (rc_anim), 0);
        }

        EndPaint (hwnd, hdc);
        return 0;
    }

    case ANM_SETANIMATION: {

          ANIMATION* old = anim_info->anim;
          anim_info->anim = (ANIMATION*)lParam;
          anim_info->current = NULL;
          if (anim_info->anim) {
              KillTimer (hwnd, ID_TIMER);
              if (GetWindowStyle (hwnd) & ANS_FITTOANI) {
                  RECT rc;
                  GetWindowRect(hwnd, &rc);
                  MoveWindow(hwnd, rc.left, rc.top,
                             anim_info->anim->width,
                             anim_info->anim->height, FALSE);
              }
              anim_info->current = NULL;
              setup_anim_mem_dc(hwnd, anim_info);
              next_frame(hwnd, anim_info);
              anim_info->elapsed_10ms = 0;
              //SetTimer (hwnd, ID_TIMER, anim_info->anim->time_unit);
              SetTimer (hwnd, ID_TIMER, 10);
          }
          return (int)old;
      }

    case ANM_GETANIMATION:
        return (int)anim_info->anim;

    case ANM_STARTPLAY: {

        if (anim_info->anim) {
            anim_info->current = NULL;
            anim_info->status = ANIM_STATUS_PLAY;
            next_frame(hwnd, anim_info);
            anim_info->elapsed_10ms = 0;
        }
        return 0;
    }
    case ANM_PAUSE_RESUME:
        if(anim_info->anim)
        {
            if (anim_info->status == ANIM_STATUS_PLAY)
                anim_info->status = ANIM_STATUS_STOP;
            else
                anim_info->status = ANIM_STATUS_PLAY;
        }
        return 0;

    case ANM_STOPPLAY:
        if(anim_info->anim)
        {
            anim_info->current = NULL;
            anim_info->status = ANIM_STATUS_STOP;
            next_frame (hwnd, anim_info); //back to the first frame
            anim_info->elapsed_10ms = 0;
            InvalidateRect (hwnd, NULL, FALSE);
            }
        return 0;

    case MSG_LBUTTONDBLCLK:
        NotifyParent (hwnd, GetDlgCtrlID (hwnd), ANNC_DBLCLK);
        break;

    case MSG_LBUTTONDOWN:
        NotifyParent (hwnd, GetDlgCtrlID (hwnd), ANNC_CLICKED);
        break;

        default:
            break;
    }

    return DefaultControlProc (hwnd, message, wParam, lParam);
}
开发者ID:VVillwin,项目名称:minigui,代码行数:101,代码来源:animation.c

示例11: WndProc

//
//  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND	- process the application menu
//  WM_PAINT	- Paint the main window
//  WM_DESTROY	- post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;

  RECT rect,rectDIY;


	switch (message)
	{
	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		// Parse the menu selections:
		switch (wmId)
		{
		case IDM_ABOUT:
			DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
			break;
		case IDM_EXIT:
			DestroyWindow(hWnd);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}
		break;
	case WM_PAINT:
		hdc = BeginPaint(hWnd, &ps);

		rectDIY.left=0;
		rectDIY.right=500;
		rectDIY.top=0;
		rectDIY.bottom=400;
		
		DrawText(hdc,text,ncount,&rectDIY,0);
		

				
		// TODO: Add any drawing code here...
		EndPaint(hWnd, &ps);
		break;
	case WM_DESTROY:
		//MessageBox(0,"SAVE?","�ב�¾",0);

		PostQuitMessage(0);
		break;
	case WM_CHAR:
		text[ncount]=wParam;
		ncount++;

		GetClientRect(hWnd,&rect);
		InvalidateRect(hWnd,&rect,TRUE);
		
		break;

	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
开发者ID:soulsheng,项目名称:soulsheng-windows,代码行数:71,代码来源:WinHello.cpp

示例12: OutputDebugString

int MHookHandler1::OnMouseMove(LONG _x, LONG _y)
{
	int position;
	bool goup=false; // Сразу отпусти клавишу
		
	// При нажатой правой кнопке мыши не передаём её движения в MHVector,
	// НО! продолжаем отслеживать last_x и last_y, не сбрасывая initialized! 
	// теперь по-новому: если есть прилипание к оси, то можно только противоположное
	// или то же. Поворачивать нельзя.
	if(initialized)
	{
		dx=(_x-last_x);
		dy=(_y-last_y);

		// Может, пятую кнопку можно нажать?
		if(MHSettings::flag_enable_speed_button) OnFastMove(dx,dy);

		position=MHVector::NewValues(dx,dy);

		// Если вбок и вниз = просто вбок, меняем позиции 3 и 5 на 4
		if((true==MHSettings::flag_downall)&&(8==MHSettings::GetNumPositions())&&((3==position)||(5==position)))
		{
			if(MHSettings::flag_up_immediately) goup=true; 
			position=4;
		}

		if(!rbutton_pressed) // известно последнее положение мыши, правая кнопка не нажата
		{
			// Новая опция - из конца в конец в два движения (только при 0==alt_offset)
			if((MHSettings::flag_2moves_mode1)&&(0==alt2_offset))
			{
				if(0<=position) // новое направление
				{
					// Это противоположное направление?
					if(IsOpposite(position_mem_opposite,position))
					{
						// 1. (при невыставленном флаге противоположного направления)
						// сбросим нажатую клавишу. Нажать противоположную сможем только после таймаута
						if(false==flag_opposite_direction)
						{
							// запомним время, отпустим кнопки, запомним направление (ниже)
							opposite_time=timeGetTime();
							MHKeypad::Reset(alt2_offset);
#ifdef _DEBUG
		OutputDebugString(L"OppDir keyup");
#endif
							flag_opposite_direction=true;
							position_mem_opposite=position;
							 
							// Почему-то Reset не включает перерисовку
							InvalidateRect(MHhwnd,NULL,TRUE);
						}
						else // при выставленном флаге противоположного направления
						{
							// 2. Как такое случилось?
							// Не дожидаясь времени, когда можно идти назад, снова пошли вперёд
							MHKeypad::Press(position,true,alt2_offset);
							flag_opposite_direction=false;
							position_mem_opposite=position;
							if(goup) MHKeypad::Press(position,false, alt2_offset); // Флаг сказал, что нужно тут же отжать
						}
					}
					else // не противоположное (position_mem содержит всё что угодно),
					{
						if(true==flag_opposite_direction) 
						{
							// 3.
							// ждём выхода в сторону position_mem, а по дороге завернули в сторону
							// только здесь возможен поворот в сторону !!!
							// Но только если прошло время обездвиженности!!!
							if(timeGetTime()-opposite_time>100) // была пауза, можно идти в противоположном направлении
							{
								MHKeypad::Press(position,true, alt2_offset);
								flag_opposite_direction=false;
								position_mem_opposite=position;
								if(goup) MHKeypad::Press(position,false, alt2_offset); // Флаг сказал, что нужно тут же отжать
							}
							else 
							{
								MHVector::Reset(); // Не надо больше слать -1
								opposite_time=timeGetTime(); // паузы в 50 мс неподвижности не было, перевзводим
							}
							//MHKeypad::Press(position,true);
							//flag_opposite_direction=false; // уход в сторону - сброс ожиданий
						}
						else // flag_opposite_direction=false
						{
							// не ждём выхода в сторону position_mem. 
							// Нажимаем, только если -1==position_mem (при прилипании)
							if((-1==position_mem)||(MHSettings::flag_change_direction_ontheway))
							{
								MHKeypad::Press(position,true, alt2_offset);
								position_mem_opposite=position;
								if(goup) MHKeypad::Press(position,false, alt2_offset); // Флаг сказал, что нужно тут же отжать
							}
						}
					
					} // не противоположное направление
				}
				else if(-1==position)
//.........这里部分代码省略.........
开发者ID:MastaLomaster,项目名称:MHook,代码行数:101,代码来源:hh1.cpp

示例13: InvalidateRect

BOOL CWallDirListItem::Invalidate(BOOL bErase/* = TRUE*/)
{
	return InvalidateRect(m_hWnd, NULL, bErase);
}
开发者ID:tsaikd,项目名称:MagicKD,代码行数:4,代码来源:WallDirListItem.cpp

示例14: GetItemRect

void CCheckListBox::InvalidateItem(int nIndex)
{
	CRect rect;
	GetItemRect(nIndex, rect);
	InvalidateRect(rect, FALSE);
}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:6,代码来源:winctrl3.cpp

示例15: InitLanguage

void CInfoDlg::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	if (nIDEvent == 1)
	{
		InitLanguage();
		CRect rect;
		int i =0;
		int nSample = 0;
		
		CString str1, str2,str3,str4;
		AfxGetMainWnd()->GetWindowRect(&rect);
		int width, high;
		width = rect.Width();
		high = rect.Height();
		if (prv_nWidth >0&&prv_nHieght>0)
		{
		
			m_strInfo[0].Format("%d X %d", width, high);
			m_strInfo[0]=m_strInfo[0]+"  "+m_strRect;
			
			m_strInfo[1].Format("%d X %d", prv_nWidth, prv_nHieght);
			m_strInfo[1]=m_strInfo[1]+"  "+m_strRect;

			m_strInfo[2].Format("%d", g_Lost_frame);
			m_strInfo[3].Format("%d", g_Total_frame);
			m_strInfo[4].Format("%d kbps", g_Bit_rate);
			m_strInfo[5].Format("%d f/s", g_Frame_rate);
			m_strInfo[6].Format("H.264,%d X %d",prv_nWidth,prv_nHieght);
			m_strInfo[7]=g_strUrl;
			nSample = g_Samplerate/1000;
			g_Samplerate = 0;
			m_strInfo[8].Format("AAC,%s,%dKHz",m_strVedio,nSample);
			
			for(i =0;i < 9;i++)
			{
				InvalidateRect(&m_rctext[i]);
			}		
		}
		else
		{
			width = 0;
			high = 0;
			g_Total_frame = 0;
			g_Lost_frame = 0;
			m_strInfo[0].Format("%d X %d", width, high);
			m_strInfo[0]=m_strInfo[0]+"  "+m_strRect;
			
			m_strInfo[1].Format("%d X %d", prv_nWidth, prv_nHieght);
			m_strInfo[1]=m_strInfo[1]+"  "+m_strRect;
			
			m_strInfo[2].Format("%d", g_Lost_frame);
			m_strInfo[3].Format("%d", g_Total_frame);
			m_strInfo[4].Format("%d kbps", g_Bit_rate);
			m_strInfo[5].Format("%d f/s", g_Frame_rate);
			m_strInfo[6].Format("H.264,%d X %d",prv_nWidth,prv_nHieght);
			m_strInfo[7]=g_strUrl;
			nSample = g_Samplerate/1000;
			m_strInfo[8].Format("AAC,%s,%dKHz",m_strVedio,nSample);
			for(i =0;i < 9;i++)
			{
				InvalidateRect(&m_rctext[i]);
			}
		}
		InvalidateRect(&CRect(8,5,150,25));
		for (i=0;i<8;i++)
		{
			InvalidateRect(&m_rcaption[i]);
		}
	}
	CDialog::OnTimer(nIDEvent);
}
开发者ID:Lichanglu,项目名称:ENC-1260,代码行数:72,代码来源:InfoDlg.cpp


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