fontrot.c
来自「《Windows程序设计》配套代码、LZW压缩算法源代码、Socket异步通信示」· C语言 代码 · 共 37 行
C
37 行
/*----------------------------------------
FONTROT.C -- Rotated Fonts
(c) Charles Petzold, 1998
----------------------------------------*/
#include <windows.h>
#include "..\\eztest\\ezfont.h"
TCHAR szAppName [] = TEXT ("FontRot") ;
TCHAR szTitle [] = TEXT ("FontRot: Rotated Fonts") ;
void PaintRoutine (HWND hwnd, HDC hdc, int cxArea, int cyArea)
{
static TCHAR szString [] = TEXT (" Rotation") ;
HFONT hFont ;
int i ;
LOGFONT lf ;
hFont = EzCreateFont (hdc, TEXT ("Times New Roman"), 540, 0, 0, TRUE) ;
GetObject (hFont, sizeof (LOGFONT), &lf) ;
DeleteObject (hFont) ;
SetBkMode (hdc, TRANSPARENT) ;
SetTextAlign (hdc, TA_BASELINE) ;
SetViewportOrgEx (hdc, cxArea / 2, cyArea / 2, NULL) ;
for (i = 0 ; i < 12 ; i ++)
{
lf.lfEscapement = lf.lfOrientation = i * 300 ;
SelectObject (hdc, CreateFontIndirect (&lf)) ;
TextOut (hdc, 0, 0, szString, lstrlen (szString)) ;
DeleteObject (SelectObject (hdc, GetStockObject (SYSTEM_FONT))) ;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?