hint的問題 |
尚未結案
|
guohun
一般會員 ![]() ![]() 發表:6 回覆:1 積分:1 註冊:2004-07-27 發送簡訊給我 |
|
hagar
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
您好, 在 TForm 的 OnCreate 事件中使用如下的碼試試:
(要該元件有設 Hint, 且 ShowHint 屬性為 True)
procedure TForm1.FormCreate(Sender: TObject); var i,j: integer; sHint, sTmp, sResult: String; begin for i := 0 to ComponentCount - 1 do begin sHint := ''; if Components[i] is TControl then begin sHint := TControl(Components[i]).Hint; end; if Components[i] is TCustomAction then begin sHint := TCustomAction(Components[i]).Hint; end; if Components[i] is TMenuItem then begin sHint := TMenuItem(Components[i]).Hint; end; sResult := ''; while sHint <> '' do begin sTmp := ''; j := 1; while j < 14 do begin if IsDBCSLeadByte(Byte(sHint[j])) then begin sTmp := sTmp sHint[j] sHint[j 1]; Inc(j, 2); end else begin sTmp := sTmp sHint[j]; Inc(j); end; end; sResult := sResult sTmp #13; Delete(sHint, 1, Length(sTmp)); end; if Components[i] is TControl then begin TControl(Components[i]).Hint := sResult; end; if Components[i] is TCustomAction then begin TCustomAction(Components[i]).Hint := sResult; end; if Components[i] is TMenuItem then begin TMenuItem(Components[i]).Hint := sResult; end; end; end;-- 向 KTop 的弟兄們致敬! ![]() |
richtop
資深會員 ![]() ![]() ![]() ![]() ![]() 發表:122 回覆:646 積分:468 註冊:2003-06-10 發送簡訊給我 |
guohun 您好: 您一併參考看看吧!
|
jest0024
高階會員 ![]() ![]() ![]() ![]() 發表:11 回覆:310 積分:224 註冊:2002-11-24 發送簡訊給我 |
type TMyHintWindow = class(THintWindow) //重新定義THintWindw類別 public procedure activateHintData(Rect:TRect;const AHint:String;AData:Pointer);override; end; procedure TMyHintWindow.activateHintData(Rect:TRect;const AHint:String;AData:Pointer); //重新改寫方法 begin Rect.Right:=Rect.Left+100; Rect.Bottom:=Rect.Top +100; Inherited; end; constructor TForm1.Create(... begin HintWindowClass:=TMyHintWindow; end; |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |