现在我需要有这样一个功能。
假设memo中有一段文字abcdefg,还有一个listbox里面有若干内容,现在我需要的功能是,首先鼠标在memo中点击需要添加内容的地方,假设点在c后面,然后我再双击listbox中的一项,假设为1111,这个时候1111的内容添加到memo中,memo的内容变为abc1111defg.这个怎么实现???
假设memo中有一段文字abcdefg,还有一个listbox里面有若干内容,现在我需要的功能是,首先鼠标在memo中点击需要添加内容的地方,假设点在c后面,然后我再双击listbox中的一项,假设为1111,这个时候1111的内容添加到memo中,memo的内容变为abc1111defg.这个怎么实现???
解决方案 »
- 转换数据库引发的问题,
- 请问 我用delphi7 用rave5制作报表,我想在打印预览时 设置页码; 如有两页 第一页显示为:第1页,共2页;第二页显示为:第2页,共2页 这种形式 ?请指点!
- 各位大虾,如何用程序将*.txt文件的内容导入sql的表中?
- 大家谁参加过delphi的等级考试?这个考试都考些什么内容?用什么教材呢?
- 如何获取网页指定的信息?
- C与Delphi中数据结构转换的问题!急急急!
- 用intraweb如何统计在线人数?
- 感谢BEWILL(BEWILL)帮我解决UDP问题,请进来接分
- forgot的散分帖,朋友们进来轻松一下:快过年了,请大家遵守交通规则.
- 数据库发布的问题 12点结帖,若无答案,来者皆有分
- 一个VB版的API问题:用sendmessage向同form的命令按钮发回车键消息,为何无效?
- 三层结构中,如何做Lookup,需要在DBLookupCombox中显示!高分求解 100
var
row, col: Integer;
pt: TPoint;
begin
row := SendMessage(Memo1.Handle, EM_LINEFROMCHAR,
Memo1.SelStart, 0);
col := Memo1.SelStart -
SendMessage(Memo1.Handle, EM_LINEINDEX, row, 0);
Inc(row); // 行号
Inc(col); // 列号
ShowMessage(Format('%d 行 %d列',[row, col]));
end;
var
row, col: Integer;
pt: TPoint;
begin
row := SendMessage(Memo1.Handle, EM_LINEFROMCHAR,
Memo1.SelStart, 0);
col := Memo1.SelStart -
SendMessage(Memo1.Handle, EM_LINEINDEX, row, 0);
Inc(row); // 行号
Inc(col); // 列号
ShowMessage(Format('%d 行 %d列',[row, col]));
end;
p: tpoint;procedure TForm1.Memo1Click(Sender: TObject);
begin
GetCaretPos(p);
end;procedure TForm1.ListBox1DblClick(Sender: TObject);
var
temp: string;
len: integer;
i: integer;
ch: char;
begin
temp := listbox1.Items[listbox1.ItemIndex];
showmessage(temp);
len := length(temp);
memo1.SetFocus;
SetCaretPos(p.X,p.Y);
for i := 1 to len do
sendmessage(memo1.Handle,wm_char,ord(temp[i]),0);
end;
procedure TForm1.ListBox1DblClick(Sender: TObject);
begin
Memo1.SelText := ListBox1.Items[ListBox1.ItemIndex];
end;