怎样在自定义控件中加上hint和showhint属性,另外我想在我需要的时候就显示hint,该怎样实现?请举例说明!up有分!

解决方案 »

  1.   

    在published中加入
    property showhint;
    property hint;
    http://www.tommstudio.com/newclub30/
      

  2.   

    不知道你的自定义控件是怎么做的呢?也就是说,是从哪个控件中派生出来的,一般只要是从TControl及其子类中派生出来的控件,都会有hint、showhint属性的吧!
      

  3.   

    我以创建一个按钮为例,现在form1上放一个button控件,
    在他的onclick事件中代码如下:
    procedure TForm1.Button1Click(Sender: TObject);
    var button2:tbutton;
    begin
      button2:=tbutton.Create(application);
      button2.Left:=50;
      button2.Top:=50;
      button2.Height:=25;
      button2.Width:=75;
      button2.Parent:=form1;
      button2.Caption:='你好!';
      button2.Hint:='你好!';
      button2.ShowHint:=true;
    end;
    此方法我已试过,很好用!!
      

  4.   

    如果要想在你需要的时候showhint的话,你可以先做个判断,再给hint敷值。
    或者先给hint敷值,然后在你需要显示的时候进行判断,后ShowHint:=true;