Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cz_012273
MyDelphi
提交
2b1f9422
MyDelphi
项目概览
cz_012273
/
MyDelphi
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MyDelphi
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2b1f9422
编写于
7月 24, 2023
作者:
C
cz_012273
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
显示行列号加条件:Memo.height=373;动态添加按钮:光标到首行、末行。
上级
8b6b1632
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
61 addition
and
16 deletion
+61
-16
MyDelphi.dproj
MyDelphi.dproj
+5
-5
Unit1.pas
Unit1.pas
+56
-11
未找到文件。
MyDelphi.dproj
浏览文件 @
2b1f9422
...
...
@@ -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>
...
...
Unit1.pas
浏览文件 @
2b1f9422
...
...
@@ -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
:=
3
8
3
;
Memo1
.
height
:=
3
7
3
;
Memo1
.
selstart
:=
i
;
//创建显示行号、列号标签
//创建显示行、列号标签
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
:=
2
78
;
position
.
y
:=
410
;
Text
:=
'列号:'
+
IntToStr
(
Memo1
.
CaretPosition
.
Pos
);
// 显示列号
position
.
x
:=
2
30
;
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
;
Label_A
.
Text
:=
'行号:'
+
IntToStr
(
Memo1
.
CaretPosition
.
line
);
Label_B
.
Text
:=
'列号:'
+
IntToStr
(
Memo1
.
CaretPosition
.
Pos
);
end
;
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录