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


C++ TextOut函数代码示例

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


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

示例1: processlogstateandvf


//.........这里部分代码省略.........
			"PIN",
			"PW",
			"RF",
			"FP/PW",
			"FP/RF",
			"PW/RF",
			"PIN&FP",
			"FP&PW",
			"FP&RF",
			"PW&RF",
			"FP&PW&RF",
			"PIN&FP&PW",
			"FP&(RF/PIN)"
		};
		if(verifyStyle>14)
		{
			sprintf(lastprintstr,"%d:%s",verifyStyle, "Other");
			sprintf(vfstr,"%d:%s",verifyStyle, "Other");

		}
		else
		{
			sprintf(lastprintstr,"%d:%s",verifyStyle, verify[verifyStyle]);
			sprintf(vfstr,"%d:%s",verifyStyle, verify[verifyStyle]);
		}
	}
	if (gOptions.ShowState)
	{
		memset(&subitem,0,sizeof(LVSUBITEM));
		memset(findbuff,0,5);
		subitem.pszText=findbuff;
		subitem.subItem=4;
		SendMessage(hOneLogWnd,LVM_GETSUBITEMTEXT,hItemSelected,(LPARAM)&subitem);
		statecode = atoi(findbuff);
		memset(&tstkey,0,sizeof(TSHORTKEY));
		//		printf("statecode------------:%d\n",statecode);
		if(!gOptions.AntiPassbackFunOn) 
		{
			//Liaozz 20081014, change attlog display model
			if(FDB_GetShortKeyByState(statecode,&tstkey)!=NULL)
			{
				char mynamename[40];           //modify by jazzy 2008.12.04
				memset(mynamename,0,40);
				Str2UTF8(tftlocaleid,(unsigned char *)tstkey.stateName,(unsigned char *) mynamename);
				sprintf(statestr,"S:%s",mynamename);
			}
			//Liaozz 20081014, change attlog display model
		} 
		else 
		{
			if(gOptions.IMEFunOn==1)
			{
				if(FDB_GetShortKeyByState(statecode,&tstkey)!=NULL)
				{
					char mynamename[40]={0};           //modify by jazzy 2008.12.04
					memset(mynamename,0,40);
					Str2UTF8(tftlocaleid,(unsigned char *)tstkey.stateName,(unsigned char *) mynamename);
					sprintf(statestr,"S:%s",mynamename);
				}
			}
			else
			{
				if (statecode == 0)
					sprintf(statestr,"S:%s",LoadStrByID(HIT_SYSTEM5KEY1));
				if (statecode == 1)
					sprintf(statestr,"S:%s",LoadStrByID(HIT_SYSTEM5KEY2));
				if (statecode == 2)
					sprintf(statestr,"S:%s",LoadStrByID(HIT_SYSTEM5KEY5));
				if (statecode == 3)
					sprintf(statestr,"S:%s",LoadStrByID(HIT_SYSTEM5KEY6));
				if (statecode == 4)
					sprintf(statestr,"S:%s",LoadStrByID(HIT_SYSTEM5KEY3));
				if (statecode == 5)
					sprintf(statestr,"S:%s",LoadStrByID(HIT_SYSTEM5KEY4));
			}
		}
		//Liaozz end
		//printf("query state:%d\n",statecode);
		//printf("ddddddddddddddd 3 lastprintstr:%s, vfstr:%s, statestr=%s\n",lastprintstr, vfstr, statestr);
		sprintf(lastprintstr,"%s %s",lastprintstr, statestr);
		//printf("ddddddddddddddd lastprintstr:%s\n",lastprintstr);
	}

	//zsliu add
	log_State_rc.right = gOptions.LCDWidth;
	log_State_rc.bottom = gOptions.LCDHeight-5;
	
	InvalidateRect(hWnd,&log_State_rc,TRUE);

	mydc = GetClientDC(hWnd);
	SetBkColor(mydc,0x00FFA2BE);
	SelectFont(mydc,logqyfont1);
	SetTextColor(mydc,PIXEL_lightwhite);
	sprintf(bottomstr,"%s:%02d",LoadStrByID(MID_RECTOTAL),mylogcount);
	TextOut(mydc,50+gOptions.GridWidth,220,bottomstr);
	TextOut(mydc,190+gOptions.GridWidth,220,lastprintstr);
	ReleaseDC(mydc);

	return 0;
}
开发者ID:beealone,项目名称:fp-firmware,代码行数:101,代码来源:logoneuserquery.c

示例2: WndProc


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

			break;



		case SB_PAGEDOWN:

			iVscrollPos += cyClient / cyChar;

			break;



		case SB_THUMBPOSITION:

			iVscrollPos = HIWORD(wParam);

			break;



		default:

			break;

		}


		iVscrollPos = max(0, min(iVscrollPos, NUMLINES - 1));

		if (iVscrollPos != GetScrollPos(hwnd, SB_VERT))

		{

			SetScrollPos(hwnd, SB_VERT, iVscrollPos, TRUE);

			InvalidateRect(hwnd, NULL, TRUE);

		}

		return 0;



	case   WM_PAINT:

		hdc = BeginPaint(hwnd, &ps);

		for (i = 0; i < NUMLINES; i++)

		{

			y = cyChar * (i - iVscrollPos);

			TextOut(hdc, 0, y,

				sysmetrics[i].szLabel,

				lstrlen(sysmetrics[i].szLabel));



			TextOut(hdc, 22 * cxCaps, y,

				sysmetrics[i].szDesc,

				lstrlen(sysmetrics[i].szDesc));



			SetTextAlign(hdc, TA_RIGHT | TA_TOP);

			TextOut(hdc, 22 * cxCaps + 40 * cxChar, y, szBuffer,

				wsprintf(szBuffer, TEXT("%5d"),

				GetSystemMetrics(sysmetrics[i].Index)));

			SetTextAlign(hdc, TA_LEFT | TA_TOP);

		}

		EndPaint(hwnd, &ps);

		return 0;




	case   WM_DESTROY:

		PostQuitMessage(0);

		return 0;

	}

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

}
开发者ID:wakqaz4,项目名称:MyGame,代码行数:101,代码来源:main.cpp

示例3: WndPauseProc

LRESULT CALLBACK WINEXPORT
WndPauseProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	PAINTSTRUCT ps;
	RECT rect;
	TEXTMETRIC tm;
	LPPW lppw;
	int cxChar, cyChar, middle;

	lppw = (LPPW)GetWindowLong(hwnd, 0);

	switch(message) {
		case WM_KEYDOWN:
			if (wParam == VK_RETURN) {
				if (lppw->bDefOK)
					SendMessage(hwnd, WM_COMMAND, IDOK, 0L);
				else
					SendMessage(hwnd, WM_COMMAND, IDCANCEL, 0L);
			}
			return(0);
		case WM_COMMAND:
			switch(LOWORD(wParam)) {
				case IDCANCEL:
				case IDOK:
				    if (!paused_for_mouse) { /* ignore OK and Cancel buttons during "pause mouse" */
					lppw->bPauseCancel = LOWORD(wParam);
					lppw->bPause = FALSE;
				    }
				    break;
			}
			return(0);
		case WM_SETFOCUS:
			SetFocus(lppw->bDefOK ? lppw->hOK : lppw->hCancel);
			return(0);
		case WM_PAINT:
			{
			hdc = BeginPaint(hwnd, &ps);
			SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
			SetTextAlign(hdc, TA_CENTER);
			GetClientRect(hwnd, &rect);
			SetBkMode(hdc,TRANSPARENT);
			TextOut(hdc,(rect.right+rect.left)/2, (rect.bottom+rect.top)/6,
				lppw->Message,_fstrlen(lppw->Message));
			EndPaint(hwnd, &ps);
			return 0;
			}
		case WM_CREATE:
			{
		    	int ws_opts = WS_CHILD | BS_DEFPUSHBUTTON;
			if (!paused_for_mouse) /* don't show buttons during pausing for mouse or key */
			    ws_opts |= WS_VISIBLE;
			/* HBB 981202 HMENU sysmenu = GetSystemMenu(hwnd, FALSE); */
			lppw = ((CREATESTRUCT FAR *)lParam)->lpCreateParams;
			SetWindowLong(hwnd, 0, (LONG)lppw);
			lppw->hWndPause = hwnd;
			hdc = GetDC(hwnd);
			SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
			GetTextMetrics(hdc, &tm);
			cxChar = tm.tmAveCharWidth;
			cyChar = tm.tmHeight + tm.tmExternalLeading;
			ReleaseDC(hwnd,hdc);
			middle = ((LPCREATESTRUCT) lParam)->cx / 2;
			lppw->hOK = CreateWindow((LPSTR)"button", (LPSTR)"OK",
				ws_opts,
					middle - 10*cxChar, 3*cyChar,
					8*cxChar, 7*cyChar/4,
					hwnd, (HMENU)IDOK,
					((LPCREATESTRUCT) lParam)->hInstance, NULL);
			lppw->bDefOK = TRUE;
			lppw->hCancel = CreateWindow((LPSTR)"button", (LPSTR)"Cancel",
				ws_opts,
					middle + 2*cxChar, 3*cyChar,
					8*cxChar, 7*cyChar/4,
					hwnd, (HMENU)IDCANCEL,
					((LPCREATESTRUCT) lParam)->hInstance, NULL);
			lppw->lpfnOK = (WNDPROC) GetWindowLong(lppw->hOK, GWL_WNDPROC);
#ifdef WIN32
			SetWindowLong(lppw->hOK, GWL_WNDPROC, (LONG)PauseButtonProc);
#else
			SetWindowLong(lppw->hOK, GWL_WNDPROC, (LONG)lppw->lpfnPauseButtonProc);
#endif
			lppw->lpfnCancel = (WNDPROC) GetWindowLong(lppw->hCancel, GWL_WNDPROC);
#ifdef WIN32
			SetWindowLong(lppw->hCancel, GWL_WNDPROC, (LONG)PauseButtonProc);
#else
			SetWindowLong(lppw->hCancel, GWL_WNDPROC, (LONG)lppw->lpfnPauseButtonProc);
#endif
			if (GetParent(hwnd))
				EnableWindow(GetParent(hwnd),FALSE);
#if 0 /* HBB 981203 */
			DeleteMenu(sysmenu,SC_RESTORE,MF_BYCOMMAND);
			DeleteMenu(sysmenu,SC_SIZE,MF_BYCOMMAND);
			DeleteMenu(sysmenu,SC_MINIMIZE,MF_BYCOMMAND);
			DeleteMenu(sysmenu,SC_MAXIMIZE,MF_BYCOMMAND);
			DeleteMenu(sysmenu,SC_TASKLIST,MF_BYCOMMAND);
			DeleteMenu(sysmenu,0,MF_BYCOMMAND); /* a separator */
			DeleteMenu(sysmenu,0,MF_BYCOMMAND); /* a separator */
#endif
			}
//.........这里部分代码省略.........
开发者ID:zsx,项目名称:gnuplot,代码行数:101,代码来源:wpause.c

示例4: PaintBPPanel

void PaintBPPanel ( PAINTSTRUCT ps ) {
	TextOut( ps.hdc, 29,60,"Break when the Program Counter equals",37);
	TextOut( ps.hdc, 59,85,"0x",2);
}
开发者ID:TwitchPlaysPokemon,项目名称:project64,代码行数:4,代码来源:breakpoint.c

示例5: Demo_LineCurve

void Demo_LineCurve(HDC hDC, const RECT * rcPaint, int width, int height)
{
	// ROP2
	KLogFont logfont(- 10 * ONEINCH / 72, "Tahoma");
	KGDIObject font(hDC, logfont.CreateFont());

	for (int c=0; c<20; c++)
	{
		RECT rect = { c*200+400, 300, c*200+580, 4000 };

		HBRUSH hBrush = CreateSolidBrush(PALETTEINDEX(c));

		FillRect(hDC, & rect, hBrush);

		DeleteObject(hBrush);
	}
	
	{
		KGDIObject redbrush(hDC, CreateSolidBrush(RGB(0xFF, 0, 0)));
		SelectObject(hDC, GetStockObject(NULL_PEN));

		SetTextAlign(hDC, TA_TOP | TA_LEFT);

		for (int r=R2_BLACK; r<=R2_WHITE; r++)
		{
			SetROP2(hDC, r);
			TextOut(hDC, 4400, r*220+200, R2_Names[r-R2_BLACK], _tcslen(R2_Names[r-R2_BLACK]));

			Rectangle(hDC, 300, r*220+200, 4300, r*220+400);
		}
	
		SetROP2(hDC, R2_COPYPEN);
	}

	{
		KPen Red (PS_DOT,            0, RGB(0xFF, 0, 0));
		KPen Blue(PS_SOLID, ONEINCH/36, RGB(0, 0, 0xFF));

		for (int z=0; z<=2000; z+=400)
		{
			int x = 400, y = 6400;

			POINT p[4] = { x, y, x+ 400, y-z, x+800, y-z, x+1200, y }; x+= 1300;
			POINT q[4] = { x, y, x+ 400, y-z, x+800, y+z, x+1200, y }; x+= 1400;
		
			POINT r[4] = { x, y, x+1500, y-z, x- 200, y-z, x+1300, y }; x+= 1800;
			POINT s[4] = { x, y, x+1500, y-z, x- 200, y+z, x+1300, y }; x+= 1600;
		
			POINT t[4] = { x+600, y, x,  y-z, x+1300, y-z, x+600, y }; 

			Red.Select(hDC);
			Polyline(hDC, p, 4);
			Polyline(hDC, q, 4);
			Polyline(hDC, r, 4);
			Polyline(hDC, s, 4);
			Polyline(hDC, t, 4);
			Red.UnSelect();

			Blue.Select(hDC);
			PolyBezier(hDC, p, 4);
			PolyBezier(hDC, q, 4);
			PolyBezier(hDC, r, 4);
			PolyBezier(hDC, s, 4);
			PolyBezier(hDC, t, 4);
			Blue.UnSelect();
		}
	}

}
开发者ID:b2kguga,项目名称:CodesAndNotes,代码行数:69,代码来源:Printer.cpp

示例6: MainWndProc

LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
   LPARAM lParam)
{
   switch (msg)
   {
      case WM_CREATE:
      {
         INITCOMMONCONTROLSEX icx;
         icx.dwSize = sizeof(INITCOMMONCONTROLSEX);
         icx.dwICC = ICC_BAR_CLASSES;

         InitCommonControlsEx(&icx);

         hTrackBar =
            CreateWindow(
               TRACKBAR_CLASS, "",
               TBS_HORZ | TBS_BOTH | TBS_AUTOTICKS |
               TBS_FIXEDLENGTH | TBS_ENABLESELRANGE |
               WS_CHILD | WS_VISIBLE,
               10, 260, 375, 40,
               hWnd, NULL, hInst, NULL
               );

         assert(hTrackBar != NULL);
         SNDMSG(hTrackBar, TBM_SETTHUMBLENGTH, 20, 0);
         SNDMSG(hTrackBar, TBM_SETRANGEMAX, TRUE, 100);

         // create the TrueType (scalable) font
         HDC hDC = GetDC(hWnd);
         try
         {
            // see Chapter 4 for the definition of MakeFont
            hTTFont = font::MakeFont(hDC, "Impact", 72);
            if (!hTTFont) throw;
         }
         catch (...)
         {
            ReleaseDC(hWnd, hDC);
         }
         ReleaseDC(hWnd, hDC);
         break;
      }
      case WM_HSCROLL:
      {
         if (reinterpret_cast<HWND>(lParam) == hTrackBar)
         {
            //
            // adjust the scaling factor according to
            // the position of the trackbar's slider
            //
            scale = static_cast<double>(
               (SNDMSG(hTrackBar, TBM_GETPOS, 0, 0) + 1) / 50.0
               );
            InvalidateRect(hWnd, NULL, true);
         }
         break;
      }
      case WM_ERASEBKGND:
      {
         LRESULT res = DefWindowProc(hWnd, msg, wParam, lParam);

         HDC hDC = reinterpret_cast<HDC>(wParam);
         HFONT hOldFont = static_cast<HFONT>(
            SelectObject(hDC, hTTFont)
            );
         try
         {
            SetBkMode(hDC, TRANSPARENT);

            // open a path bracket
            if (!BeginPath(hDC)) throw;

            // record the text to the path
            TextOut(hDC, 10, 10, pText, lstrlen(pText));

            // close the path bracket and
            // select the path into hDC
            EndPath(hDC);

            // determine the number of endpoints in the path
            const int num_points = GetPath(hDC, NULL, NULL, 0);
            if (num_points > 0)
            {
               // make room for the POINTs and vertex types
               POINT* pPEnds = new POINT[num_points];
               unsigned char* pTypes = new unsigned char[num_points];
               try
               {
                  // get the path's description
                  int num_got = GetPath(hDC, pPEnds, pTypes, num_points);
                  if (num_got > 0)
                  {
                     // start a new path bracket
                     if (!BeginPath(hDC)) throw;

                     // scale each point in the description
                     int iPoint;
                     for (iPoint = 0; iPoint < num_got; ++iPoint)
                     {
                        pPEnds[iPoint].x = static_cast<LONG>(
//.........这里部分代码省略.........
开发者ID:GYGit,项目名称:reactos,代码行数:101,代码来源:txtscale.cpp

示例7: AboutWinProc

LRESULT APIENTRY AboutWinProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
    //Font handles
    static HFONT TitleFont, VersionFont, ExplainFont, LinkFont;
    //static int HorPix; //Currently not used

    //Link edit box hook
    typedef LRESULT (APIENTRY *TypeWinProc)(HWND,UINT,WPARAM,LPARAM); //Windows message listener procedure type
    static TypeWinProc LinkBoxProc; //Original link control handler
    static HWND LinkHwnd=NULL; //Handle to link control
    if(hwnd==LinkHwnd) //Process link edit box messages
    {
        if(msg==WM_LBUTTONDBLCLK) //On double click, open link to project page
            ShellExecute(NULL, "open", ProjectLink, NULL, NULL, SW_SHOWDEFAULT);
        return LinkBoxProc(hwnd,msg,wParam,lParam);
    }

    //Normal about window messages
    switch(msg)
    {
    case WM_ACTIVATE:
    {
        //Get device caps for font height - Should find font sizes by Height*HorPix/72, but since this doesn't seem to work, so I used arbitrary numbers instead to match VB about form layout
        /*HDC MyDC=GetDC(hwnd);
        SetMapMode(MyDC, MM_TEXT);
        HorPix=GetDeviceCaps(MyDC, LOGPIXELSY);
        ReleaseDC(hwnd, MyDC);*/

        //Title Font
        LOGFONT TempFont= {37, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DECORATIVE, "Arial"}; //Font Size=24
        TitleFont=CreateFontIndirect(&TempFont);
        //Version Font
        TempFont.lfWeight=FW_DONTCARE;
        TempFont.lfHeight=12; //Font Size=7
        VersionFont=CreateFontIndirect(&TempFont);
        //Explain Font
        TempFont.lfHeight=14; //Font Size=8
        strcpy(TempFont.lfFaceName, "Times New Roman");
        ExplainFont=CreateFontIndirect(&TempFont);
        //Link Box
        TempFont.lfHeight=12; //Font Size=8
        TempFont.lfUnderline=TRUE;
        strcpy(TempFont.lfFaceName, "MS Sans Serif");
        HFONT LinkFont=CreateFontIndirect(&TempFont);
        LinkHwnd=CreateWindow("Edit", ProjectLink, WS_CHILD|WS_VISIBLE|ES_READONLY, 0, MyHeight-16, MyWidth, 16, hwnd, NULL, (HINSTANCE)GetModuleHandle(NULL), 0);
        SendMessage(LinkHwnd, WM_SETFONT, (WPARAM)LinkFont, MAKELPARAM(TRUE, 0));
        LinkBoxProc=(TypeWinProc)SetWindowLong(LinkHwnd, GWL_WNDPROC, (LONG)AboutWinProc); //Listen for double clicks
        return 0;
    }
    case WM_PAINT:
    {
        //Prepare drawing
        PAINTSTRUCT DrawMe;
        HDC MyDC=BeginPaint(hwnd, &DrawMe);
        SetBkMode(MyDC, TRANSPARENT);
        SetTextColor(MyDC, 0x0);

        //Get Width of title string
        SIZE TitleStringSize;
        SelectObject(MyDC, TitleFont);
        GetTextExtentPoint32(MyDC, TitleString, sizeof(TitleString)-1, &TitleStringSize);

        //Output character strings
        TextOut(MyDC, (MyWidth-TitleStringSize.cx)/2,  0, TitleString, sizeof(TitleString));
        SelectObject(MyDC, VersionFont);
        TextOut(MyDC, (MyWidth+TitleStringSize.cx)/2,  20, VersionString, sizeof(VersionString));
        SelectObject(MyDC, ExplainFont);
        DrawText(MyDC, ExplainString, sizeof(ExplainString), (RECT*)&ExplainRect, DT_CENTER);

        //Draw signature and end drawing process
        DisplaySignature(MyDC, MyWidth-207, MyHeight-42-14);
        EndPaint(hwnd, &DrawMe);
        break;
    }
    case WM_CTLCOLORSTATIC: //Properly color the project link box
    {
        SetTextColor((HDC)wParam, GetSysColor(COLOR_HIGHLIGHT));
        SetBkColor((HDC)wParam, GetSysColor(COLOR_BTNFACE));
        return (LRESULT)GetSysColorBrush(COLOR_BTNFACE);
    }
    case WM_CLOSE: //Destroy all opened handles
        DeleteObject(TitleFont);
        DeleteObject(VersionFont);
        DeleteObject(ExplainFont);
        DeleteObject(LinkFont);
        DestroyWindow(hwnd);
        UnregisterClass("AboutWindow", (HINSTANCE)GetModuleHandle(NULL));
        DisplaySignature(NULL, 0, 0); //Delete the signature data
        AboutHwnd=NULL; //Clear the handle so we know about window is no longer open
        break;
    }
    return DefWindowProc(hwnd,msg,wParam,lParam);
}
开发者ID:dakusan,项目名称:HackPics,代码行数:93,代码来源:About.cpp

示例8: SizeTipWndProc

static LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg,
                                       WPARAM wParam, LPARAM lParam)
{

    switch (nMsg) {
      case WM_ERASEBKGND:
        return TRUE;

      case WM_PAINT:
        {
            HBRUSH hbr;
            HGDIOBJ holdbr;
            RECT cr;
            int wtlen;
            LPTSTR wt;
            HDC hdc;

            PAINTSTRUCT ps;
            hdc = BeginPaint(hWnd, &ps);

            SelectObject(hdc, tip_font);
            SelectObject(hdc, GetStockObject(BLACK_PEN));

            hbr = CreateSolidBrush(tip_bg);
            holdbr = SelectObject(hdc, hbr);

            GetClientRect(hWnd, &cr);
            Rectangle(hdc, cr.left, cr.top, cr.right, cr.bottom);

            wtlen = GetWindowTextLength(hWnd);
            wt = (LPTSTR)smalloc((wtlen+1)*sizeof(TCHAR));
            GetWindowText(hWnd, wt, wtlen+1);

            SetTextColor(hdc, tip_text);
            SetBkColor(hdc, tip_bg);

            TextOut(hdc, cr.left+3, cr.top+3, wt, wtlen);

            sfree(wt);

            SelectObject(hdc, holdbr);
            DeleteObject(hbr);

            EndPaint(hWnd, &ps);
        }
        return 0;

      case WM_NCHITTEST:
        return HTTRANSPARENT;

      case WM_DESTROY:
        DeleteObject(tip_font);
        tip_font = NULL;
        break;

      case WM_SETTEXT:
        {
            LPCTSTR str = (LPCTSTR)lParam;
            SIZE sz;
            HDC hdc = CreateCompatibleDC(NULL);

            SelectObject(hdc, tip_font);
            GetTextExtentPoint32(hdc, str, _tcslen(str), &sz);

            SetWindowPos(hWnd, NULL, 0, 0, sz.cx+6, sz.cy+6, SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE);
            InvalidateRect(hWnd, NULL, FALSE);

            DeleteDC(hdc);
        }
        break;
    }

    return DefWindowProc(hWnd, nMsg, wParam, lParam);
}
开发者ID:rdebath,项目名称:sgt,代码行数:74,代码来源:sizetip.c

示例9: WndProc

// The window procedure					
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{	
	// Static variables are variables that aren't erased after the function quits.  
	// WndProc gets called millions of times.  We want these variables vales to persist
	// for each call to WndProc, thus we make 'em static.
	static RECT clientRect = {0}; // This will hold the client dimensions of window
	
	TEXTMETRIC textInfo; // This a struct that contains the basic physical properties of a font							
	PAINTSTRUCT paintStruct; // A PAINTSTRUCT structure is something we need to paint (draw) when handling the WM_PAINT message.
	HDC hdc=NULL; // An HDC is a handle to a device context.  We use this handle as a way to communicate to the graphics card so we can draw things to the window.  
	int x, y; // These will be used to position our text.
	char szHello[]="Hello World!"; // The string to print, pretty original huh? :)

	// This checks what the message is.  Below we handle the messages that we care of about.
	// Remember there are HUNDREDS of messages we could handle, but we'll only deal with the 
	// following four.
    switch(iMsg)											
    {														
		// This message is sent when the window is created.
		case WM_CREATE:										
			// Upon creation we need to get the rectangular dimensions of the client area
			// of our window. The client area is the area of the window minus the title bar and border
			// surrounding the window.
			GetClientRect(hwnd, &clientRect);
			break;											

		// This message is sent to the WndProc after the windows size has changed
		case WM_SIZE:
			
			// Since the window has been resized, we need to get our client area again.										
			GetClientRect(hwnd, &clientRect);
			break;				

		// This message is sent to the WndProc when the window needs to be repainted.  This might be if
		// we moved the window, resized it, or maximized it, or if another window was covering ours.
		case WM_PAINT:
			// This is how we get an HDC to paint with.  BeginPaint() passes back an hdc and fills 
			// in the paintStruct structure.  The paintStruct holds optional information on how to paint
			// but all we really care about is getting the HDC of the window so we can draw
			// to the window.									
			hdc = BeginPaint(hwnd, &paintStruct);			
			
			// Here we pass in the hdc of our window and our textInfo into GetTextMetrics().  
			// This fills in textInfo with all the font info for the window such as height, 
			// width, spacing, etc, etc.  At any one time, an HDC can have one font 
			// associated with it.  By default Windows assigns a font to a window upon creation.
			// This call to GetTextMetrics will obtain the information for the default font
			// associated with our window that we created.
			GetTextMetrics(hdc, &textInfo);				
			
			// Now we want to change the color of our default font
			// We can do this by the SetTextColor function.  Notice the macro RGB.  If you
			// are not familiar with color formats, be sure and check out the 
			// quick lesson on RGB at the bottom of this file.												
			SetTextColor(hdc, RGB(255, 0, 0));				
															
															
			// Alright, here's where some math comes in :)  It's just simple algebra so don't panic.
			// We want "Hello World!" to be centered in the screen.  So first we want to find the 
			// width and height of the window.  Remember we stored the client rect of the window
			// in our WM_CREATE message.  In general a RECT is a struct with four members, left
			// right, top, and bottom.  With (left,top) defining the upper left corner of the 
			// RECT and (right,bottom) defining the lower right corner of the RECT.  By definition,
			// a client rect's upper-left corner is (0,0).  This means we know the width and height
			// of the window is clientRect.right and clientRect.bottom respectively.
			
			// Our goal is to have our text to be centered in the screen. 
			// So, first we calculate an (x,y) that are dead center in our window.
			x = clientRect.right / 2;
			y = clientRect.bottom / 2;
															
			// Now we need to subtract half of the length of the string from
			// our x position so that the string of text can be centered in the 
			// window.  To do that, we calculate the number of characters in the string
			// by strlen(szHello).  Next we multiply by the average character width
			// for our font.  This will give us the total length in pixels of our text.
			// Dividing that by two and subtracting it from our x will give us the starting x
			// position to draw our text.											
			x = x - ((strlen(szHello) * textInfo.tmAveCharWidth) / 2);											
			
			// Okay x is ready to go, now we need to do a bit more math to y.  We want the 
			// text centered in the screen, so we'll subtract off half of the text's height
			// so it's centered nicely in the window.
			y = y - (textInfo.tmHeight / 2);											
						
			// Now we need to print the text, which TextOut will do nicely 
			// for us.  The first parameter, hdc, is the device context for 
			// drawing to.  The next two parameters, (x,y) is the starting upper-left
			// corner to begin drawing the text to.  The next parameter, szHello, is the
			// the text string to print.  The last parameter, is the number of 
			// characters to print.  As mentioned above, strlen() returns the number of 
			// characters in a string.    
			TextOut(hdc, x, y, szHello, strlen(szHello));			
			
			// And that about wraps up our our end paint.  This should be 
			// the last function you call after BeginPaint.  As the name suggests,
			// this tells Windows we're done drawing %)
			EndPaint(hwnd, &paintStruct);					
		    break;											
//.........这里部分代码省略.........
开发者ID:Allenjonesing,项目名称:tutorials,代码行数:101,代码来源:Text.cpp

示例10: SetBkMode

BOOL CTextLayout::Render(HDC hdc, const WCHAR *psz,  UINT nCnt, UINT nSelStart, UINT nSelEnd,
                         const COMPOSITIONRENDERINFO *pCompositionRenderInfo, UINT nCompositionRenderInfo)
{
    POINT ptCurrent;
    ptCurrent.x = 0;
    ptCurrent.y = 0;

    SetBkMode(hdc, OPAQUE);
    SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT));
    SetBkColor(hdc, GetSysColor(COLOR_WINDOW));

    // Render lines
    for (UINT i = 0; i < _nLineCnt; i++)
    {
        if (_prgLines[i].nCnt)
        {
            TextOut(hdc, 
                    ptCurrent.x, 
                    ptCurrent.y, 
                    psz + _prgLines[i].nPos, 
                    _prgLines[i].nCnt);
        }
        ptCurrent.x = 0;
        ptCurrent.y += _nLineHeight;
    }
   
    _fCaret = FALSE;

    // Render selection/caret
    RECT rcSel;
    if (_nLineCnt)
    {
        for (UINT i = 0; i < _nLineCnt; i++)
        {
            if ((nSelEnd >= _prgLines[i].nPos) &&
                (nSelStart <= _prgLines[i].nPos + _prgLines[i].nCnt))
            {
                UINT nSelStartInLine = 0;
                UINT nSelEndInLine = _prgLines[i].nCnt;

                if (nSelStart > _prgLines[i].nPos)
                    nSelStartInLine = nSelStart - _prgLines[i].nPos;

                if (nSelEnd < _prgLines[i].nPos + _prgLines[i].nCnt)
                    nSelEndInLine = nSelEnd - _prgLines[i].nPos;
    
                if (nSelStartInLine != nSelEndInLine)
                {
                    for (UINT j = nSelStartInLine; j < nSelEndInLine; j++)
                    {
                        InvertRect(hdc, &_prgLines[i].prgCharInfo[j].rc);
                    }
                }
                else
                {
                    if (nSelStartInLine == _prgLines[i].nCnt)
                    {
                        rcSel = _prgLines[i].prgCharInfo[nSelStartInLine - 1].rc;
                        rcSel.left = rcSel.right;
                        rcSel.right++;
                    }
                    else
                    {
                        rcSel = _prgLines[i].prgCharInfo[nSelStartInLine].rc;
                        rcSel.right = rcSel.left + 1;
                    }
                    InvertRect(hdc, &rcSel);
                    _fCaret = TRUE;
                    _rcCaret = rcSel;
                }
            }

            for (UINT j = 0; j < nCompositionRenderInfo; j++)
            {
    
                if ((pCompositionRenderInfo[j].nEnd >= _prgLines[i].nPos) &&
                   (pCompositionRenderInfo[j].nStart <= _prgLines[i].nPos + _prgLines[i].nCnt))
                {
                    UINT nCompStartInLine = 0;
                    UINT nCompEndInLine = _prgLines[i].nCnt;
                    int  nBaseLineWidth = (_nLineHeight / 18) + 1;
    
                    if (pCompositionRenderInfo[j].nStart > _prgLines[i].nPos)
                        nCompStartInLine = pCompositionRenderInfo[j].nStart - _prgLines[i].nPos;
    
                    if (pCompositionRenderInfo[j].nEnd < _prgLines[i].nPos + _prgLines[i].nCnt)
                        nCompEndInLine = pCompositionRenderInfo[j].nEnd - _prgLines[i].nPos;
    
                    for (UINT k = nCompStartInLine; k < nCompEndInLine; k++)
                    {
                        UINT uCurrentCompPos = _prgLines[i].nPos + k - pCompositionRenderInfo[j].nStart;
                        BOOL bClause = FALSE;
     
                        if (k + 1 == nCompEndInLine)
                        {
                            bClause = TRUE;
                        }

                        if ((pCompositionRenderInfo[j].da.crText.type != TF_CT_NONE) &&
                            (pCompositionRenderInfo[j].da.crBk.type != TF_CT_NONE))
//.........这里部分代码省略.........
开发者ID:Ippei-Murofushi,项目名称:WindowsSDK7-Samples,代码行数:101,代码来源:TextLayout.cpp

示例11: LayerWndProc

// Window layer procedure
LRESULT CALLBACK LayerWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	RECT clipRect	= {0, 0, 500, 500};
	HBRUSH hBrush;
	HPEN hPen;
	HFONT hFont;


	switch (message)
	{
	case WM_ERASEBKGND:
		 GetClientRect(hWnd, &clipRect);
		
		hdc = GetDC(hWnd);
        hBrush = CreateSolidBrush(RGB(100,100,100));
        SelectObject(hdc, hBrush);
		hPen = CreatePen(PS_DASH,1,RGB(255,255,255));
		SelectObject(hdc, hPen);
		Rectangle(hdc,0,0,clipRect.right,clipRect.bottom);

		//矩形のサイズを出力
		int fHeight;
		fHeight = -MulDiv(8, GetDeviceCaps(hdc, LOGPIXELSY), 72);
		hFont = CreateFont(fHeight,    //フォント高さ
			0,                    //文字幅
			0,                    //テキストの角度
			0,                    //ベースラインとx軸との角度
			FW_REGULAR,            //フォントの重さ(太さ)
			FALSE,                //イタリック体
			FALSE,                //アンダーライン
			FALSE,                //打ち消し線
			ANSI_CHARSET,    //文字セット
			OUT_DEFAULT_PRECIS,    //出力精度
			CLIP_DEFAULT_PRECIS,//クリッピング精度
			PROOF_QUALITY,        //出力品質
			FIXED_PITCH | FF_MODERN,//ピッチとファミリー
			L"Tahoma");    //書体名

		SelectObject(hdc, hFont);
		// show size
		int iWidth, iHeight;
		iWidth  = clipRect.right  - clipRect.left;
		iHeight = clipRect.bottom - clipRect.top;

		wchar_t sWidth[200], sHeight[200];
		swprintf_s(sWidth, L"%d", iWidth);
		swprintf_s(sHeight, L"%d", iHeight);

		int w,h,h2;
		w = -fHeight * 2.5 + 8;
		h = -fHeight * 2 + 8;
		h2 = h + fHeight;

		SetBkMode(hdc,TRANSPARENT);
		SetTextColor(hdc,RGB(0,0,0));
		TextOut(hdc, clipRect.right-w+1,clipRect.bottom-h+1,(LPCWSTR)sWidth,wcslen(sWidth));
		TextOut(hdc, clipRect.right-w+1,clipRect.bottom-h2+1,(LPCWSTR)sHeight,wcslen(sHeight));
		SetTextColor(hdc,RGB(255,255,255));
		TextOut(hdc, clipRect.right-w,clipRect.bottom-h,(LPCWSTR)sWidth,wcslen(sWidth));
		TextOut(hdc, clipRect.right-w,clipRect.bottom-h2,(LPCWSTR)sHeight,wcslen(sHeight));

		DeleteObject(hPen);
		DeleteObject(hBrush);
		DeleteObject(hFont);
		ReleaseDC(hWnd, hdc);

		return TRUE;

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

}
开发者ID:zzeneg,项目名称:Gyazowin,代码行数:77,代码来源:gyazowin.cpp

示例12: DlgProc

int CALLBACK DlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
	HDC hdc,khdc;
	HBITMAP oldbmp,newbmp;
	PAINTSTRUCT paint;
	RECT rect;
	char s[32];
	LPDRAWITEMSTRUCT dw;
	int i=0;
	HBRUSH hb;

	switch(msg)
	{
	case WM_INITDIALOG:

		ShowWindow(hWnd,SW_SHOW);
		OldListProc = (WNDPROC)SetWindowLong(GetDlgItem(hWnd,IDC_LIST1),GWL_WNDPROC,(long)NewWindowProc);
//		for(i=0;i<50;i++)
//			SendMessage(GetDlgItem(hWnd,IDC_LIST1),LB_ADDSTRING,0,(LPARAM)s);
//		GetWindowRect(GetDlgItem(hWnd,IDC_LIST1),&rect);
//		InvalidateRect(GetDlgItem(hWnd,IDC_LIST1),&rect,TRUE);
		GetCallAddress(GetDlgItem(hWnd,IDC_LIST1));
		if(SendMessage(GetDlgItem(hWnd,IDC_LIST1),LB_GETCOUNT,wParam,lParam)>0)
			SendMessage(GetDlgItem(hWnd,IDC_LIST1),LB_SETCURSEL,0,0);

		
		break;

	case WM_CLOSE:
		
		EndDialog(hWnd,0);
		break;
	case WM_PAINT:
		hdc=BeginPaint(hWnd,&paint);
		newbmp = LoadBitmap(hin,MAKEINTRESOURCE(IDB_BITMAP1));		
		GetClientRect(hWnd,&rect);
		khdc = CreateCompatibleDC( hdc );
		oldbmp = (HBITMAP)SelectObject(khdc,(HGDIOBJ)newbmp);
		BitBlt(hdc,0,0,rect.right-rect.left,rect.bottom-rect.top,khdc,0,0,SRCCOPY);
		SelectObject(khdc,(HGDIOBJ)oldbmp);
		DeleteObject(khdc);
		DeleteObject((HGDIOBJ)newbmp);
		EndPaint(hWnd,&paint);
		
		break;
	case WM_DRAWITEM:
		if(wParam == IDC_LIST1)
		{
			dw = (LPDRAWITEMSTRUCT) lParam;
			SendMessage(dw->hwndItem,LB_GETITEMRECT,dw->itemID,(WPARAM)&rect);
			if(dw->itemState & ODS_SELECTED||dw->itemState)
			{
				hb = CreateSolidBrush(RGB(0xff,0xff,0xff));
				FillRect(dw->hDC,&rect,hb);
				DeleteObject(hb);
			}

//			SendMessage(hWnd,LB_GETITEMDATA,dw->itemID,(LPARAM)s);
			wsprintf(s,"0x%08x",(dw->itemData)&0x7fffffff);
			if((dw->itemData&0x80000000)==0)
				SetTextColor(dw->hDC,RGB(0,0,0));
			else
				SetTextColor(dw->hDC,RGB(0xff,0,0));
			TextOut(dw->hDC,rect.left+2,rect.top+2,s,lstrlen(s));

		}

		else		return DefWindowProc(hWnd,msg,wParam,lParam);
		break;
	case WM_CTLCOLORLISTBOX:
		hdc=(HDC)wParam;
		::SetBkMode(hdc,TRANSPARENT);
		SetTextColor(hdc,RGB(64,32,0));
		return (int)GetStockObject(HOLLOW_BRUSH);
		break;
	}
	return 0;
}
开发者ID:LegalEagle,项目名称:Arianrhod,代码行数:78,代码来源:OllyGal.cpp

示例13: draw_scrolls

void draw_scrolls(HDC dc, HDC sdc, int x, int y, int w, double v, struct osd_item *oi)
{
	int lw = 1, rw = 1, mw = 10, i, xp = 0, lp = 0, ow = w;

	BitBlt(dc, x, y, lw, oi->h, sdc, oi->sx, oi->sy, SRCCOPY);
	lp = x + lw;

	for(i=0; i<=(w - rw - lw - mw); i+=mw)
	{
		BitBlt(dc, x + lw + i, y, mw, oi->h, sdc, oi->sx + lw, oi->sy, SRCCOPY);
		lp = x + lw + i + mw;
	}

	BitBlt(dc, lp, y, (x + w) - lp - rw, oi->h, sdc, oi->sx + lw, oi->sy, SRCCOPY);
	BitBlt(dc, x + w - rw, y, rw, oi->h, sdc, oi->sx + oi->w - rw, oi->sy, SRCCOPY);

	xp = lp = 0;

	w = (int)(w * v);

	if(w > 0)
	{
		BitBlt(dc, x, y, lw, oi->h, sdc, oi->sx_h, oi->sy_h, SRCCOPY);
		lp = x + lw;

		for(i=0; i<=(w - rw - lw - mw); i+=mw)
		{
			BitBlt(dc, x + lw + i, y, mw, oi->h, sdc, oi->sx_h + lw, oi->sy_h, SRCCOPY);
			lp = x + lw + i + mw;
		}

		BitBlt(dc, lp, y, (x + w) - lp - rw, oi->h, sdc, oi->sx_h + lw, oi->sy_h, SRCCOPY);
		BitBlt(dc, x + w - rw, y, rw, oi->h, sdc, oi->sx_h + oi->w - rw, oi->sy_h, SRCCOPY);
	}

	if(ow > 40)
	{
		if(oi->id == osd_id_seek)
		{
			HFONT nfont, ofont;
			SIZE  pz;
			string ttext;
			nfont = CreateFont(-MulDiv(10, GetDeviceCaps(dc, LOGPIXELSY), 72),
												0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET,
												OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, 5,
												DEFAULT_PITCH, uni("Tahoma"));

			ofont = (HFONT) SelectObject(dc, nfont);

			SetBkMode(dc, TRANSPARENT);
			

			ttext = get_time_text((int)(vdata.shared->audio.output.getduration_ms() / 1000));
			GetTextExtentPoint32(dc, ttext, (int)str_len(ttext), &pz);
			SetTextColor(dc, 0x000000);
			TextOut(dc, x + ow - pz.cx + 1, y + oi->h + 5 + 1, ttext, (int)str_len(ttext));
			SetTextColor(dc, 0xffffff);
			TextOut(dc, x + ow - pz.cx, y + oi->h + 5, ttext, (int)str_len(ttext));

			ttext = get_time_text((int)(vdata.shared->audio.output.getposition_ms() / 1000));
			GetTextExtentPoint32(dc, ttext, (int)str_len(ttext), &pz);
			SetTextColor(dc, 0x000000);
			TextOut(dc, x + 1, y + oi->h + 5 + 1, ttext, (int)str_len(ttext));
			SetTextColor(dc, 0xffffff);
			TextOut(dc, x, y + oi->h + 5, ttext, (int)str_len(ttext));

			if(show_seek_position_tip)
			{
				double posfrac = (double)show_seek_position_tip / (double)ow;
				int duration = (int)(vdata.shared->audio.output.getduration_ms() / 1000);
				ttext = get_time_text((int)((double)duration * posfrac));
				GetTextExtentPoint32(dc, ttext, (int)str_len(ttext), &pz);
				SetTextColor(dc, 0x000000);
				TextOut(dc, x + show_seek_position_tip + 1 - (pz.cx / 2), y - pz.cy - 5 + 1, ttext, (int)str_len(ttext));
				SetTextColor(dc, 0xffffff);
				TextOut(dc, x + show_seek_position_tip - (pz.cx / 2), y - pz.cy - 5 , ttext, (int)str_len(ttext));
			}


			SelectObject(dc, ofont);
			DeleteObject(nfont);
		}
	}
}
开发者ID:hownam,项目名称:fennec,代码行数:84,代码来源:osd.c

示例14: INITIALIZE_DDRAW

Text::Text(int FSIZE, const char *text, string printtext,int Startx, int Starty, int Startz, int W, int H, bool Console)
{

	ObjString = text;
	textout = printtext.c_str();
	Width = W;
	Height = H;
	DeathCounter = 50;//frames before deleting
	ConsoleDisplay = Console;
	fontsize = FSIZE;
	
	CollBox.top = Starty;
	CollBox.bottom = (Starty + H);
	CollBox.left = Startx;
	CollBox.right = (Startx +(W));

	DDSURFACEDESC2 ddsd;
	INITIALIZE_DDRAW(ddsd);
	ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_CKSRCBLT;
	ddsd.dwWidth = W;
	ddsd.dwHeight = H;
	ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY;
	ddsd.ddckCKSrcBlt.dwColorSpaceLowValue = _RGB16BIT565(255, 0, 255);
	ddsd.ddckCKSrcBlt.dwColorSpaceHighValue = _RGB16BIT565(255, 0, 255);

	if(FAILED(lpdd->CreateSurface(&ddsd, &TheBitmap, NULL)))
	{
		// Failed making surface
	}

	x = Startx;
	y = Starty;
	z = Startz;
//text render code

	 if (lpddsback->GetDC(&hdc) == DD_OK)  
	 {  
		 
		  SetBkMode(hdc, TRANSPARENT); 
		  SetTextColor(hdc, RGB(255,255,255));
		  if(textout.length() < (int)(Width/8))
		  {
			  LOGFONT logfont = {fontsize,0,0,0,FW_SEMIBOLD,false,false,false,DEFAULT_CHARSET ,OUT_CHARACTER_PRECIS,CLIP_DEFAULT_PRECIS, PROOF_QUALITY,FF_MODERN,"Lucida Console"};
			  tempfont = CreateFontIndirect(&logfont);
			SelectObject(hdc,tempfont);
			TextOut(hdc, x, y, textout.c_str(), textout.length()); 
		  }
		  else
		  {
			for(int i = 0;(i*(int)(Width/8))<(int)textout.length();i++)
			{
			  LOGFONT logfont = {fontsize,0,0,0,FW_SEMIBOLD,false,false,false,DEFAULT_CHARSET ,OUT_CHARACTER_PRECIS,CLIP_DEFAULT_PRECIS, PROOF_QUALITY,FF_MODERN,"Lucida Console"};
			  tempfont = CreateFontIndirect(&logfont);
			SelectObject(hdc,tempfont);
				TextOut(hdc, x, (y+(i*20)), (textout.substr((i*(int)(Width/8)),(int)(Width/8))).c_str(), (textout.substr((i*(int)(Width/8)),(int)(Width/8))).length()); 
			}
		  }

		  lpddsback->ReleaseDC(hdc);  


	 }


	

	SourceRect.top = 0;
	SourceRect.left = 0;
	SourceRect.right = W;
	SourceRect.bottom = H;

	RenderThis = true;
}
开发者ID:Josh-Stewart,项目名称:GoldRush,代码行数:73,代码来源:Text.cpp

示例15: WndProc


//.........这里部分代码省略.........
        
             
        
                   case   VK_DOWN:
        
                           yCaret = min (yCaret + 1, cyBuffer - 1) ;
        
                           break ;
        
             
        
                   case   VK_DELETE:
        
                           for (x = xCaret ; x < cxBuffer - 1 ; x++)
        
                                          BUFFER (x, yCaret) = BUFFER (x + 1, yCaret) ;
        
             
        
                           BUFFER (cxBuffer - 1, yCaret) = ' ' ;
        
             
        
                           HideCaret (hwnd) ;
        
                           hdc = GetDC (hwnd) ;
        
        
        
                           SelectObject (hdc, CreateFont (0, 0, 0, 0, 0, 0, 0, 0,
        
                                                                 dwCharSet, 0, 0, 0,FIXED_PITCH, NULL)) ;
        
                          TextOut (hdc, xCaret * cxChar, yCaret * cyChar,
        
                                                          & BUFFER (xCaret, yCaret),
        
                                                          cxBuffer - xCaret) ;
        

                           DeleteObject (SelectObject (hdc, GetStockObject (SYSTEM_FONT))) ;
        
                           ReleaseDC (hwnd, hdc) ;
        
                          ShowCaret (hwnd) ;
        
                          break ;
        
            }
        
            SetCaretPos (xCaret * cxChar, yCaret * cyChar) ;
        
            return 0 ;
        
        
        
    case   WM_CHAR:
        
            for (i = 0 ; i < (int) LOWORD (lParam) ; i++)
        
            {
        
                   switch (wParam)
        
                           {
        
开发者ID:powernick,项目名称:CodeLib,代码行数:66,代码来源:Typer.c


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