哦,这段代码按原作改编如下:
const
SCnNonVisualCode:array[1..4,1..8] of string=
(('NUL','SOH','STX','EXT','EQT','ENQ','ACK','BEL'),
('BS','TAB','LF','VT','FF','CR','SO','SI'),
('DLE','DC1','DC2','DC3','DC4','NAK','SYN','ETB'),
('CAN','EM','SUB','ESC','FS','GS','RS','US'));
procedure TAscIIForm.GridDrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
OutStr:String;
act:integer;
begin
with Sender as TStringGrid do
begin
OutStr := Cells[ACol, ARow];
act:=integer((ARow>0)and(ACol>0)and(ARow<=4));
if (gdSelected in State)then // OLD-X->and not (gdFixed in State) then
Canvas.Brush.Color := $91B8FF //OLD-X->$00D2BDB6
else
if (FPage<act)then Canvas.Brush.Color:=clCream;
if FPage<act then OutStr:=SCnNonVisualCode[ARow][ACol];
Canvas.FillRect(Rect);
SetBkMode(Canvas.Handle,TRANSPARENT);
Canvas.TextOut(Rect.Left + ((Rect.Right - Rect.Left -
Canvas.TextWidth(OutStr)) shr 1), Rect.Top + ((Rect.Bottom - Rect.top
- Canvas.TextHeight(OutStr)) shr 1), OutStr);
end;
end;
|