EhLib使用说明

本文档详细介绍了EhLib组件库的使用方法,包括dataset、网格、imagelist等组件的配置与操作,适用于Delphi开发环境中。通过实例演示,帮助开发者理解如何有效地利用EhLib进行integer类型数据处理和RTF文本显示。
摘要由CSDN通过智能技术生成

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事件句柄来在控制在网格单元中绘制数据。你可以使用C

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
### 回答1: ehlib langresources 是一个应用程序开发库,它可以帮助开发人员在应用程序中管理和处理多语言资源。 使用 ehlib langresources,开发人员可以将应用程序的用户界面及相关文本内容翻译成多种语言,并且根据系统设置或用户设置,动态切换应用程序的语言。 ehlib langresources 提供了一些方便的功能和方法,使开发人员可以更轻松地管理语言资源。它支持将不同语言的文本保存在外部文件中,这样开发人员就可以将翻译工作分配给专门的团队或人员。同时,它还提供了一些工具,如翻译编辑器和导出工具,方便开发人员进行翻译和导出。 使用 ehlib langresources,开发人员可以根据需要动态切换应用程序的语言。这就意味着开发人员可以为不同的用户提供更加友好和个性化的用户界面,以满足他们的需求。同时,开发人员可以根据用户的设置,自动切换应用程序的语言,提供更好的用户体验。 总的来说,ehlib langresources 是一个强大的工具,可以帮助开发人员轻松管理和处理多语言资源。它提供了一些方便的功能和方法,使开发人员可以更好地处理应用程序的多语言需求,并提供更好的用户体验。 ### 回答2: ehlib是一个Delphi开发工具包,提供了丰富的组件和函数,可用于加强和扩展Delphi应用程序的功能。 ehlib的一个主要用途是为Delphi数据库应用程序提供支持。它包含了一系列功能强大的数据控件和数据集,例如EhDBGrid、EhLibMEMDS、EhLibIBX等。这些数据控件和数据集可以帮助开发人员更方便地显示和编辑数据库中的数据,并提供了许多自定义选项和事件来满足不同应用程序的需求。 此外,ehlib还提供了许多其他有用的组件和函数,例如TreeGrid、Calculator、RichView等。这些组件可以帮助开发人员在应用程序中实现更复杂和丰富的功能,例如树形列表、计算器、富文本编辑等。 使用ehlib的过程相对简单。首先,我们需要在Delphi环境中安装和注册ehlib包。然后在项目中添加相应的ehlib组件,并根据需求进行配置和使用。通过属性设置、事件处理和方法调用等方式,我们可以根据具体需求定制和扩展ehlib的功能。 总之,ehlib是一个强大的Delphi开发工具包,为开发人员提供了丰富的组件和函数,可以帮助他们更方便地开发和扩展Delphi应用程序的功能。无论是用于数据库应用程序,还是其他类型的应用程序,ehlib都可以提供必要的支持和帮助。 ### 回答3: ehlib langresources 的使用非常方便和灵活。ehlib langresources 是一款用于多语言支持的库,它可以帮助开发者实现多国语言的应用程序。 首先,我们可以使用 ehlib langresources 创建一个多语言资源文件。这个资源文件包含了程序中用到的所有文字和语句的翻译。我们可以按照需求添加不同语言版本的翻译,比如中文、英文、法文等等。 接下来,在程序中我们可以通过调用 ehlib langresources 提供的方法来加载对应语言的翻译资源。这样,程序就可以根据用户的语言设置自动选择合适的翻译资源进行显示。这样的设计使得应用程序更加友好,用户可以在他们熟悉的语言环境下操作。 除了加载翻译资源,ehlib langresources 还提供了一些其他有用的功能。比如,我们可以根据语言设置动态更改应用程序中的语言显示,而不需要重新启动应用程序。另外,ehlib langresources 还支持热更新翻译资源,这意味着我们可以在不停止应用程序的情况下更新翻译内容。 总的来说,ehlib langresources 是一个强大的多语言支持库,它可以帮助开发者快速实现多国语言的应用程序。在国际化的背景下,ehlib langresources 提供了方便易用的功能,使得应用程序可以适应不同的语言环境,提高用户体验。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值