程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> Delphi >> WinAPI: CreateBrushIndirect - 根據畫刷結構建立畫刷

WinAPI: CreateBrushIndirect - 根據畫刷結構建立畫刷

編輯:Delphi

//聲明: 
CreateBrushIndirect( 
 const p1: TLogBrush {畫刷結構} 
): HBRUSH;      {返回畫刷句柄} 
 
//TLogBrush 是 tagLOGBRUSH 結構的重定義: 
tagLOGBRUSH = packed record 
 lbStyle: UINT;   {畫刷風格} 
 lbColor: COLORREF; {顏色} 
 lbHatch: Longint; {陰影樣式} 
end; 
 
//lbStyle 可選值: 
BS_SOLID     = 0; 
BS_NULL     = 1; 
BS_HOLLOW    = BS_NULL; 
BS_HATCHED    = 2; 
BS_PATTERN    = 3; 
BS_INDEXED    = 4; 
BS_DIBPATTERN  = 5; 
BS_DIBPATTERNPT = 6; 
BS_PATTERN8X8  = 7; 
BS_DIBPATTERN8X8 = 8; 
BS_MONOPATTERN  = 9; 
 
//lbHatch 可選值: 
HS_HORIZONTAL = 0; 
HS_VERTICAL  = 1; 
HS_FDIAGONAL = 2; 
HS_BDIAGONAL = 3; 
HS_CROSS   = 4; 
HS_DIAGCROSS = 5; 
 
 
//舉例: 
procedure TForm1.FormPaint(Sender: TObject); 
var 
 b: TLogBrush; 
 BrushHandle: HBRUSH; 
begin 
 b.lbStyle := BS_HATCHED; 
 b.lbColor := clRed; 
 b.lbHatch := HS_CROSS; 
 
 BrushHandle := CreateBrushIndirect(b); 
 Canvas.Brush.Handle := BrushHandle; 
 FillRect(Canvas.Handle, ClIEntRect, BrushHandle); 
 
 DeleteObject(BrushHandle); 
end; 
 
 
//效果圖: 

WinAPI: CreateBrushIndirect - 根據畫刷結構建立畫刷

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved