文字列の表示


LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
 PAINTSTRUCT ps;
 HDC hdc;
 wchar_t wstr[256];
 int x=10, y=10;

 switch ( message )
 {
 case WM_PAINT:
  hdc = BeginPaint(hWnd, &ps);
  // TODO: 描画コードをここに追加してください...
  SetTextColor( hdc, RGB( 128, 128, 128 ) ); // 文字色の色
  SetBkMode( hdc, TRANSPARENT ); // 文字の背景を透明にする
  wsprintf( wstr, L"x=%d y=%d", x, y ); // 数値の文字列化
  TextOut( hdc, 10, 10, wstr, ( int )wcslen( wstr ) ); // 文字列を表示
  EndPaint( hWnd, &ps );
  break;
 }
 return 0;
}

Windows > グラフィック | comments (0) | trackbacks (0)

Comments

Comment Form

icons:

Trackbacks