tailieunhanh - programming windows phần 7

Tuy nhiên, người dùng máy tính đã nghĩ đến đậm và nghiêng là đặc biệt "thuộc tính" được áp dụng cho phông chữ hiện có. Windows chính nó đã tiếp cận thuộc tính đầu vào khi xác định các phông chữ raster được đặt tên, được liệt kê, | This document is created with the unregistered version of CHM2PDF Pilot Simpo PDF Merge and Split Unregistered Version - http --------------------------------------- -- Palette Animation Demo c Charles Petzold 1998 --------------------------------------- include define ID_TIMER 1 TCHAR szAppName TEXT Fader TCHAR szTitle TEXT Fader Palette Animation Demo static LOGPALETTE lp HPALETTE CreateRoutine HWND hwnd HPALETTE hPalette 0x0300 1 0 .peRed 255 0 .peGreen 255 0 .peBlue 255 0 .peFlags PC_RESERVED hPalette CreatePalette lp SetTimer hwnd ID_TIMER 50 NULL return hPalette void PaintRoutine HDC hdc int cxClient int cyClient static TCHAR szText TEXT Fade In and Out int x y SIZE sizeText SetTextColor hdc PALETTEINDEX 0 GetTextExtentPoint32 hdc szText lstrlen szText sizeText for x 0 x cxClient x for y 0 y cyClient y TextOut hdc x y szText lstrlen szText return This document is created with the unregistered version of CHM2PDF Pilot Simpo PDF Merge and Split Unregistered Version - http void TimerRoutine HDC hdc HPALETTE hPalette static BOOL bFadeIn TRUE if bFadeIn 0 .peRed - 4 0 .peGreen - 4 if 0 .peRed 3 bFadeIn FALSE else 0 .peRed 4 0 .peGreen 4 if 0 .peRed 255 bFadeIn TRUE AnimatePalette hPalette 0 1 return void DestroyRoutine HWND hwnd HPALETTE hPalette KillTimer hwnd ID_TIMER DeleteObject hPalette return This document is created with the unregistered version of CHM2PDF Pilot FA Sim poPDFtMergeand Split Unreg isteredVersiorii-http p ayed in white and appears invisible against the white background of the window. By using palette animation FADER gradually changes the color of the text to blue and then back to white over and over again. The text appears as if it s fading in and out.