//聲明:
CreateHatchBrush(
p1: Integer; {陰影樣式}
p2: COLORREF {顏色值}
): HBRUSH; {返回畫刷句柄}
//p1 參數可選值:
HS_HORIZONTAL = 0;
HS_VERTICAL = 1;
HS_FDIAGONAL = 2;
HS_BDIAGONAL = 3;
HS_CROSS = 4;
HS_DIAGCROSS = 5;
//舉例:
procedure TForm1.FormPaint(Sender: TObject);
var
BrushStyle: Integer;
BrushHandle: HBRUSH;
begin
BrushStyle := RadioGroup1.ItemIndex;
BrushHandle := CreateHatchBrush(BrushStyle, clRed);
FillRect(Canvas.Handle, Rect(16,16,100,120), BrushHandle);
DeleteObject(BrushHandle);
end;
procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
Refresh;
end;
//效果圖: