如何扩展VCL的hint
默认的Hint窗口展现如下:

这种情况下可以操作有窗口的背景颜色,字体样式
Application.Color
有的时候仅仅是文字满足不了我们的需求,比例如下格式:


这个时候就应该执行以下步骤:
1.新建一个单元,基层自:THintWindow;
2.重写THintWindow的PCPaint方法或者Paint方法来绘制自己想要的格式;
3.将全局变量HintWindowClass赋值为你所写的类(这步必须要在Application创建form之前);
请参见如下代码:
自定义类
unit MyHintWindow; interface
uses
Forms,Windows,Messages,Controls,Themes,Classes,Graphics; type
TMyHintWindow = class(THintWindow)
protected
procedure NCPaint(DC: HDC); override;
procedure Paint; override;
end; TMyHintWindowClass = class of TMyHintWindow; implementation
var
tempBmp:TBitMap;
procedure init;
begin
tempBmp := TBitmap.Create;
tempBmp.LoadFromFile('Chrysanthemum.bmp');
end;
{ TMyHintWindow } procedure TMyHintWindow.NCPaint(DC: HDC);
begin
inherited;
//在这里写入绘画非客户区的代码
end; procedure TMyHintWindow.Paint;
var
clientRect:TRect;
begin
Self.Width := 500;
Self.Height := 500;
clientRect:= GetClientRect;
clientRect.Bottom := clientRect.Top + 3;
Canvas.Brush.Color := clred;
Canvas.FillRect(clientRect);
Canvas.Brush.Color := clWhite;
clientRect:= GetClientRect;
clientRect.Top := clientRect.Top + 3;
Canvas.FillRect(clientRect);
Canvas.TextOut(100,3,Caption);
Canvas.Draw(0,18,tempBmp);
end; initialization
init;
finalization
tempBmp.Free;
end.
工程单元代码如下:
program Project1; uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
MyHintWindow in 'MyHintWindow.pas'; {$R *.res} begin
Application.HintColor := $000000;
Application.HintHidePause := 10000;
HintWindowClass := TMyHintWindow;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
如何扩展VCL的hint的更多相关文章
- ORACLE常用SQL优化hint语句
在SQL语句优化过程中,我们经常会用到hint,现总结一下在SQL优化过程中常见Oracle HINT的用法: 1. /*+ALL_ROWS*/ 表明对语句块选择基于开销的优化方法,并获得最佳吞吐量, ...
- 【温故Delphi】之VCL消息机制小结
TObject消息分派 procedure Dispatch(var Message); virtual; #负责分派消息到特定VCL组件的事件处理函数 procedure DefaultHandle ...
- 如何编写Vault插件扩展Vault Explorer的功能
今天练习了一下Vault Explorer的扩展程序,基本上是Vault SDK中的HelloWord示例程序.如果你刚刚开始接触Vault的二次开发,希望对你有帮助. 开始之前,你需要安装Vault ...
- Python学习笔记(迭代、模块扩展、GUI 、编码处理等)
PythonIDLE中的编码处理 http://www.tuicool.com/articles/NbyEBr 原文标题:Python中实际上已经得到了正确的Unicode或某种编码的字符,但是看起来 ...
- Devexpress VCL Build v2014 vol 15.2.3 发布
2016年第一个版本,继续修补. New Major Features in 15.2 What's New in VCL Products 15.2 Breaking Changes To lear ...
- Firefox扩展开发
Firefox扩展开发 (插件开发) Extension开发 入门教程 5步走 五步走 首先需要知道什么是"Firefox插件".这里说的"插件"只是一个通 ...
- 以下是关于Controller的一些Hint
在经过路由分发之后,实际的应用Controller接管用户的所有请求,并负责与用户数据的交互.CI中所有的应用控制器都应该是CI_Controller的子类(除非你扩展了CI的核心,那么你的Contr ...
- PLSQL_PLSQL Hint用法总结(概念)
2014-06-20 Created By BaoXinjian
- PLSQL_性能优化系列05_Oracle Hint提示
2014-06-20 Created By BaoXinjian
随机推荐
- Apache CXF实现Web Service(2)——不借助重量级Web容器和Spring实现一个纯的JAX-RS(RESTful) web service
实现目标 http://localhost:9000/rs/roomservice 为入口, http://localhost:9000/rs/roomservice/room为房间列表, http: ...
- 客户端的数据来源:QueryString, Form, Cookie Request[]与Request.Params[]
在ASP.NET编程中,有三个比较常见的来自于客户端的数据来源:QueryString, Form, Cookie . 我们可以在HttpRequest中访问这三大对象. QueryString: 获 ...
- zend studio插件
1.安装使用Aptana插件(html,css,js代码提示功能) 安装步骤: 1).zend studio->Help->Install New Software->work wi ...
- React Native 简介:用 JavaScript 搭建 iOS 应用(2)
[编者按]本篇文章的作者是 Joyce Echessa--渥合数位服务创办人,毕业于台湾大学,近年来专注于协助客户进行 App 软体以及网站开发.本篇文章中,作者介绍通过 React Native 框 ...
- 为Form中的控件增加自适应功能 转
创建一个基于Custom的类resizeable,并新建属性和方法程序,其说明如下: a) 新建属性: posiTyperList 可调整位置的控件类型列表sizeTypeList 可调整大小的控件类 ...
- MJRefresh插件引起的错误
添加的头部或者尾部刷新,离开这个界面的时候需要移除 - (void)dealloc { [_tableView removeHeader];} 不同版本的处理的方式不同 报的错误: 类的一个实例 ...
- Leetcode: strStr()
Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle ...
- C# 匿名方法 1027
class Program { static void Main(string[] args) { SorAndShowFiles("Sorted by name", delega ...
- poj 2068 Nim 博弈论
思路:dp[i][j]:第i个人时还剩j个石头. 当j为0时,有必胜为1: 后继中有必败态的为必胜态!!记忆化搜索下就可以了! 代码如下: #include<iostream> #incl ...
- E文阅读
Lesson 9 A cold welcome 冷遇 What does 'a cold welcome' refer to?On Wednesday evening, we went to the ...