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


C++ SetTextAlign函数代码示例

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


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

示例1: SetTextAlign

void GridDisplay::SetDefault()
{
	SetTextAlign();
	SetHorzMargin();
	SetVertMargin();
	SetTheme();
	ReverseSortIcon(false);
}
开发者ID:ultimatepp,项目名称:mirror,代码行数:8,代码来源:GridDisplay.cpp

示例2: toolBitmap

//------------------------------------------------------------------
void toolBitmap()
{
	int i;
	TBADDBITMAP a;
	HDC dc, wdc;
	HGDIOBJ oldBmp, oldF;
	TCHAR c;
	HBRUSH br;
	RECT rc;
	HBITMAP b;
	LOGFONT font;
	const int Nbut1=35, Nbut=Nbut1+Msymbol+1;

	wdc=GetDC(toolbar);
	dc=CreateCompatibleDC(wdc);
	b=CreateCompatibleBitmap(wdc, Nbut*16, 15);
	ReleaseDC(toolbar, wdc);
	oldBmp=SelectObject(dc, b);
	rc.left=0; rc.right=16*Nbut1; rc.bottom=15; rc.top=0;
	FillRect(dc, &rc, GetSysColorBrush(COLOR_BTNFACE));
	SetBkMode(dc, TRANSPARENT);
	SetTextAlign(dc, TA_CENTER);
	memset(&font, 0, sizeof(LOGFONT));
	font.lfHeight=-15;
	_tcscpy(font.lfFaceName, _T("Tahoma"));
	oldF=SelectObject(dc, CreateFontIndirect(&font));
	for(i=0; i<Nbut1; i++){
		c=num2char(i);
		TextOut(dc, 16*i+8, -1, &c, 1);
	}
	DeleteObject(SelectObject(dc, oldF));
	for(; i<Nbut; i++){
		rc.left=i*16;
		rc.right=rc.left+16;
		FillRect(dc, &rc, br=CreateSolidBrush(colors[i-Nbut1]));
		DeleteObject(br);
	}
	SelectObject(dc, oldBmp);
	DeleteDC(dc);

	if(toolBmp){
		TBREPLACEBITMAP rb;
		rb.hInstOld=0;
		rb.nIDOld=(UINT_PTR)toolBmp;
		rb.hInstNew=0;
		rb.nIDNew=(UINT_PTR)b;
		rb.nButtons=Nbut;
		SendMessage(toolbar, TB_REPLACEBITMAP, 0, (LPARAM)&rb);
		DeleteObject(toolBmp);
	}
	else{
		a.hInst=(HINSTANCE)0;
		a.nID=(UINT_PTR)b;
		toolNumIndex= SendMessage(toolbar, TB_ADDBITMAP, Nbut, (LPARAM)&a);
	}
	toolBmp=b;
	InvalidateRect(toolbar, 0, TRUE);
}
开发者ID:kambala-decapitator,项目名称:colorsudoku,代码行数:59,代码来源:sudoku.cpp

示例3: gr_reset

static value gr_reset(void)
{
    RECT rc;
    int screenx,screeny;

    screenx = GetSystemMetrics(SM_CXSCREEN);
    screeny = GetSystemMetrics(SM_CYSCREEN);
    GetClientRect(grwindow.hwnd,&rc);
    grwindow.gc = GetDC(grwindow.hwnd);
    grwindow.width = rc.right;
    grwindow.height = rc.bottom;
    if (grwindow.gcBitmap == (HDC)0) {
        grwindow.hBitmap = CreateCompatibleBitmap(grwindow.gc,screenx,
                           screeny);
        grwindow.gcBitmap = CreateCompatibleDC(grwindow.gc);
        grwindow.tempDC = CreateCompatibleDC(grwindow.gc);
        SelectObject(grwindow.gcBitmap,grwindow.hBitmap);
        SetMapMode(grwindow.gcBitmap,MM_TEXT);
        MoveToEx(grwindow.gcBitmap,0,grwindow.height-1,0);
        BitBlt(grwindow.gcBitmap,0,0,screenx,screeny,
               grwindow.gcBitmap,0,0,WHITENESS);
        grwindow.CurrentFontSize = 15;
        grwindow.CurrentFont = CreationFont("Courier");
    }
    grwindow.CurrentColor = GetSysColor(COLOR_WINDOWTEXT);
    grwindow.grx = 0;
    grwindow.gry = 0;
    grwindow.CurrentPen = SelectObject(grwindow.gc,
                                       GetStockObject(WHITE_PEN));
    SelectObject(grwindow.gc,grwindow.CurrentPen);
    SelectObject(grwindow.gcBitmap,grwindow.CurrentPen);
    grwindow.CurrentBrush = SelectObject(grwindow.gc,
                                         GetStockObject(WHITE_BRUSH));
    SelectObject(grwindow.gc,grwindow.CurrentBrush);
    SelectObject(grwindow.gcBitmap,grwindow.CurrentBrush);
    caml_gr_set_color(Val_long(0));
    SelectObject(grwindow.gc,grwindow.CurrentFont);
    SelectObject(grwindow.gcBitmap,grwindow.CurrentFont);
    grdisplay_mode = grremember_mode = 1;
    MoveToEx(grwindow.gc,0,grwindow.height-1,0);
    MoveToEx(grwindow.gcBitmap,0,grwindow.height-1,0);
    SetTextAlign(grwindow.gcBitmap,TA_BOTTOM);
    SetTextAlign(grwindow.gc,TA_BOTTOM);
    return Val_unit;
}
开发者ID:vouillon,项目名称:ocaml,代码行数:45,代码来源:open.c

