EhLib使用说明

Delphi EhLib控件:DBGridEh组件深入使用指南 本文还有配套的精品资源,点击获取 简介:EhLib控件是Delphi环境中的一个强大的第三方控件集,尤其是DBGridEh组件,它增强了数据网格的显示和操作功能。本文详细介绍了如何使用DBGridEh组件提升数据展示和用户界面交互性,包括统计栏的添加、复杂标题的实现、隔行分色显示、条件行颜色变化以及自定义列类型等。EhLib控件的其他功能,如拖放排序、列选择、打印预览和数据... 阅读详情

KeyLife富翁笔记
作者: On2008
标题: EhLib使用说明
关键字:
分类: 个人专区
密级: 公开
(评分: , 回复: 0, 阅读: 308)  »»

一、如何在程序中确定Ehlib定义的报表表头颜色?

在执行打印之前,加上下面的语句:
DBGridEh1.FixedColor:=clLime;//clLime可以换成你想要的颜色比如clRed是红色等等
PrintDBgridEh1.Options:=[pghColored,pghFitingByColWidths];//方括号里的"pghColored"是必需的,其它的根据你的需要决定取舍
================================================================

二、Ehlib中的PrintDBGridEh如何印页码,即第几页共几页

PrintDBGridEh.PageFooter.CenterText:='第&[Page]页 共&[Pages]页'
在对象管理器中的相关位置有设
================================================================

三、本人刚学习使用ehlib包,现在要实现类似ehlib所带demo1中一个功能:点击dbgrid某列值
的下拉按纽(可以设置),弹出一个下拉列表(其内容是另一个dataset的)。我看demo1中
好象是使用了DBLookupComboboxEh,可我参看demo1怎么设置也不行,请指教。谢谢。

呵呵,这个效果没有用DBLoookupComboBoxEh,它是利用查找字段实现的。
它在Query1中,对应VName字段,增加了一个叫VName1的查找字段,这个
字段从qrVendors查找相关的数据,再在DBGridEh1显示VName1,这样显示
就是那种效果了。
===============================================================

四、Ehlib 怎样固定某几列?

只要设置dbGridEh的FrozenCols属性为几列即可.


EhLib 用户指南
内容


--------------------------------------------------------------------------------



3 使用 TDBGridEh 组件
理解 TDBGridEh, TDataLink 以及 TDataSet.
All below text in equal degrees pertains as to TDBGridEh component as to TDBGrid component.
A TDBGridEh control lets you view and edit records in a dataset in a tabular grid format.
TDBGridEh does not story data in in itself, it only show data from dataset via TDataLink object. Every database control have internal TDataLink object to interaction with dataset. You can connect TDBGridEh to dataset using DataSource property. If you already use TStringGrid component you can see that data shows in TStringGrid and in TDBGridEh very similarly, but mechanism that use to show data in TStringGrid and in TDBGridEh very different. In TStringGrid count of rows is equal of rows in array of strings while in TDBGridEh (and TDBGrid) count of rows always not more then count of visible rows and although vertical scrollbar can display thumb position regarding the count of record in dataset it take info not from grid but directly from dataset. TDataSet don't allows us to work with data as with array of data i.e. we can not quickly get value of the field from certain record, some types of dataset have not even such notion as record number (in such datasets we can only know that we inhere in the begin of dataset or in the end of its or somewhere between, in that case DBGrid shows vertical vertical scrollbar only in three positions). But to have possibility to draw several record simultaneously TDataLink object allows to have buffer of records (record buffer window) with quick readonly access. DBGrid use this possibility of datalink and set size of record buffer window equal of count of visible rows in grid. We can not control what record must be first in this buffer, DataLink itself scroll record buffer window then we navigate through the dataset and it control the scrolling of record buffer window as that the active record as always in record buffer window. It is a reason why the active record change position when users change thumb position of vertical scrollbar using mouse.

TDBGridEh和纵向滚动条
If you works with different type of dataset you can notice that for some type of dataset DBGrid show vertical scrollbar validly but for over vertical scrollbar have only three position independently of record count in dataset. To set vertical scrollbar accomodation DBGrid use RecordCount and RecNo property of DataSet component. But some dataset and even same dataset under some condition holds -1 in RecordCount and RecNo. DataSet function IsSequenced indicates whether the underlying database table uses record numbers to indicate the order of records. When IsSequenced returns True, applications can safely use the RecNo property to navigate to records in the dataset and DBGrid use RecNo property to show thumb position in vertical scrollbar. But when IsSequenced returns False DBGrid can not define current record position and show vertical scrollbar in three positions. DBGridEh component have possibility to show proportional scrollbar for no sequenced dataset. To do it need to activate SumList and create list of record bookmars. Set SumList.Active to True and SumList.VirtualRecords to True. SumList will run through dataset and create list of record bookmarks, if you use client/sever technology to access database SumList will force dataset to fetch all records, so it operation can take much time. Keep in mind that VirtualRecords will work only for full relationship bookmarks dataset, it means that DataSet.ComapreBookmark function has to return > 0 if bookmark1 > bookmark1 (i.e. record to which indicates bookmark1 have to be after record to which indicates bookmark1), = 0 if bookmark1 = bookmark1, < 0 if bookmark1 = bookmark1. TBDEDataSet in most cases support full relationship bookmarks.


定制网格标题
复杂标题
TDBGridEh 允许在多列上创建标题,例如:

设置 DBGridEh.UseMultiTitle 属性为 True 并且填充字段的标签或列标题的标题,可以使用下面的规则:字段标签中的文本部分或列标题必须由几部分组成,并且用 "|" 分割,几个列的每一个通用部分都设置为相同。其它字段或标题必须在相应的部分包含同样的文本。

例如:

Field1.DisplayLabel := 'Title1|SubTitle1';
Field2.DisplayLabel := 'Title1|SubTitle2';

DBGridEh.Columns[0].Title.Caption := 'Title1|SubTitle1';
DBGridEh.Columns[1].Title.Caption := 'Title1|SubTitle2';
按钮式标题
设置Column.Title.TitleButton 为 True可以强制标题单元为按钮式。写 OnTitleBtnClick事件来控制用户单击标题单元时的操作。

在标题中显示位图
To show bitmap in titles instead of caption use TitleImages property of TDBGridEh and ImageIndex property of TColumnTitleEh.

自动用位置标识排序标题.
TDBGridEh allows to show special sortmarking bitmaps (small triangles) in the right part of title cell. In order to automatically marking title by sortmarking bitmaps add dghAutoSortMarking to OptionsEh property. Add dghMultiSortMarking too in order to allow sortmarking several columns simultaneously. Set Column.Title.TitleButton to true for titles which will have possibility to change sortmarkers at run time. At runtime clicking on title will change sortmarking. Holding Ctrl key allows to mark several columns simultaneously. After user change sormarking grid call OnSortMarkingChanged event. You can write this event to change sorting and reopen in dataset. Use SortMarkedColumns property to access to sortmarked columns.

标题属性的默认值
使用TDBGridEh.ColumnDefValues.Title来设置标题属性的默认值。

定制网格页脚
页脚以及统计值
TDBGridEh allows to show special row (footer) or rows at bottom part. Use FooterRowCount property to specify the number of footer rows in the grid. Use Footer or Footers property of TColumnEh object to specify information which need to show in footer cells. Footers property useful then you have more then one footer rows. Footers is a collection of TColumnFooterEh objects where information from i-th aliment of collection will be show in i-th cell of footer column. In footer cell, it is possible to show: Sum value for specified field, record count, value of a specified field or static text. Use property Footer.ValueType or Footers[i].ValueType to specify which type of value will be show in footer cell. If ValueType = fvtStaticText, then set the property Value to specify text which need to show. If ValueType = fvtFieldValue, then you need to set property FieldName to specify field, value of which need to show. To force grid to calculate total values need to activate SumList (DBGridEh.SumList.Active := True). Set ValueType to fvtSum and grid must to show sum value of the column field in the footer cell, you can also specify Column.Footer.FieldName to calculate total value of the other field. Set ValueType to fvtCount to force grid to show count of records in the footer cell.


定制网格数据单元
在数据单元中显示字段值为图形。
TDBGridEh allows to show bitmaps from TImageList component depending on field values. To show bitmaps depending on field values need: Fill list of field values to Column.KeyList property (every value in separate line) and set Column.ImageList property to ImageList control that has the bitmap in according index. Set Column.NotInKeyListIndex to index of bitmap that will be shown if field's value does not correspond to any value in KeyList (for instance you can set index of image for Null field value). At run time you are not allowed to edit bitmap in column cell. Use blank key and mouse click to set next value from Column.KeyList to the field; Shift-blank key and Shift-Mouse click to set previous value from Column.KeyList. Set Column.DblClickNextval to True have allows to change value on mouse double click.

