现在我需要有这样一个功能。
假设memo中有一段文字abcdefg,还有一个listbox里面有若干内容,现在我需要的功能是,首先鼠标在memo中点击需要添加内容的地方,假设点在c后面,然后我再双击listbox中的一项,假设为1111,这个时候1111的内容添加到memo中,memo的内容变为abc1111defg.这个怎么实现???
假设memo中有一段文字abcdefg,还有一个listbox里面有若干内容,现在我需要的功能是,首先鼠标在memo中点击需要添加内容的地方,假设点在c后面,然后我再双击listbox中的一项,假设为1111,这个时候1111的内容添加到memo中,memo的内容变为abc1111defg.这个怎么实现???
解决方案 »
- 如果安装fast report 在delphi7中啊?
- Activex如何封装TListview控件
- 急!求救!报表预览窗口
- 这样做会很耗内存吗?请高手指教。。。。
- 请问:Delphi+SQLserver奇怪问题!
- 数据库字段(字符型)中查某一字符个数,怎样比较快?
- 其实是这样,见代码
- win98文件的拷贝
- 关于clientdataset中的属性DisableStringTrim的设置?
- 在richedit中如何定位光标?跟者有分!
- 一个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;