示例4: DisplaySpaceyMsg

void DisplaySpaceyMsg(void)
{

	UINT fMode;
	HDC dc;
    
	dc = Screen->GetBack()->GetDC();
    
	fMode = GetTextAlign(dc);
	SetTextAlign(dc, TA_CENTER | VTA_CENTER);
    
    Screen->GetBack()->TextXY(320, 2, GreenTxt, "SPACEY VADERS");
    Screen->GetBack()->TextXY(320, 20, GreenTxt, "by Paul Lord '97");

	SetTextAlign(dc, fMode);
	Screen->GetBack()->ReleaseDC();

}
开发者ID:hyuntaeng,项目名称:CDX,代码行数:18,代码来源:GAMEIO.CPP

示例5: PrintText

void PrintText( HWND hwnd,int cxChar,int cyChar,int cxCaps )
{
	HDC hdc;
	PAINTSTRUCT ps;
	SCROLLINFO si;
	int iVertPos,iHorzPos,iPaintBeg,iPaintEnd;
	int x,y;
	TCHAR szBuffer[10];

	hdc = BeginPaint(hwnd,&ps);

	si.cbSize = sizeof(si);
	si.fMask = SIF_POS;
	GetScrollInfo(hwnd,SB_VERT,&si);
	iVertPos = si.nPos;

	GetScrollInfo(hwnd,SB_HORZ,&si);
	iHorzPos = si.nPos;

	iPaintBeg = max(0,iVertPos + ps.rcPaint.top / cyChar);
	iPaintEnd = min(NUMLINES - 1, iVertPos + ps.rcPaint.bottom / cyChar);

	for (int i = iPaintBeg ; i <= iPaintEnd ; i++)
	{
		x = cxChar * (1 - iHorzPos) ;
		y = cyChar * (i - iVertPos) ;

		TextOut (hdc, x, y,sysmetrics[i].szLabel,
			lstrlen (sysmetrics[i].szLabel)) ;

		TextOut (hdc, x + 22 * cxCaps, y,sysmetrics[i].szDesc,
			lstrlen (sysmetrics[i].szDesc)) ;

		SetTextAlign (hdc, TA_RIGHT | TA_TOP) ;

		TextOut (hdc, x + 22 * cxCaps + 40 * cxChar, y, szBuffer,
			wsprintf (szBuffer, TEXT ("%5d"),
			GetSystemMetrics (sysmetrics[i].iIndex))) ;

		SetTextAlign (hdc, TA_LEFT | TA_TOP) ;
	}

	EndPaint(hwnd,&ps);
}
开发者ID:yuechuanbingzhi163,项目名称:CPPPractice,代码行数:44,代码来源:DemoFunctions.cpp

示例6: memset

