就是比如有个本文的内容是
11222333444
55666777888
99111100000我想用鼠标部分(分块)选取其中的
333444
777888
100000如何实现??????
分不多 希望高手能解答
11222333444
55666777888
99111100000我想用鼠标部分(分块)选取其中的
333444
777888
100000如何实现??????
分不多 希望高手能解答
解决方案 »
- TIdSMTP发送邮件是否可以将发件人地址(显示的地址)换成其他地址?
- 窗体BorderStyle设置为bsNone后,以前在任务栏上隐藏应用程序的方法失效了!求解决方案。
- 怎样将窗体中某区域坐标范围改成毫米?
- 怎样得到系统输入法?
- 有没有想比较好的Edit控件,当没有焦点时背景是灰色。获的焦点后就反白。
- 窗体继承问题:
- [求助] 原来在C/s结构中设置的class(TObject),在Active Library 中应如何设置?
- 请教各位高手?
- 请教一个关于时间显示的问题
- 近日看到一个Delphi5的中文版,要安装原Delphi后才可安装,不知这样的汉化版会否影响原Delphi的运行?
- 车丢了,散分
- 小问题:什么叫“复用的”复用的软件开发过程?
而不是借助其他软件来选取文本!
//按住Alt点鼠标可看见效果,Ctrl+C可复制,其他功能自己加上~~
//没有处理滚动时的情况~~unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Memo1: TMemo;
Label1: TLabel;
procedure Memo1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormCreate(Sender: TObject);
procedure Memo1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
FSelBegin: TPoint;
FSelEnd: TPoint;
FCaretBegin: TPoint;
FCaretEnd: TPoint;
FChatHeight: Integer;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}uses Math, ClipBrd;procedure TForm1.Memo1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
I: Integer;
S: string;
L: Integer;
T: Integer;
begin
if not (ssAlt in Shift) then
begin
Label1.Visible := False;
FSelBegin := Point(-1, -1);
FSelEnd := Point(-1, -1);
Exit;
end;
if FSelBegin.X >= 0 then
begin
GetCaretPos(FCaretEnd);
Label1.Left := Min(FCaretBegin.X, FCaretEnd.X);
Label1.Top := Min(FCaretBegin.Y, FCaretEnd.Y);
FSelEnd := TMemo(Sender).CaretPos;
S := '';
L := Abs(FSelEnd.X - FSelBegin.X);
T := Min(FSelBegin.X, FSelEnd.X);
for I := Min(FSelBegin.Y, FSelEnd.Y) to Max(FSelBegin.Y, FSelEnd.Y) do
S := S + Copy(TMemo(Sender).Lines[I], T + 1, L) + #13#10;
Label1.Caption := TrimRight(S);
Label1.Color := clHighlight;
Label1.AutoSize := True;
end;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
FSelBegin := Point(-1, -1);
FSelEnd := Point(-1, -1); Font.Name := '宋体';
Font.Size := 9;
Label1.ShowAccelChar := False;
Label1.Font.Color := clWhite;
Label1.Visible := False;
Label1.Parent := Memo1;
FChatHeight := Canvas.TextHeight('|');
end;procedure TForm1.Memo1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if [ssAlt, ssCtrl] * Shift = [] then Label1.Visible := False;
if Label1.Visible and Label1.AutoSize and
([ssCtrl] = Shift) and (Key = Ord('C')) then
begin
Clipboard.AsText := Label1.Caption;
Label1.Visible := False;
Key := 0;
end;
if (FSelBegin.X < 0) and ([ssAlt] = Shift) then
begin
FSelBegin := TMemo(Sender).CaretPos;
Label1.Color := clRed;
Label1.Caption := '';
Label1.AutoSize := False;
Label1.Width := 1;
Label1.Height := FChatHeight;
GetCaretPos(FCaretBegin);
Label1.Left := FCaretBegin.X;
Label1.Top := FCaretBegin.Y;
Label1.Visible := True;
end;
end;end.
我现在有点事做 稍候再看 消化下就给分...
不过希望还有更好的方法
zswang(伴水清清)(专家门诊清洁工)
的方法能实现主要功能,,不过效果不好。。又或者我水平不够修改不好!
唉。