能不能在 hint 里加图片?
解决方案 »
- TSQLConnection组件的ConnectionName属性设置的问题
- 继续,放分也没有人来,看来D版的人气值得考虑啊.
- 怎么给VB的窗口发信息模拟鼠标单击?
- 请问在一个MDI窗体菜单中,如何做一个DLL
- 各位高手,有几个问题求救(急啊)
- 一个报表问题,怎么把PageFooter提上来并每页都显示???
- 用ADO访问ORACLE,小数点丢了,为什么?
- 打印时,如何控制转行? 不然的话会超过报表边界!
- Delphi怎么操作FoxPro的DBF数据库?
- DELPHI7下用superobject读取中国天气网的JSON数据的天气预报
- 怎样得到当前系统版本、硬盘剩余空间大小,系统可用内存大小?
- <高分>各门老朋友,能否提供给我计算机一级考试的模拟考试软件(新版的,没有FoxBase的)
修改以下的语句DrawText(Canvas.Handle , PChar(Caption),Length(Caption),R,DT_NOPREFIX or DT_WORDBREAK or DT_CENTER or DT_VCENTER)
变成画图语句,应该能画出图片。
在其他单元中uses这个单元即可unit MyHintwindow;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type
TMyHintwindow = class(THintwindow)
private
FRegion :THandle ;
procedure FreeCurrentRegion ;
{ Private declarations }
protected
{ Protected declarations }
public
destructor Destroy;override ;
procedure ActivateHint(Rect:TRect;const AHint:string);override ;
procedure paint ;override ;
procedure CreateParams(var Params:TCreateParams);override ;
{ Public declarations }
published
{ Published declarations }
end;//procedure Register;implementationdestructor TMyHintwindow.Destroy ;
begin
FreeCurrentRegion ;
inherited Destroy ;
end ;procedure TMyHintwindow.FreeCurrentRegion;
begin
if FRegion <> 0 then
begin
SetWindowRgn(Handle , 0 , True );
DeleteObject(FRegion) ;
FRegion := 0 ;
end ;
end ;procedure TMyHintwindow.ActivateHint(Rect:TRect;const AHint:String) ;
begin
with Rect do Right := Right + Canvas.TextWidth('WWWW') ;
BoundsRect := Rect ;
FreeCurrentRegion ;
with BoundsRect do
FRegion := CreateRoundRectRgn(0,0,Width,Height,Width,Height);
if FRegion <> 0 then
SetWindowRgn(Handle,FRegion,True);
inherited ActivateHint(Rect,AHint) ;
end ;procedure TMyHintwindow.CreateParams(var Params:TCreateParams);
begin
inherited CreateParams(Params) ;
Params.Style := Params.Style and ws_Border ;
end ;procedure TMyHintwindow.paint ;
var R:TRect ;
begin
R := ClientRect ;
Inc(R.Left,1) ;
//Canvas.Font.Color := clInfoText ;
Canvas.brush.Color := clYellow ;
Canvas.Font.Color := clBlue ;
DrawText(Canvas.Handle , PChar(Caption),Length(Caption),R,
DT_NOPREFIX or DT_WORDBREAK or DT_CENTER or DT_VCENTER);
end ;
{procedure Register;
begin
RegisterComponents('Standard', [TMyHintwindow]);
end; }initialization
Application.ShowHint := false ;
HintWindowClass := TMyHintWindow ;
Application.ShowHint := True ;end.