uint32_t      *plTextGenerator::IAllocateOSSurface( uint16_t width, uint16_t height )
{
#if HS_BUILD_FOR_WIN32

    BITMAPINFO  bmi;


    // Create a new DC and bitmap that we can draw characters to
    memset( &bmi.bmiHeader, 0, sizeof( BITMAPINFOHEADER ) );
    bmi.bmiHeader.biSize = sizeof( BITMAPINFOHEADER );
    bmi.bmiHeader.biWidth = width;
    bmi.bmiHeader.biHeight = -(int)height;
    bmi.bmiHeader.biPlanes = 1;
    bmi.bmiHeader.biCompression = BI_RGB;
    bmi.bmiHeader.biBitCount = 32;
    
    fWinRGBDC = CreateCompatibleDC( nil );
    fWinRGBBitmap = CreateDIBSection( fWinRGBDC, &bmi, DIB_RGB_COLORS, (void **)&fWinRGBBits, nil, 0 );
    SetMapMode( fWinRGBDC, MM_TEXT );
    SetBkMode( fWinRGBDC, TRANSPARENT );
    SetTextAlign( fWinRGBDC, TA_TOP | TA_LEFT );

    SelectObject( fWinRGBDC, fWinRGBBitmap );

    // Now create a second DC/bitmap combo, this one for writing alpha values to
    memset( &bmi.bmiHeader, 0, sizeof( BITMAPINFOHEADER ) );
    bmi.bmiHeader.biSize = sizeof( BITMAPINFOHEADER );
    bmi.bmiHeader.biWidth = width;
    bmi.bmiHeader.biHeight = -(int)height;
    bmi.bmiHeader.biPlanes = 1;
    bmi.bmiHeader.biCompression = BI_RGB;
    bmi.bmiHeader.biBitCount = 8;
    
    fWinAlphaDC = CreateCompatibleDC( nil );
    fWinAlphaBitmap = CreateDIBSection( fWinAlphaDC, &bmi, DIB_RGB_COLORS, (void **)&fWinAlphaBits, nil, 0 );
    SetMapMode( fWinAlphaDC, MM_TEXT );
    SetBkMode( fWinAlphaDC, TRANSPARENT );
    SetTextAlign( fWinAlphaDC, TA_TOP | TA_LEFT );

    SelectObject( fWinAlphaDC, fWinAlphaBitmap );

    return (uint32_t *)fWinRGBBits;
#endif
}
开发者ID:Asteral,项目名称:Plasma,代码行数:44,代码来源:plTextGenerator.cpp

示例7: Rectangle

HRESULT CJoystickCtl::OnDraw(ATL_DRAWINFO& di) {
	RECT& rc = *(RECT*) di.prcBounds;
	Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom);

	SetTextAlign(di.hdcDraw, TA_CENTER|TA_BASELINE);
	LPCTSTR pszText = _T("JavaScript Joystick");
	TextOut(di.hdcDraw, (rc.left + rc.right) / 2, (rc.top + rc.bottom) / 2, pszText, lstrlen(pszText));

	return S_OK;
}
开发者ID:09898,项目名称:javascript-joystick,代码行数:10,代码来源:JoystickCtl.cpp

示例8: SetBkMode

void Panel::NowPutTextOnBackground()
{  SetBkMode(hDC2,TRANSPARENT); 
 //  SetTextColor(hDC2,RGB(0,147,221));
SetTextColor(hDC2,RGB(255,100,100));
   SetTextAlign(hDC2,TA_CENTER);
   SelectObject(hDC2,hFNT_Panel);
   for (int i=0;i<text_num;i++)
	TextOut(hDC2,Text_list[i].x,Text_list[i].y,Text_list[i].text, sizeof(char)*strlen(Text_list[i].text));
  
}
开发者ID:Artoria2e5,项目名称:obtr,代码行数:10,代码来源:Panel.cpp

示例9: DrawRings

void DrawRings( HWND hwnd, HDC hdc )
 {
  double Angle, dAngle, Radius;

  int    i, x, y;
  HFONT  hFont, hFontOld;



  if( lstrlen(szString) == 0 ) return;

  Radius = cxDC / 4;
  dAngle = 360.0 / (double)lstrlen(szString);

  Ellipse( hdc, xDC + cxDC/2-(int)Radius, yDC + cyDC/2-(int)Radius,
                xDC + cxDC/2+(int)Radius, yDC + cyDC/2+(int)Radius  );

  Angle = 0.0;

  for( i = 0; i < lstrlen(szString); i++, Angle += dAngle )
   {
    lf.lfEscapement  = lf.lfOrientation = (int)(10.0*Angle);

    hFont = CreateFontIndirect( &lf );
    if( !hFont )
     {
      dprintf( "Couldn't create font for Angle = %d", (int)Angle );
      continue;
     }

    hFontOld = SelectObject( hdc, hFont );

    SetTextAlign( hdc, wTextAlign );
    SetBkMode( hdc, iBkMode );
    SetBkColor( hdc, dwRGBBackground );
    SetTextColor( hdc, dwRGBText );

    x = xDC + cxDC/2 + (int)(Radius * sin( TWOPI * Angle / 360.0 ) );
    y = yDC + cyDC/2 + (int)(Radius * cos( TWOPI * Angle / 360.0 ) );

//    dprintf( "  x, y = %d, %d", x, y );

    TextOut( hdc, x, y, &szString[i], 1 );

    MoveToEx( hdc, x-cxDC/150, y          ,0);
    LineTo( hdc, x+cxDC/150, y          );
    MoveToEx( hdc, x,          y-cxDC/150 ,0);
    LineTo( hdc, x,          y+cxDC/150 );

    SelectObject( hdc, hFontOld );
    DeleteObject( hFont );
   }

  lf.lfEscapement = lf.lfOrientation = 0;
 }