检查框式的逻辑及非逻辑值
Grid automatically shows checkboxes for boolean field. To show checkboxes for non boolean fields fill first line of Column.KeyList property that corresponds to the checked state of the checkbox, second line - non checked state, and set Column.Checkboxes ptoperty to True. Line of KeyList can represent more than one value in a semicolon-delimited list of items.

数据行高度
使用 RowHeight 和 RowLines 属性来指定数据行高。完整的数据行高 = 行线高度+行高。设置 RowSizingAllowed 为 True 以允许可以在运行是使用鼠标来改变行高。

设置Column.WordWrap为True可以使数据行中文本多行显示。如果行高>文本行,它就换行。

显示备注字段
设置 DrawMemoText to True来显示文本式的备注字段。.

定制单元格字体及颜色
TDBGridEh 中的 Font 和 Color 属性描述了数据网格中绘制单元格的字体和颜色。
TColumnEh 中的 Font 和 Color 属性描述了指定列中绘制单元格的字体和颜色。

事件定制单元格字体及颜色
有几个事件可以让你能够在绘制单元格前定制单元格字体和颜色。你可以写TDBGridEh的OnDrawColumnCellEvent事件句柄来在控制在网格单元中绘制数据。你可以使用Canvas属性的方法来绘制单元格。但是如果你只想改变字体或颜色的属性,我建议你使用下面的事件。你可以写TDBGridEh的OnGetCellParams事件来控制在绘制数据单元以前所指定的操作。你可以改变绘制字体及背景色。这个事件适合你在想改变整行的字体或颜色时使用。如果你想改变指定列中单元格的属性,你可以使用TColumnEh.OnGetCellParams。写这个事件用来控制在一列数据单元被重绘或编辑时的操作。在一列数据单元被重绘以前,你可以改变绘制字体,背景色,对齐方式,图像索引,文本或检查框。在编辑一列数据单元以前,你可以改变编辑字体,背景色,文本或只读状态。

列属性的默认值

使用ColumnDefValues属性来设置列属性的默认值。新创建的列将从ColumnDefValues属性中获得属性值,并且直到第一次为其指定值为止。


在网格的适当位置放置编辑器.
在下拉列表中显示几个字段。
在下拉列表中显示几个下拉字段,需要设置列的LookupDisplayFields属性到字段的Semicolons属性来分割多个字段名。命名为Column.Field.LookupResultField的属性必须位于LookupDisplayFields列表中。多字段的下拉列表只能应用于下拉字段。

显示下拉方式的列

你可以通过KeyList 和 PickList 属性在相关的的字段中显示其它文本。KeyList显示包含在字段的值而非PickList索引所包含的值。 Column.NotInKeyListIndex to index of text from PickList that will be shown

EhLib数据库组件库完整教程与实战 本文还有配套的精品资源,点击获取 简介:EhLib是一个为Delphi和C++Builder开发者设计的强大数据库组件库,用于构建高效且功能丰富的数据库应用程序。它包含多个版本,例如6.1.129FS,提供了大量的数据库访问组件、源代码、帮助文档及示例项目。核心特性包括与多种数据库引擎的交互能力、对BDE和ADO的支持,以及丰富的组件定制化选项。使用EhLib可以帮助开发者... 阅读详情

相关推荐

Delphi开发者必备:EhLib控件库详解

Delphi,作为一款高效、灵活的编程语言,深受开发者喜爱。为了进一步提升开发效率和应用性能,开发者社区创造出了各种专用控件库。这些库不仅丰富了Delphi的内置功能,也降低了开发复杂度,缩短了项目交付周期。其中,EhLib组件库就是最为著名的例子之一。EhLib控件库是一个功能强大的组件集合,专为Delphi环境设计,旨在提供更丰富的数据处理功能和用户界面元素。组件库按照其功能和用途大致可以分为以下几类:数据感知控件:这些控件能够展示和编辑数据,如EhGrid、EhPivotGrid等。

weixin_35257663的博客 588

EhLib.12.0.039

EhLib.12.0.039

EhLib10.0.031(支持XE11安装,运行Installer文件夹中的EhLibInstaller.exe安装)

网上下载并调试支持Win64的X11的EhLib10.0.031,运行Installer文件夹中的EhLibInstaller.exe安装。

EhLib 11.0 第三方Grid控件

Ehlib是一款非常不错的第三方Grid控件,界面美观,功能强劲,内含编程时最常用的Delphi控件和含源码,比DELPHI自带的强大许多,比cxGrid小巧,使用起来简单方便。

