提交 2b1f9422 编写于 作者: C cz_012273

显示行列号加条件:Memo.height=373;动态添加按钮:光标到首行、末行。

上级 8b6b1632
......@@ -346,23 +346,23 @@
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\bin\Artwork\Android\FM_NotificationIcon_24x24.png" Configuration="Debug" Class="Android_NotificationIcon24">
<DeployFile LocalName="Android64\Debug\colors.xml" Configuration="Debug" Class="Android_Colors">
<Platform Name="Android64">
<RemoteName>ic_notification.png</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="Android64\Debug\AndroidManifest.xml" Configuration="Debug" Class="ProjectAndroidManifest">
<DeployFile LocalName="Android64\Debug\styles.xml" Configuration="Debug" Class="AndroidSplashStyles">
<Platform Name="Android64">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="Android64\Debug\colors.xml" Configuration="Debug" Class="Android_Colors">
<DeployFile LocalName="$(BDS)\bin\Artwork\Android\FM_NotificationIcon_24x24.png" Configuration="Debug" Class="Android_NotificationIcon24">
<Platform Name="Android64">
<RemoteName>ic_notification.png</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="Android64\Debug\styles.xml" Configuration="Debug" Class="AndroidSplashStyles">
<DeployFile LocalName="Android64\Debug\AndroidManifest.xml" Configuration="Debug" Class="ProjectAndroidManifest">
<Platform Name="Android64">
<Overwrite>true</Overwrite>
</Platform>
......
......@@ -48,7 +48,8 @@ type
public
{ Public declarations }
procedure Button_A_Click(Sender: TObject);
procedure Button_B_Click(Sender: TObject);
end;
var
......@@ -56,6 +57,7 @@ var
FFileName: string;
FWantExit: Boolean;
Label_A,Label_B:Tlabel;
Button_A,Button_B:Tbutton;
function GetTextType(const FileName: string): String;
implementation
......@@ -252,6 +254,8 @@ begin
begin
Label_A.free;
Label_B.free;
Button_A.free;
Button_B.free;
Memo1.height := 470; // 将meno控件恢复到默认高度
Memo1.Lines.clear;
end;
......@@ -269,6 +273,15 @@ begin
end;
procedure TForm1.Button_A_Click(Sender: TObject); //光标回首行
begin
Form1.Memo1.selstart := 0;
end;
procedure TForm1.Button_B_Click(Sender: TObject); //光标到末行
begin
Form1.Memo1.selstart := Form1.Memo1.text.length;
end;
procedure TForm1.Memo1MouseLeave(Sender: TObject); // 改变memo1高度以适应虚拟键盘
var
......@@ -280,17 +293,17 @@ begin
if (i>0) and (Memo1.height > 430) then
begin
Memo1.height := 383;
Memo1.height := 373;
Memo1.selstart := i;
//创建显示行号、列号标签
Label_A := tlabel.Create(Self);
//创建显示行、列号标签
Label_A := tlabel.Create(Self);
with Label_A do
begin
Parent := Self;
position.x := 6;
position.y := 410;
Text := '行号:'+IntToStr(Memo1.CaretPosition.line); // 显示行号
position.y := 399;
//Text := '行号:'+IntToStr(Memo1.CaretPosition.line); // 显示行号
Width := 165;
Height := 20;
Visible := true;
......@@ -300,24 +313,56 @@ begin
with Label_B do
begin
Parent := Self;
position.x := 278;
position.y := 410;
Text := '列号:'+IntToStr(Memo1.CaretPosition.Pos); // 显示列号
position.x := 230;
position.y := 399;
//Text := '列号:'+IntToStr(Memo1.CaretPosition.Pos); // 显示列号
Width := 165;
Height := 20;
Visible := true;
end;
//创建滚动条加速按钮
Button_A := tButton.Create(Self);
with Button_A do
begin
Parent := Self;
position.x := 136;
position.y := 399;
Text := '|←';
Width := 32;
Height := 20;
Visible := true;
onclick := Button_A_Click; //设置点击事件
end;
Button_B := tButton.Create(Self);
with Button_B do
begin
Parent := Self;
position.x := 192;
position.y := 399;
Text := '→|';
Width := 32;
Height := 20;
Visible := true;
onclick := Button_B_Click; //设置点击事件
end;
end;
Label_A.Text := '行号:'+IntToStr(Memo1.CaretPosition.line);
Label_B.Text := '列号:'+IntToStr(Memo1.CaretPosition.Pos);
if Memo1.height = 373 then //动态更新行列号
begin
Label_A.Text := '当前行号:'+IntToStr(Memo1.CaretPosition.line+1);
Label_B.Text := '当前列号:'+IntToStr(Memo1.CaretPosition.Pos+1);
end;
if (Memo1.selstart = selstart) and (Memo1.sellength = sellength) then
Memo1.enabledscroll := false; // 选择区域未发生变化,禁止滚动
end;
procedure TForm1.Memo1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Single); // 控制memo1选择文本时不滚动
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册