⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 u0011.pas

📁 Delphi编程五大妙招源程序
💻 PAS
字号:
unit U0011;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Memo1: TMemo;
    Button6: TButton;
    Label3: TLabel;
    Label4: TLabel;
    procedure ButtonClick(Sender: TObject);
    procedure Button6Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

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;

//得到行号和列号
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 ;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -