📄 00101.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>1</title>
</head>
<body bgcolor="#000000" text="#FFFFFF" link="#FFFFFF">
<p align="left"><span style="BACKGROUND-COLOR: #ff0000"><a href="00101.zip">源程序下载</a></span><b><span style="background-color: #000080"><br>
</span><span style="background-color: #000000">
<br>
<a name="1"></a></span><span style="background-color: #000080">1:Label的分行显示</span></b>
<br>
只用再要显示的内容中间加上#13就可以自动换行,下面的Label2.Caption显示的就是换行的内容。<br>
procedure TForm1.ButtonClick(Sender: TObject);<br>
Var<br>
tempButtonTag : Integer ;<br>
begin<br>
TempButtonTag := (Sender as TButton).Tag ;<br>
Label1.Caption := 'You must click Button'+IntToStr(TempButtonTag-100) ;<br>
Label2.Caption := 'You must'+#13+'click Button'+IntToStr(TempButtonTag-100) ;<br>
end;<span style="background-color: #000080"><br>
</span>
<span style="background-color: #000000"><br>
</span>
<span style="background-color: #000080">
<a name="2"> </a>2:Tag属性的妙用</span>
<br>
下面的这段程序就使根据Tag的不同值,来Label显示不同的内容,注意Button1一直到Button5都是采用下面一个事件,TempButtonTag := (Sender as TButton).Tag 不但只能用于Tag属性,还可以用到其他方面,慢慢的品吧。<br>
<br>
procedure TForm1.ButtonClick(Sender: TObject);<br>
Var<br>
tempButtonTag : Integer ;<br>
begin<br>
TempButtonTag := (Sender as TButton).Tag ;<br>
Label1.Caption := 'You must click Button'+IntToStr(TempButtonTag-100) ;<br>
Label2.Caption := 'You must'+#13+'click Button'+IntToStr(TempButtonTag-100) ;<br>
end;<b><span style="background-color: #000080"><br>
</span>
<span style="background-color: #000000">
<br>
</span>
<span style="background-color: #000080">
<a name="3"></a>3:得到Memo的行号和列号</span>
</b>
<br>
通过调用 WINDOWS API中的EM_LINEFROMCHAR和EM_LINEINDEX,来确定MEMO控件中的当前行和列。 <br>
//得到行号和列号<br>
procedure TForm1.Button6Click(Sender: TObject);<br>
var<br>
Hang,Lie,Num,CharsLine:longint;<br>
begin<br>
Num:=SendMessage(Memo1.Handle,EM_LINEFROMCHAR,Memo1.SelStart,0);<br>
CharsLine:=SendMessage(Memo1.Handle,EM_LINEINDEX,Num,0);<br>
Hang:=Num+1;//当前行<br>
Label3.Caption :='行数= '+IntToStr(Hang) ;<br>
Lie:=(Memo1.SelStart-CharsLine)+1;//当前列<br>
Label4.Caption :='列数= '+IntToStr(Lie) ;<br>
end ;<br>
<br>
<span style="background-color: #FF0000"><a href="00101.zip">源程序下载</a></span>
</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -