📄 u_mian.~pas
字号:
unit U_mian;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
ByteFile=File of byte;
ByteArray=array[0..31] of byte;
TIntByteArray=array[0..1] of byte;
TForm1 = class(TForm)
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
Shape4: TShape;
Shape5: TShape;
Shape6: TShape;
Shape7: TShape;
Shape8: TShape;
Shape9: TShape;
Shape10: TShape;
Shape11: TShape;
Shape12: TShape;
Shape13: TShape;
Shape14: TShape;
Shape15: TShape;
Shape16: TShape;
Shape17: TShape;
Shape18: TShape;
Shape19: TShape;
Shape20: TShape;
Shape21: TShape;
Shape22: TShape;
Shape23: TShape;
Shape24: TShape;
Shape25: TShape;
Shape26: TShape;
Shape27: TShape;
Shape28: TShape;
Shape29: TShape;
Shape30: TShape;
Shape31: TShape;
Shape32: TShape;
Shape33: TShape;
Shape34: TShape;
Shape35: TShape;
Shape36: TShape;
Shape37: TShape;
Shape38: TShape;
Shape39: TShape;
Shape40: TShape;
Shape41: TShape;
Shape42: TShape;
Shape43: TShape;
Shape44: TShape;
Shape45: TShape;
Shape46: TShape;
Shape47: TShape;
Shape48: TShape;
Shape49: TShape;
Shape50: TShape;
Shape51: TShape;
Shape52: TShape;
Shape53: TShape;
Shape54: TShape;
Shape55: TShape;
Shape56: TShape;
Shape57: TShape;
Shape58: TShape;
Shape59: TShape;
Shape60: TShape;
Shape61: TShape;
Shape62: TShape;
Shape63: TShape;
Shape64: TShape;
Shape65: TShape;
Shape66: TShape;
Shape67: TShape;
Shape68: TShape;
Shape69: TShape;
Shape70: TShape;
Shape71: TShape;
Shape72: TShape;
Shape73: TShape;
Shape74: TShape;
Shape75: TShape;
Shape76: TShape;
Shape77: TShape;
Shape78: TShape;
Shape79: TShape;
Shape80: TShape;
Shape81: TShape;
Shape82: TShape;
Shape83: TShape;
Shape84: TShape;
Shape85: TShape;
Shape86: TShape;
Shape87: TShape;
Shape88: TShape;
Shape89: TShape;
Shape90: TShape;
Shape91: TShape;
Shape92: TShape;
Shape93: TShape;
Shape94: TShape;
Shape95: TShape;
Shape96: TShape;
Shape97: TShape;
Shape98: TShape;
Shape99: TShape;
Shape100: TShape;
Shape101: TShape;
Shape102: TShape;
Shape103: TShape;
Shape104: TShape;
Shape105: TShape;
Shape106: TShape;
Shape107: TShape;
Shape108: TShape;
Shape109: TShape;
Shape110: TShape;
Shape111: TShape;
Shape112: TShape;
Shape113: TShape;
Shape114: TShape;
Shape115: TShape;
Shape116: TShape;
Shape117: TShape;
Shape118: TShape;
Shape119: TShape;
Shape120: TShape;
Shape121: TShape;
Shape122: TShape;
Shape123: TShape;
Shape124: TShape;
Shape125: TShape;
Shape126: TShape;
Shape127: TShape;
Shape128: TShape;
Shape129: TShape;
Shape130: TShape;
Shape131: TShape;
Shape132: TShape;
Shape133: TShape;
Shape134: TShape;
Shape135: TShape;
Shape136: TShape;
Shape137: TShape;
Shape138: TShape;
Shape139: TShape;
Shape140: TShape;
Shape141: TShape;
Shape142: TShape;
Shape143: TShape;
Shape144: TShape;
Shape145: TShape;
Shape146: TShape;
Shape147: TShape;
Shape148: TShape;
Shape149: TShape;
Shape150: TShape;
Shape151: TShape;
Shape152: TShape;
Shape153: TShape;
Shape154: TShape;
Shape155: TShape;
Shape156: TShape;
Shape157: TShape;
Shape158: TShape;
Shape159: TShape;
Shape160: TShape;
Shape161: TShape;
Shape162: TShape;
Shape163: TShape;
Shape164: TShape;
Shape165: TShape;
Shape166: TShape;
Shape167: TShape;
Shape168: TShape;
Shape169: TShape;
Shape170: TShape;
Shape171: TShape;
Shape172: TShape;
Shape173: TShape;
Shape174: TShape;
Shape175: TShape;
Shape176: TShape;
Shape177: TShape;
Shape178: TShape;
Shape179: TShape;
Shape180: TShape;
Shape181: TShape;
Shape182: TShape;
Shape183: TShape;
Shape184: TShape;
Shape185: TShape;
Shape186: TShape;
Shape187: TShape;
Shape188: TShape;
Shape189: TShape;
Shape190: TShape;
Shape191: TShape;
Shape192: TShape;
Shape193: TShape;
Shape194: TShape;
Shape195: TShape;
Shape196: TShape;
Shape197: TShape;
Shape198: TShape;
Shape199: TShape;
Shape200: TShape;
Shape201: TShape;
Shape202: TShape;
Shape203: TShape;
Shape204: TShape;
Shape205: TShape;
Shape206: TShape;
Shape207: TShape;
Shape208: TShape;
Shape209: TShape;
Shape210: TShape;
Shape211: TShape;
Shape212: TShape;
Shape213: TShape;
Shape214: TShape;
Shape215: TShape;
Shape216: TShape;
Shape217: TShape;
Shape218: TShape;
Shape219: TShape;
Shape220: TShape;
Shape221: TShape;
Shape222: TShape;
Shape223: TShape;
Shape224: TShape;
Shape225: TShape;
Shape226: TShape;
Shape227: TShape;
Shape228: TShape;
Shape229: TShape;
Shape230: TShape;
Shape231: TShape;
Shape232: TShape;
Shape233: TShape;
Shape234: TShape;
Shape235: TShape;
Shape236: TShape;
Shape237: TShape;
Shape238: TShape;
Shape239: TShape;
Shape240: TShape;
Shape241: TShape;
Shape242: TShape;
Shape243: TShape;
Shape244: TShape;
Shape245: TShape;
Shape246: TShape;
Shape247: TShape;
Shape248: TShape;
Shape249: TShape;
Shape250: TShape;
Shape251: TShape;
Shape252: TShape;
Shape253: TShape;
Shape254: TShape;
Shape255: TShape;
Shape256: TShape;
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure hzconver(hz:ByteArray);
procedure DrawMap();
public
{ Public declarations }
end;
var
Form1: TForm1;
dispboard:array[0..15,0..15] of integer;
implementation
{$R *.dfm}
function HZtobytearray(PaInt:integer):TIntByteArray;
var
Tempint:integer;
TempIntByteArray:TIntByteArray absolute Tempint;
tempbyte:byte;
i:integer;
begin
Tempint:= PaInt;
tempbyte:= TempIntByteArray[0];
TempIntByteArray[0]:=TempIntByteArray[1];
TempIntByteArray[1]:=tempbyte;
Result := TempIntByteArray;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
bytefile1:ByteFile;
bytearray1:ByteArray;
bytearray2:TIntByteArray;
tempint:Integer;
int1,int2:integer;
begin
// int1:=integer(middle(Edit1.Text,));
// bytearray2:=HZtobytearray(int1);
int1:=$19;
int2:=$5a;
bytearray2:=HZtobytearray(int1*256+int2);
AssignFile(bytefile1,'hzk16.hzk');
Reset(bytefile1);
seek(bytefile1,(bytearray2[0]*94+bytearray2[1])*32);
for tempint:= 0 to 31 do
begin
read(bytefile1,bytearray1[tempint])
end;
CloseFile(bytefile1);
{
国的字库
bytearray1[0]:=$00;
bytearray1[1]:=$00;
bytearray1[2]:=$7F;
bytearray1[3]:=$FC;
bytearray1[4]:=$40;
bytearray1[5]:=$04;
bytearray1[6]:=$5F;
bytearray1[7]:=$F4;
bytearray1[8]:=$41;
bytearray1[9]:=$04;
bytearray1[10]:=$41;
bytearray1[11]:=$04;
bytearray1[12]:=$41;
bytearray1[13]:=$04;
bytearray1[14]:=$4F;
bytearray1[15]:=$E4;
bytearray1[16]:=$41;
bytearray1[17]:=$44;
bytearray1[18]:=$41;
bytearray1[19]:=$24;
bytearray1[20]:=$41;
bytearray1[21]:=$24;
bytearray1[22]:=$5F;
bytearray1[23]:=$F4;
bytearray1[24]:=$40;
bytearray1[25]:=$04;
bytearray1[26]:=$40;
bytearray1[27]:=$04;
bytearray1[28]:=$7F;
bytearray1[29]:=$FC;
bytearray1[30]:=$40;
bytearray1[31]:=$04;
}
hzconver(bytearray1);
DrawMap();
end;
//将字库中的点阵数据转换成棋盘上点的点阵数据//
procedure TForm1.hzconver(hz:ByteArray);
var
i,j,k:integer;
ch,andflag:integer;
hzz:array[0..15,0..1] of integer;
begin
k:=0;
for i:=0 to 15 do
begin
for j:=0 to 1 do
begin
hzz[i][j]:=hz[k];
k:=k+1;
end;
end;
for i:=0 to 15 do
begin
andflag:=$80;
for j:=0 to 7 do
begin
ch:=hzz[i,0];
ch:=ch and andflag;
if(ch<>0) then
dispboard[i][j]:=1;
andflag:=andflag shr 1;
end;
andflag:=$80;
for j:=8 to 15 do
begin
ch:=hzz[i][1];
ch:=ch and andflag;
if(ch<>0) then
dispboard[i][j]:=1;
andflag:=andflag shr 1;
end;
end;
end;
procedure TForm1.DrawMap();
var
i,j:integer;
str1:string;
begin
for i:=0 to 15 do
for j:=0 to 15 do
begin
if dispboard[i,j]=1 then
begin
str1:='shape' + IntToStr(i*16+j+1);
TShape(FindComponent(str1)).brush.color:=clRed;
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -