📄 00101.txt
字号:
1:Label的分行显示
只用再要显示的内容中间加上#13就可以自动换行,下面的Label2.Caption显示的就是换行的内容。
procedure TForm1.ButtonClick(Sender: TObject);
Var
tempButtonTag : Integer ;
begin
TempButtonTag := (Sender as TButton).Tag ;
Label1.Caption := 'You must click Button'+IntToStr(TempButtonTag-100) ;
Label2.Caption := 'You must'+#13+'click Button'+IntToStr(TempButtonTag-100) ;
end;
2:Tag属性的妙用
下面的这段程序就使根据Tag的不同值,来Label显示不同的内容,注意Button1一直到Button5都是采用下面一个事件,TempButtonTag := (Sender as TButton).Tag 不但只能用于Tag属性,还可以用到其他方面,慢慢的品吧。
procedure TForm1.ButtonClick(Sender: TObject);
Var
tempButtonTag : Integer ;
begin
TempButtonTag := (Sender as TButton).Tag ;
Label1.Caption := 'You must click Button'+IntToStr(TempButtonTag-100) ;
Label2.Caption := 'You must'+#13+'click Button'+IntToStr(TempButtonTag-100) ;
end;
3:得到Memo的行号和列号
通过调用 WINDOWS API中的EM_LINEFROMCHAR和EM_LINEINDEX,来确定MEMO控件中的当前行和列。
//得到行号和列号
procedure TForm1.Button6Click(Sender: TObject);
var
Hang,Lie,Num,CharsLine:longint;
begin
Num:=SendMessage(Memo1.Handle,EM_LINEFROMCHAR,Memo1.SelStart,0);
CharsLine:=SendMessage(Memo1.Handle,EM_LINEINDEX,Num,0);
Hang:=Num+1;//当前行
Label3.Caption :='行数= '+IntToStr(Hang) ;
Lie:=(Memo1.SelStart-CharsLine)+1;//当前列
Label4.Caption :='列数= '+IntToStr(Lie) ;
end ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -