All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
PHP开发中关于文件操作的疑难问答_[PHP教程]
SQL,Server的有效安装_mssql学习_编程技术
在asp.net2.0页面部分缓存中使用ControlCachePolicy类
当ASP.NET撞上JSF之模板化、式样和主题_[Asp.Net教程]
asp.net中Server对象的应用实例
ASP.NET中“找不到指定模块”的解决办法_[Asp.Net教程]
C#中类的继承机制_[Asp.Net教程]
visual c++中的构造函数与析构函数
2003环境下如何手工修复安装.NET1.1_服务器技术_编程技术
网站的ALEXA排名下降的原因及解决方法_JavaScript技术_编程技术
Reading number is top 10 pictures
Group of female porn in 《westwards》, uninhibited woman threatened to not the bottom line1
NeedWallpaper12
南昌铁路局攸县车站125户铁路职工微利房终成骗局
The real super beauty4
这才是真正的人体艺术3
The world's top ten most beautiful railway station1
2012 national geographic daily picture1
NeedWallpaper10
XuYing poker perspective garment debut
Sora aoi possession of boudoir2
Download software ranking
DreamWeaver8
C++教程第四版
WebService在.NET中的实战应用教学视频 → 第1集
Twenty piece of palm leaf
星际争霸1.08硬盘免安装版
Unix video tutorial6
Tram sex maniac 2 (H) rar bag6
The Bermuda triangle1
Prostitutes diary
Boxer's Top ten classic battle2
aaa published in(发表于) 2014/7/19 0:11:11 Edit(编辑)
Delphi带背景的工具栏实例

Delphi带背景的工具栏实例

Delphi带背景的工具栏实例

实例说明

工具栏是窗体的组成部分之一,工具栏中的按钮可以设定完成一些较为常用或重要的功能,本例设计了一个工具栏,并为该工具栏做了一些修饰,即使工具栏带有背景。背景的图案可以透过按钮显示,效果如图1.7所示。



技术要点

工具栏中的背景是一副图片,在运行时应该将改图片绘制到工具栏上,当工具栏需要重绘时会触发OnAdvanced CustomDraw事件,利用该事件可以完成对工具栏的绘制。在程序启动时将一幅尺寸合适的图片载入程序,当触发OnAdvancedCustomDraw事件时将图片绘制在工具栏上。退出程序时将图片绘制在工具栏上。退出程序时释放图片资源。这样就可以完成工具栏背景的绘制。

实现过程

1.新建一个标准工程,创建一个新窗体,默认主窗体的Name属性为Form1。

2.在窗体中添加TToolBar、TMemo组件。命名TToolBar组件为TBRbmp,在TBRbmp中添加一个工具栏按钮。

3.设置TMemo组件的Align属性为alClient。

4.程序代码如下。

在单元中声明变量:

var

Form1: TForm1;

Bmp:TBitmap;

窗体建立时载入图片:

procedure TForm1.FormCreate(Sender: TObject);

begin

Bmp:=TBitmap.Create;

bmp.LoadFromFile('mingrisoft.com.bmp');

end;

释放图片资源:

procedure TForm1.FormDestroy(Sender: TObject);

begin

bmp.Free;

end;

将图片绘制到工具栏上:

procedure TForm1.TBRbmpAdvancedCustomDraw(Sender: TToolBar;

const ARect: TRect; Stage: TCustomDrawStage; var DefaultDraw: Boolean);

begin

Sender.Canvas.StretchDraw(arect,Bmp);

end;


procedure TForm1.FormResize(Sender: TObject);

begin

TBRbmp.Repaint;

end;




添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.