全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1252
推到 Plurk!
推到 Facebook!

一個 hint 的問題

尚未結案
shinnuei
一般會員


發表:32
回覆:48
積分:21
註冊:2002-03-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-11-27 20:20:29 IP:220.130.xxx.xxx 未訂閱
各位先進大家好: 小弟最近想要找一個 hint 的元件,就像是 statplus 的泡泡式說明,但是我去 http://www.vclxx.org/ 試了將近十個左右的元件,能正常出現hint的沒幾個,但是能使用的元件,也不太滿意他的效果。 於是只好自己寫了,小弟找到相關的討論,但是是用 delphi 寫的: 【Delphi】【問題】怎樣是組件的hint字串的字變大? http://delphi.ktop.com.tw/topic.php?topic_id=42958 其中有一行程式(下方紅色那一行),不知道要怎麼翻成 bcb 的語法, 麻煩各位 delphi/bcb 雙修的先進指點。
 
Type
  TMyHintWindow = Class (THintWindow)
   Constructor Create (AOwner: TComponent); override;
end;    Constructor TMyHintWindow.Create (AOwner: TComponent);
Begin
  Inherited Create (Aowner);
  Canvas.Font.Name := 'Times New Roman';
  Canvas.Font.Size := 14;
end;    procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.ShowHint := False;
  HintWindowClass := TMyHintWindow;
  Application.ShowHint := True;
end;    end.
allenchan
資深會員


發表:10
回覆:306
積分:283
註冊:2004-01-06

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-11-29 22:34:29 IP:61.62.xxx.xxx 未訂閱
試試看這樣行嗎? HintWindowClass = __classid(TMyHintWindow);
shinnuei
一般會員


發表:32
回覆:48
積分:21
註冊:2002-03-13

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-12-02 15:15:16 IP:59.120.xxx.xxx 未訂閱
to allenchan: 不行哦,他會出現 [Linker Error] Unresolved external '__fastcall Controls::THintWindow::NCPaint(void *)' referenced from C:\HINT\FORM1\UNIT1.OBJ 另外Edit1,Memo1 只是打了一些hint 上去,並把 showhint = true. 程式碼如下:
unit1.h
//---------------------------------------------------------------------------    #ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include 
#include 
#include 
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:        // IDE-managed Components
  TButton *Button1;
  TMemo *Memo1;
  TEdit *Edit1;
  void __fastcall Button1MouseMove(TObject *Sender, TShiftState Shift,
          int X, int Y);
  void __fastcall FormCreate(TObject *Sender);
private:        // User declarations
public:                // User declarations
  __fastcall TForm1(TComponent* Owner);
};
class TMyHintWindow : public THintWindow
{
  private:
  public:
    __fastcall TMyHintWindow(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
unit1.cpp
//---------------------------------------------------------------------------    #include 
#pragma hdrstop    #include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1MouseMove(TObject *Sender,
      TShiftState Shift, int X, int Y)
{//會一直產生重覆的物件,先不要管他
  TRect rcTemp;
  THintWindow * phwTest = new THintWindow(this);      rcTemp.Top = 100;
  rcTemp.Left = 100;
  rcTemp.Bottom = 200;
  rcTemp.Right = 200;
//  phwTest->Font = "新細明體";
  phwTest->Font->Size = 30;
  phwTest->ActivateHint(rcTemp,"Hint Test");
}
//---------------------------------------------------------------------------
__fastcall TMyHintWindow::TMyHintWindow(TComponent* Owner) : THintWindow(Owner)
{
  Canvas->Font->Name = "新細明體";
  Canvas->Font->Size = 30;
}
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  Application->ShowHint = false;
  HintWindowClass = __classid(TMyHintWindow);
  Application->ShowHint = true;
}
//---------------------------------------------------------------------------
allenchan
資深會員


發表:10
回覆:306
積分:283
註冊:2004-01-06

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-12-02 17:04:30 IP:61.230.xxx.xxx 未訂閱
class TMyHintWindow : public THintWindow
{
private:    protected:
    
    virtual void __fastcall NCPaint(HDC DC)
    {
      TRect R(0, 0, Width, Height);
      DrawEdge(DC, &R, BDR_RAISEDOUTER, BF_RECT);
    }
        public:
    __fastcall TMyHintWindow(TComponent* Owner);
};
shinnuei
一般會員


發表:32
回覆:48
積分:21
註冊:2002-03-13

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-12-04 20:04:54 IP:59.120.xxx.xxx 未訂閱
謝謝 allenchan. 但小弟有一個疑問,為什麼下了這行程式 HintWindowClass = __classid(TMyHintWindow); 他會預設去找裡面的 NCPaint function呢?
系統時間:2024-05-15 20:51:55
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!