Board logo

Subject: 抄CnPack的,ASCII速查 [Print This Page]

Author: flamingo    Time: 2005-11-9 05:06     Subject: 抄CnPack的,ASCII速查

由于我自己的原因,无法使用完整的CnPack,只好抄抄原代码,把ASCII速查表改成了EXE,作为独立的工具来用。有象我这样情况的,不妨用用。

Attachment: CnAscII.rar (2005-11-9 05:06, 201.27 K) / Download count 445
http://bbs.cnpack.org/attachment.php?aid=154
Author: Passion    Time: 2005-11-10 15:42

移植得不错。尤其是将不可打印字符所在的格子的背景色改成淡黄,实在是一个体贴用户的地方。
我们也考虑这样改改。^_^
Author: flamingo    Time: 2005-11-17 23:27

哦,这段代码按原作改编如下:

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;




Welcome to CnPack Forum (http://bbs.cnpack.org/) Powered by Discuz! 5.0.0