一个很简单的问题(100分)

  • 主题发起人 主题发起人 tanggangsheng
  • 开始时间 开始时间
T

tanggangsheng

Unregistered / Unconfirmed
GUEST, unregistred user!
windows的API函数fillrect,在delphi中的使用,要例子!<br>不然不给分.<br>谢谢!
 
例子!FillRect(hdc(Form1),Rect(10,10,20,20),HBRUSH(COLOR_ENDCOLORS+1));
 
procedure TChannelSelectForm.StringGrid_ChannelSetDrawCell(Sender: TObject; ACol,<br> &nbsp;ARow: Integer; Rect: TRect; State: TGridDrawState);<br>var<br> &nbsp;TmpGrid: TStringGrid;<br> &nbsp;TmpStr: string;<br> &nbsp;TmpChannelID: Integer;<br> &nbsp;TmpRect: TRect;<br>begin<br> &nbsp;TmpGrid := Sender as TStringGrid;<br> &nbsp;TmpChannelID := ARow + ACol * iCellCountPerCol; //通道号 0 - 255<br> &nbsp;TmpStr := Format('%.3d', [TmpChannelID + 1]); //显示字<br> &nbsp;if TmpChannelID in FChannelSet &nbsp;then<br> &nbsp; &nbsp;tmpGrid.Canvas.Brush.Color := clSkyBlue; //如果选中显示绿色<br> &nbsp;TmpRect.Left := Rect.Left + 1;<br> &nbsp;TmpRect.Right := Rect.Right - 1;<br> &nbsp;TmpRect.Top := Rect.Top + 1;<br> &nbsp;TmpRect.Bottom := Rect.Bottom - 1;<br> &nbsp;tmpGrid.Canvas.FillRect(TmpRect); &lt;&lt;----------<br><br> &nbsp;DrawText(tmpGrid.Canvas.Handle,<br> &nbsp; &nbsp;pChar(TmpStr),<br> &nbsp; &nbsp;Length(TmpStr),<br> &nbsp; &nbsp;Rect, // 包含文字的矩形<br> &nbsp; &nbsp;DT_CENTER or // 水平居中<br> &nbsp; &nbsp;DT_SINGLELINE or // 不折行<br> &nbsp; &nbsp;DT_VCENTER); // 垂直居中 &nbsp; &nbsp; &nbsp;<br>end;
 
to Johnny_du<br>你的看不到效果啊!
 
后退
顶部