开发者ID:Gaikokujin,项目名称:WinNT4,代码行数:55,代码来源:rings.c

示例10: vJustify3

VOID vJustify3(HDC hdc, int x, int y, char * psz1, char * psz2, char * psz3, ULONG cxLen)
{
    ULONG cBrk = cBreak(psz1) + cBreak(psz2) + cBreak(psz3);

    ULONG cx = cxSize(hdc,psz1) + cxSize(hdc,psz2) + cxSize(hdc,psz3);

    BOOL  bOk;

    POINT pt;
    MoveToEx(hdc,x,y,&pt);

    SetTextAlign(hdc, TA_LEFT | TA_TOP | TA_UPDATECP);

    // DbgPrint("cBrk = %ld, cxSize = %ld\n", cBrk, cx);

    bOk = SetTextJustification(hdc, (int)(cxLen - cx), cBrk);
    if(!bOk)
        vDoPause(0);

    bOk = TextOut(hdc, 0, 0, psz1, strlen(psz1));
    if(!bOk)
        vDoPause(0);

    SetBkColor(hdc, RGB(0,0,255));

    bOk = TextOut(hdc, 0, 0, psz2, strlen(psz2));
    if(!bOk)
        vDoPause(0);

    SetBkColor(hdc, RGB(255,0,0));

    bOk = TextOut(hdc, 0, 0, psz3, strlen(psz3));
    if(!bOk)
        vDoPause(0);

    bOk = SetTextJustification(hdc,0,0);
    if(!bOk)
        vDoPause(0);

    SetTextAlign(hdc, TA_LEFT | TA_TOP | TA_NOUPDATECP);
    SetBkColor(hdc, RGB(0,255,0));
}
开发者ID:Gaikokujin,项目名称:WinNT4,代码行数:42,代码来源:ftgentxt.c

示例11: on_draw

    virtual BOOL on_draw   (HELEMENT he, UINT draw_type, HDC hdc, const RECT& rc ) 
    { 
      if( draw_type != DRAW_CONTENT )
        return FALSE; /*do default draw*/ 

      dom::element el = he;
      
      UINT pta = GetTextAlign(hdc);
      SetTextAlign(hdc, TA_LEFT | TA_TOP |TA_NOUPDATECP); 
#ifdef _WIN32_WCE
    CString fileName(el.text());
    CString dottedFileName;
    FormatFileName(hdc, fileName, dottedFileName, rc.right - rc.left);
    DrawTextW(hdc, dottedFileName, -1, const_cast<RECT*>(&rc), DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_NOPREFIX | DT_NOCLIP);
#else
      DrawTextW(hdc, el.text(), -1, const_cast<RECT*>(&rc), DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_PATH_ELLIPSIS | DT_NOPREFIX);
#endif
      SetTextAlign(hdc, pta); 
      return TRUE; /*skip default draw as we did it already*/ 
    }
开发者ID:AllanDragoon,项目名称:dotnetinstaller,代码行数:20,代码来源:behavior_path.cpp

示例12: SetTextAlign

// the initialization method
void TSRGuiFileBrowser::Initialize()
{
    m_Maxcharacters = 10;
    m_eType = TWISTER_GUI_COMPONENT_FILEBROWSER;
    m_bClickable    = true;
    SetTextAlign( GUI_ALIGN_TOPLEFT );
    SetFilter( "*.*" );
    m_FolderColor.Assign( 1.0f, 0.0f, 0.0f );
    m_FileColor.Assign( 0.0f, 0.0f, 1.0f );
    m_HotColor.Assign( 0.5f, 0.5f, 0.5f );
}
开发者ID:ShadyEM,项目名称:Twister3D,代码行数:12,代码来源:TSRGuiFileBrowser.cpp

