在需要插入文字的地方先显示一个文本框,输入完文字失去光标以后,文字就变成了图片的一部分了。
在bitmap上用canvas画的。谢谢!
在bitmap上用canvas画的。谢谢!
解决方案 »
- 二进制加法问题
- 对BLOB字段进行保存数据时出错的问题,应该很简单! 200410
- 鼓捣一天writfile写不尽去数据啊 蛋都碎了
- 如何正确取得中西文混合后的字符串的任意子串,请教!!!
- 我需要Steve Teixeira著的《Delphi 4开发大全(上、下)》
- 关于Frame框架的问题,很菜,(不赊帐哦)
- 我实在是理解不了,请各位大虾帮我解答一下
- hjd_cw请进来领分
- 有在东莞工作的朋友吗?进来领分。
- 这是小第的第一各小软件,请指教!http://www.csdn.net/cnshare/soft/10/10423.shtm
- 求把这个C++函数翻译成delphi
- 关于UDP聊天室的问题
http://code.google.com/p/screen-paint/
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
Image1: TImage;
Edit1: TEdit;
procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key =#13 then
begin
Image1.Canvas.Font.Color := clRed;
Image1.Canvas.TextOut(Edit1.Left-image1.Left,Edit1.top-image1.top,Edit1.Text);
Edit1.Visible := False;
end;
end;procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
Pt:TPoint;
begin GetCursorPos(pt);
if WindowFromPoint(pt) =Edit1.Handle then
begin
ReleaseCapture;
SetCapture(Handle) ; end else
begin
ReleaseCapture; Image1.Canvas.Font.Color := clRed;
Image1.Canvas.TextOut(Edit1.Left-image1.Left,Edit1.top-image1.top,Edit1.Text);
Edit1.Visible := False;
end;end;procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);begin Edit1.Left := x+image1.Left;
Edit1.Top := y+image1.Top;
edit1.Visible := True;
SetCapture(Handle) ;
end;end.dfm
-------------------------
object Form1: TForm1
Left = 218
Top = 96
Caption = 'Form1'
ClientHeight = 462
ClientWidth = 854
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnMouseUp = FormMouseUp
PixelsPerInch = 96
TextHeight = 13
object Image1: TImage
Left = 168
Top = 112
Width = 369
Height = 289
OnMouseDown = Image1MouseDown
end
object Edit1: TEdit
Left = 392
Top = 320
Width = 121
Height = 21
TabOrder = 0
Text = 'Edit1'
Visible = False
OnKeyPress = Edit1KeyPress
end
end
完全可以不用mousehook了
关于tab焦点的切换 你自己处理下就可以