如何做的像IE按钮一样,鼠标移上去后,提示按钮的名字?(最后28分发放) toolbutton1.hint:='提示';toolbutton1.showhint:=True; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 1。我想,多问没有错,学问学问,就是要问! 人人都会有不知道的东西,何况是新手。 即使是圣贤,也要'不耻下问'呢!2。上述问题还可以进一步问:如果Delphi没有为组件提供hint、showhint属 性,我们自己是否可以直接编写程序,来实现这样的提示功能呢? button.hint='你的提示'工具条的showhint=true to zzwu(未名) 您说的第二种应该怎么做啊?谢谢了 我以前在DOS下,做过这样的工作,整个程序的所有界面都由自己设计的.待我明天找出来后在这里公布,实现这一功能的程序有一点长. Broker_chengchaoji(掮客): 下面就是不用Delphi提的hint、showhint属性,靠自己直接编写程序,来实现组件的提示功能.以下程序在form1上设立了2个button组件:button1和button2。button1上注明了名字,而button2我们去掉了原有的名字(在form1 create时去掉)。当鼠标移到button2上时就在其下出现一个提示。为了做到这一点,我们还必须在form1上设一个Timage组件HintImg,用来作为提示用的小方块。HintImg在平时应看不到的,所以在form1 create 时将其visible设为false;当鼠标移入button2上时,则Button2MouseMove事件发生,利用这一事件来显示为它所作的提示‘this is button2!’;当鼠标的光标移出button2,则它必进入form1,故可利用form1的MouseMove事件来关掉提示。注:任何组件都可用类似方法进行提示,但最常见的是为快捷键进行提示,因为它们很小,其上不能写字,只能画一个图标,初学者不容易看懂,所以要提示。 unit hint;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Buttons;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; hintImg: TImage; procedure Button2MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer); procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.DFM}var hinted:boolean;procedure TForm1.Button2MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);beginhintimg.top:=button2.top+button2.Height+2;hintimg.left:=button2.Left;hintimg.width:=80;hintimg.height:=20;hintimg.canvas.Brush.color:=clinfobk;hintimg.Canvas.FillRect(rect(0,0,80,20));hintimg.Canvas.Font.color:=clred;hintimg.canvas.textout(4,4,'This is button2!');hintimg.visible:=true;hinted:=true;end;procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);begin if hinted then begin hintimg.visible:=false; hinted:=false; end;end;procedure TForm1.FormCreate(Sender: TObject);beginhinted:=false;button2.caption:='';end;end. 谢谢谢谢 zzwu(未名) ! 求救如何像360网络连接状态的获得。。 popupmenu 怎么设置背景颜色呢? 如何delphi动态调用封装在dll(或bpl)里的窗体?谢谢! IdTCPClient和IdTCPServer 发送字符的时候为什么不能超过 string[255] ?? 帮忙解决一下SQLSERVER2000里image字段如何存放图片 DELPHI的JPEG的SAVETOFILE函数是不是有问题啊? 报表中的自增内容。 哪儿可以获得全部的计算机可以显示的符号? StringGrid单元的颜色 急死我了 各位大侠,帮帮我吧 如何在主窗体居中的画一个图片?
人人都会有不知道的东西,何况是新手。
即使是圣贤,也要'不耻下问'呢!2。上述问题还可以进一步问:如果Delphi没有为组件提供hint、showhint属
性,我们自己是否可以直接编写程序,来实现这样的提示功能呢?
工具条的showhint=true
您说的第二种应该怎么做啊?
谢谢了
以下程序在form1上设立了2个button组件:button1和button2。button1上注明了名字,而button2我们去掉了原有的名字(在form1 create时去掉)。当鼠标移到button2上时就在其下出现一个提示。
为了做到这一点,我们还必须在form1上设一个Timage组件HintImg,用来作为提示用的小方块。
HintImg在平时应看不到的,所以在form1 create 时将其visible设为false;
当鼠标移入button2上时,则Button2MouseMove事件发生,利用这一事件来显示为它所作的提示‘this is button2!’;
当鼠标的光标移出button2,则它必进入form1,故可利用form1的MouseMove事件来关掉提示。注:任何组件都可用类似方法进行提示,但最常见的是为快捷键进行提示,因为它们很小,其上不能写字,只能画一个图标,初学者不容易看懂,所以要提示。
unit hint;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, Buttons;type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
hintImg: TImage;
procedure Button2MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}
var hinted:boolean;
procedure TForm1.Button2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
hintimg.top:=button2.top+button2.Height+2;
hintimg.left:=button2.Left;
hintimg.width:=80;
hintimg.height:=20;
hintimg.canvas.Brush.color:=clinfobk;
hintimg.Canvas.FillRect(rect(0,0,80,20));
hintimg.Canvas.Font.color:=clred;
hintimg.canvas.textout(4,4,'This is button2!');
hintimg.visible:=true;
hinted:=true;
end;procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
begin
if hinted then
begin
hintimg.visible:=false;
hinted:=false;
end;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
hinted:=false;
button2.caption:='';
end;end.