示例13: vJustify2

VOID vJustify2(HDC hdc, int x, int y, char * psz1, char * psz2, ULONG cxLen)
{
    ULONG cBrk = cBreak(psz1) + cBreak(psz2);

    ULONG cx   = cxSize(hdc,psz1) + cxSize(hdc,psz2);

    BOOL  bOk;

    POINT pt;
    MoveToEx(hdc,x,y,&pt);

    SetTextAlign(hdc, TA_LEFT | TA_TOP | TA_UPDATECP);

    // DbgPrint("cBrk = %ld, cxSize = %ld\n", cBrk, cx);

    bOk = SetTextJustification(hdc, (int)(cxLen - cx), cBrk);
    if(!bOk)
        vDoPause(0);

    bOk = TextOut(hdc, 0, 0, psz1, strlen(psz1));
    if(!bOk)
        vDoPause(0);

    // change bk color to observe which part of the string is written
    // by the second call

    SetBkColor(hdc, RGB(0,0,255));

    bOk = TextOut(hdc, 0, 0, psz2, strlen(psz2));
    if(!bOk)
        vDoPause(0);

    bOk = SetTextJustification(hdc,0,0);
    if(!bOk)
        vDoPause(0);

    SetTextAlign(hdc, TA_LEFT | TA_TOP | TA_NOUPDATECP);

    SetBkColor(hdc, RGB(0,255,0));      // restore old color

}
开发者ID:Gaikokujin,项目名称:WinNT4,代码行数:41,代码来源:ftgentxt.c

示例14: TextOutA

void CtrlDisAsmView::drawArguments(HDC hdc, const DisassemblyLineInfo &line, int x, int y, int textColor, const std::set<std::string> &currentArguments) {
	if (line.params.empty()) {
		return;
	}
	// Don't highlight the selected lines.
	if (isInInterval(selectRangeStart, selectRangeEnd - selectRangeStart, line.info.opcodeAddress)) {
		TextOutA(hdc, x, y, line.params.c_str(), (int)line.params.size());
		return;
	}

	int highlightedColor = 0xaabb00;
	if (textColor == 0x0000ff) {
		highlightedColor = 0xaabb77;
	}

	UINT prevAlign = SetTextAlign(hdc, TA_UPDATECP);
	MoveToEx(hdc, x, y, NULL);

	size_t p = 0, nextp = line.params.find(',');
	while (nextp != line.params.npos) {
		const std::string arg = line.params.substr(p, nextp - p);
		if (currentArguments.find(arg) != currentArguments.end() && textColor != 0xffffff) {
			SetTextColor(hdc, highlightedColor);
		}
		TextOutA(hdc, 0, 0, arg.c_str(), (int)arg.size());
		SetTextColor(hdc,textColor);
		p = nextp + 1;
		nextp = line.params.find(',', p);
		TextOutA(hdc, 0, 0, ",", 1);
	}
	if (p < line.params.size()) {
		const std::string arg = line.params.substr(p);
		if (currentArguments.find(arg) != currentArguments.end() && textColor != 0xffffff) {
			SetTextColor(hdc, highlightedColor);
		}
		TextOutA(hdc, 0, 0, arg.c_str(), (int)arg.size());
		SetTextColor(hdc,textColor);
	}

	SetTextAlign(hdc, prevAlign);
}
开发者ID:ANR2ME,项目名称:ppsspp,代码行数:41,代码来源:CtrlDisAsmView.cpp

示例15: AddTextToPage

void AddTextToPage ( LPSTR pText, int x, int y, int centered )
{
	// Dimension of print area
    int cWidthPels = GetDeviceCaps(pd.hDC, HORZRES); 
    int cHeightPels = GetDeviceCaps(pd.hDC, VERTRES); 

	// Adjustment for center
	switch ( centered )
	{
		case 0 : SetTextAlign ( pd.hDC, TA_LEFT );		break;
		case 1 : SetTextAlign ( pd.hDC, TA_CENTER );	break;
		case 2 : SetTextAlign ( pd.hDC, TA_RIGHT );		break;
	}

	// Print to scaled location
	double dx = (x/100.0)*cWidthPels;
	double dy = (y/100.0)*cHeightPels;

	// put text to device context
	TextOut (pd.hDC, (int)dx, (int)dy, (LPCTSTR) pText, strlen(pText)); 
}
开发者ID:Fliper12,项目名称:darkbasicpro,代码行数:21,代码来源:GUIDialogs.cpp


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