EhLib 使用教程:Ehlib 过滤功能的实现

DBGridEh 可以为你提供一个更加美观和功能丰富的 DBGird,比如平面化显示、奇偶行不同颜色(斑马线)、快速查找、合计行、Grid 打印等。在 Ehlib 的后期版本中,还提供了一个非常强大的过滤功能,他会在 DBGrid 的表头下方显示一个过滤行,用户在此行的相应列中输入查询条件,DBGridEh 可以自动为您筛选出所需要的数据。下图所示即为启用过滤功能后的 DBGridEh: 鉴

beyondqd的专栏 6351

EhLib控件的使用说明

EhLib控件的使用说明 一. DBGridEh组件: 1.      属性。       2.      使用统计栏功能 (1)   设置统计栏行数,将DBGridEh.FooterRowCount:= 1 (2)   设置激活统计功能,将DBGridEh.SumList.Active:= True; (3)   选择所统计字段的统计方式,如将Columns[n].Foo

beyondqd的专栏 4538

安装 Ehlib 的方法说明

  使用方法:http://www.delphibbs.com/keylife/iblog_show.asp?xid=15

Kandy_Zheng的专栏 3438

EhLib10.0.031资源文件下载说明

EhLib10.0.031资源文件下载说明 去发现同类优质开源项目:https://gitcode.com/ 文件简介 此资源文件为EhLib库的版本10.0.031,经过网上下载和调试,已确保其支持Win64位的X11系统。EhLib是一套功能强大的控件库,适用于多种开发环境。 安装说明 下载并解压本资源文件; 在解压后的文件夹中找到Installer文件夹; 运行Installer文件夹中的...

gitblog_06742的博客 329

EhLib使用说明(2)

EhLib使用说明<!--google_ad_client = "pub-3171204447347529";google_ad_width = 468;google_ad_height = 60;google_ad_format = "468x60_as";google_ad_type = "text_image";google_ad_channel ="091061

xtaotao的专栏 2920

EhLib 10.0.031 For Delphi 11 下载仓库

EhLib 10.0.031 For Delphi 11 下载仓库 【下载地址】EhLib10.0.031ForDelphi11下载仓库 EhLib 10.0.031 For Delphi 11 下载仓库 项目地址: https:...

gitblog_09798的博客 427

DelphiEhlib安装

由于公司要改截图的软件,所以发给我了一个源文档,但是当我打开的时候,提示我 Error creating form:Class TDBGridEh not found 对此的解决办法是安装Ehlib,我在网上下载了一个EhLib_v4.1.4。 首先我在D盘下新建文件夹 D:\Component\EhlibEhlib_v4.1.4中Common文件夹下和Delphi7文件夹下所有的东...

拿头去拼啊 1380

EhLib 使用教程:EhLib 安装

在发布了最新的 EhLib 4.2.12 中文汉化版以后,在盒子的评论区有人问安装的问题,其实在以前发布 EhLib 3.4、3.6、4.1 汉化修改版时,EhLib 的安装也是评论区问得最多的问题。 这并不是 EhLib 本身的问题,而是很多人不了解 Delphi 组件的安装方法所造成的。EhLib 的安装相对 DevExpress 系列、FastReport 的安装来说已经是非常简单的了。 ...

martian6125 's blog! 782

EhLib 数据库记录的下拉选择

通过下拉选择,知道用户选择了数据库里面的哪条记录。仅仅是用来知道,而不是用来输入。有一个表,有很多记录。提供一个界面让用户从表里面选择一条记录。程序获取用户的选择结果。最简单的方法,给一个 DBGrid,用户将游标走到选择的记录(通过滚动和鼠标点击 DBGrid 里面的一条记录),然后程序读其对应的 DataSet。DBGrid 太占空间。最好是一个类似 Edit 的东西,然后有一个下拉按钮,点这个按钮,下来出来一个框,框里面有多条记录供用户选择。选择结果要显示到这个 Edit 里面。采用 EhLib 的控

pcplayer的博客 739

EhLib.WinForms DataGridEh Crack

什么是 EhLib.WinForms? EhLib.WinForms 为 Microsoft Visual Studio 2012-2019 提供了一组类和组件。使用该库可用于使用 Windows 窗体 API 创建可视化应用程序。

控件与插件之大全 654
上一篇: shadow的ArpCheatSniffer V1.0- -
下一篇: 来自中国各大高校著名导师的精品课程!绝对精典
biili
博客等级 码龄21年 9粉丝 7原创
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值