| DBGrid的实用技巧 |
|
1.隔行不同颜色显示
with TDBGrid(Sender) do begin if (gdSelected in State) or (gdFocused in State) then Canvas.Brush.Color := clAqua else if DataSource.DataSet.RecNo mod 2 = 0 then Canvas.Brush.Color := $00F0F0F5 else Canvas.Brush.Color := clWindow; DefaultDrawColumnCell(Rect, DataCol, Column, State); end; 2.Flat风格 属性设置: Ctrl3D = False Options.dgColLines = False Options.dgRowLines = False type TGridAccess = class(TCustomGrid); Form.OnCreate: with TGridAccess(DBGrid1) do Options := Options + [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine]; 3.去掉滚动条 private { Private declarations } FGridWndProc: TWndMethod; procedure GridWndProc(var Message: TMessage); Form.OnCreate: TGridAccess(DBGrid1).ScrollBars := ssNone; FGridWndProc := DBGrid1.WindowProc; DBGrid1.WindowProc := GridWndProc; Form.OnDestroy: DBGrid1.WindowProc := FGridWndProc; procedure TForm1.GridWndProc(var Message: TMessage); begin case Message.Msg of WM_PAINT, WM_NCPAINT: begin SetScrollRange(DBGrid1.Handle, SB_HORZ, 0, 0, False); SetScrollRange(DBGrid1.Handle, SB_VERT, 0, 0, False); end; end; FGridWndProc(Message); end; 4.鼠标移到某个单元格,指针形状改变 procedure TForm1.DBGrid1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var Coord: TGridCoord; begin Coord := TDBGrid(Sender).MouseCoord(X, Y); if (Coord.Y > 0) and (Coord.X = 1) and not TDBGrid(Sender).DataSource.DataSet.IsEmpty then begin // Coord.X=1,dgIndicator=True时说明在第一列,False时说明在第二列 TDBGrid(Sender).Cursor := crHandPoint; StatusBar1.SimpleText := 'Click to open curve form'; end else begin TDBGrid(Sender).Cursor := crDefault; StatusBar1.SimpleText := ''; end; end; 5.Options.dgRowSelect=True时,点击不同单元格列,执行不同的动作 DBGrid 的OnMouseDown/OnMouseUp事件在点击记录单元格时不会触发(点击固定行列区会触发),而Options.dgRowSelect= True时,OnCellClick事件的Column总是传递第一个列对象,即Column.Index=0,即使你点击的是其他列,因此需要在 OnCellClick中再判断点击的是哪个列,再根据不同列执行不同的动作。 procedure TForm1.DBGrid1CellClick(Column: TColumn); var Coord: TGridCoord; P: TPoint; begin GetCursorPos(P); Windows.ScreenToClient(TDBGrid(Sender).Handle, P); Coord := TDBGrid(Sender).MouseCoord(P.X, P.Y); if (Coord.Y > 0) and (Coord.X = 1) and not TDBGrid(Sender).DataSource.DataSet.IsEmpty then // Coord.X=1,dgIndicator=True时说明在第一列,False时说明在第二列 ShowMessage(GridRate.Columns[0].Field.AsString); end; 2006-1-5 15:50:45 查看评语»»» 2006-1-5 16:57:15 6.支持鼠标滚轮方法一: private { Private declarations } procedure GridMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); Form.OnCreate: TControlAccess(DBGrid1).OnMouseWheel := GridMouseWheel; procedure TForm1.GridMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); begin TDBGrid(Sender).DataSource.DataSet.MoveBy(-WheelDelta div WHEEL_DELTA); Handled := True; end; 方法二: private { Private declarations } FGridWndProc: TWndMethod; procedure GridWndProc(var Message: TMessage); Form.OnCreate: FGridWndProc := DBGrid1.WindowProc; DBGrid1.WindowProc := GridWndProc; Form.OnDestroy: DBGrid1.WindowProc := FGridWndProc; procedure TForm1.GridWndProc(var Message: TMessage); begin case Message.Msg of WM_MOUSEWHEEL: begin DBGrid1.DataSource.DataSet.MoveBy(-Smallint(Message.WParamHi) div WHEEL_DELTA); end; else FGridWndProc(Message); end; end; 2006-1-5 16:59:05 6.支持鼠标滚轮(补充)type TControlAccess = class(TControl); 2006-1-17 10:39:50 隔行不同颜色显示(2)鉴于DataSource.DataSet.RecNo可能无效,改用DataLink.ActiveRecord。 type TDBGridAccess = class(TCustomDBGrid); procedure TForm1.GridListDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin with TDBGrid(Sender) do begin Canvas.Font.Color := clBlack; if (gdSelected in State) or (gdFocused in State) then Canvas.Brush.Color := clAqua else if Odd(TDBGridAccess(Sender).DataLink.ActiveRecord) then Canvas.Brush.Color := $00F0F0F5 else Canvas.Brush.Color := clWindow; DefaultDrawColumnCell(Rect, DataCol, Column, State); end; end; 2006-1-17 14:48:45 7.显示行号unit HackGrid; interface uses Windows, SysUtils, Grids, DBGrids; type THackGrid = class protected class procedure NewSetColumnAttributes; public class procedure Hook(AIndicatorWidth: Integer); class procedure Unhook; class procedure DrawOrds(Sender: TObject; AState: TGridDrawState); end; implementation var GOldSetColumnAttributes: Pointer; GIndicatorWidth: Integer; type TDBGridAccess = class(TCustomDBGrid); { THackGrid } class procedure THackGrid.Hook(AIndicatorWidth: Integer); var obj: TObject; vmt, vmtIndex: Integer; method, newMethod: Pointer; dwOldProtect: DWORD; begin GIndicatorWidth := AIndicatorWidth; if GOldSetColumnAttributes <> nil then Exit; obj := TDBGrid.Create(nil); try vmt := PInteger(obj)^; asm MOV vmtIndex,VMTOFFSET TDBGridAccess.SetColumnAttributes; end; method := Pointer(vmt + vmtIndex); GOldSetColumnAttributes := PPointer(method)^; VirtualProtect(method, 4, PAGE_READWRITE, dwOldProtect); newMethod := @THackGrid.NewSetColumnAttributes; PPointer(method)^ := newMethod; VirtualProtect(method, 4, dwOldProtect, dwOldProtect); finally obj.Free; end; end; class procedure THackGrid.Unhook; var obj: TObject; vmt, vmtIndex: Integer; method: Pointer; dwOldProtect: DWORD; begin if GOldSetColumnAttributes = nil then Exit; obj := TDBGrid.Create(nil); try vmt := PInteger(obj)^; asm MOV vmtIndex,VMTOFFSET TDBGridAccess.SetColumnAttributes; end; method := Pointer(vmt + vmtIndex); VirtualProtect(method, 4, PAGE_READWRITE, dwOldProtect); PPointer(method)^ := GOldSetColumnAttributes; VirtualProtect(method, 4, dwOldProtect, dwOldProtect); finally obj.Free; GOldSetColumnAttributes := nil; end; end; class procedure THackGrid.NewSetColumnAttributes; var Grid: Pointer; begin asm MOV Grid,EAX CALL GOldSetColumnAttributes end; with TDBGridAccess(Grid) do if (dgIndicator in Options) and (GIndicatorWidth > DBGrids.IndicatorWidth) then ColWidths[0] := GIndicatorWidth; end; class procedure THackGrid.DrawOrds(Sender: TObject; AState: TGridDrawState); var FrameOffs: Integer; R: TRect; begin with TDBGridAccess(Sender) do begin R := CellRect(0, DataLink.ActiveRecord+1); if (gdFixed in AState) and ([dgRowLines, dgColLines] * Options = [dgRowLines, dgColLines]) then FrameOffs := 1 else FrameOffs := 2; R.Right := R.Right - 6{FIndicator.Width} - FrameOffs - 2; DrawText(Canvas.Handle, PChar(IntToStr(DataLink.ActiveRecord+1)), -1, R, DT_RIGHT or DT_VCENTER or DT_SINGLELINE); end; end; end. 使用: procedure TForm1.FormCreate(Sender: TObject); begin THackGrid.Hook(28); end; procedure TForm1.FormDestroy(Sender: TObject); begin THackGrid.Unhook; end; procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin with TDBGrid(Sender) do begin Canvas.Font.Color := clBlack; if DataCol = 0 then // 一行只画一次 begin Canvas.Brush.Color := clBtnFace; THackGrid.DrawOrds(Sender, State); end; DefaultDrawColumnCell(Rect, DataCol, Column, State); end; end; 2006-1-23 16:24:07 7.显示行号(2)上面的代码在数据记录数<DBGrid显示行数的时候才有效,汗! 下 面的代码经测试基本可行,不过在数据集执行Last,当前记录已经在最后一条并且Eof=True时,再Insert插入,显示的行号比实际的大1,主要 在判断是Insert插入还是Append添加的操作是通过判断Eof进行的,这就会导致误判,其他情况目前还没有发现显示不正确的。 unit MyGrid; interface uses Windows, Messages, Classes, SysUtils, DB, Grids, DBGrids; type TMyDBGrid = class(TDBGrid) private FIndicatorWidth: Integer; FFirstRecNo: Integer; FOldBeforeInsert: TDataSetNotifyEvent; procedure DataSetBeforeInsert(DataSet: TDataSet); function GetDataSource: TDataSource; procedure SetDataSource(const Value: TDataSource); procedure SetIndicatorWidth(const Value: Integer); protected procedure DrawCell(ACol, ARow: Longint; ARect: TRect; AState: TGridDrawState); override; procedure SetColumnAttributes; override; procedure WMSize(var Message: TWMSize); message WM_SIZE; public constructor Create(AOwner: TComponent); override; published property IndicatorWidth: Integer read FIndicatorWidth write SetIndicatorWidth default 28; property DataSource: TDataSource read GetDataSource write SetDataSource; end; implementation { TMyDBGrid } constructor TMyDBGrid.Create(AOwner: TComponent); begin inherited Create(AOwner); FIndicatorWidth := 28; end; procedure TMyDBGrid.DataSetBeforeInsert(DataSet: TDataSet); var iRow: Integer; begin iRow := Row; if dgTitles in Options then Dec(iRow); FFirstRecNo := DataSet.RecNo - iRow; if Assigned(FOldBeforeInsert) then FOldBeforeInsert(DataSet); end; procedure TMyDBGrid.DrawCell(ACol, ARow: Integer; ARect: TRect; AState: TGridDrawState); var OldActive, iRow, RowNo: Integer; begin inherited DrawCell(ACol, ARow, ARect, AState); if (dgIndicator in Options) then begin Dec(ACol); if dgTitles in Options then Dec(ARow); if Assigned(DataLink) and DataLink.Active and (ACol < 0) and (ARow >= 0) then begin if DataLink.DataSet.State = dsInsert then begin if DataLink.DataSet.Eof then // Append begin iRow := Row; if dgTitles in Options then Dec(iRow); RowNo := DataLink.DataSet.RecordCount - iRow + ARow + 1 end else // Insert RowNo := FFirstRecNo + ARow; end else begin OldActive := DataLink.ActiveRecord; try DataLink.ActiveRecord := ARow; RowNo := DataSource.DataSet.RecNo; finally DataLink.ActiveRecord := OldActive; end; end; ARect.Right := ARect.Right - 6{FIndicator.Width} - 2{FrameOffs} - 2{Space}; DrawText(Canvas.Handle, PChar(IntToStr(RowNo)), -1, ARect, DT_RIGHT or DT_VCENTER or DT_SINGLELINE); end; end; end; function TMyDBGrid.GetDataSource: TDataSource; begin Result := inherited DataSource; end; procedure TMyDBGrid.SetColumnAttributes; begin inherited; if (dgIndicator in Options) then ColWidths[0] := FIndicatorWidth; end; procedure TMyDBGrid.SetDataSource(const Value: TDataSource); begin if Assigned(DataSource) and Assigned(DataSource.DataSet) then DataSource.DataSet.BeforeInsert := FOldBeforeInsert; if Assigned(Value) and Assigned(Value.DataSet) then begin FOldBeforeInsert := Value.DataSet.BeforeInsert; Value.DataSet.BeforeInsert := DataSetBeforeInsert; end else FOldBeforeInsert := nil; inherited DataSource := Value; end; procedure TMyDBGrid.SetIndicatorWidth(const Value: Integer); begin if FIndicatorWidth <> Value then begin FIndicatorWidth := Value; if (dgIndicator in Options) then ColWidths[0] := FIndicatorWidth; end; end; procedure TMyDBGrid.WMSize(var Message: TWMSize); var OldRow: Integer; begin OldRow := Row; inherited; FFirstRecNo := FFirstRecNo - (Row - OldRow); end; end. 测试代码: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, ADODB, ExtCtrls, DBCtrls, Grids, DBGrids, StdCtrls; type TForm1 = class(TForm) DBNavigator1: TDBNavigator; ADOConnection1: TADOConnection; ADOTable1: TADOTable; DataSource1: TDataSource; Button1: TButton; Label1: TLabel; Panel1: TPanel; procedure FormCreate(Sender: TObject); procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation uses MyGrid; {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin with TMyDBGrid.Create(Self) do begin Parent := Panel1; Align := alClient; IndicatorWidth := 40; Options := Options - [dgTitles]; DataSource := DataSource1; end; ADOTable1.Open; Label1.Caption := IntToStr(ADOTable1.RecordCount); end; procedure TForm1.Button1Click(Sender: TObject); begin ADOTable1.Append; end; end. |
相关推荐
2021英伟达暑期实习面经(芯片设计)
2021英伟达暑期实习面经(芯片设计前端/DFT) 准备了将近一个月,终于赶在三月的最后一天拿到了offer,暑期实习算是上岸了,后面还有阿里/华为等一些国内公司的面试,但既然拿到了nv的offer,后面的先就当积累面试经验吧~ 网上关于nv的实习or秋招面经很少,硬件岗的更少(约等于没有好吧)。之前准备面试的时候,在网上找了半天,好像就只在牛客网上见过一篇关于nv硬件岗的面经,幸好当时认真看了哈哈。所以既然幸运上岸了,想趁自己还记得,record一下,希望可以帮到有缘人呀~ 好了,废话不多说,开始正题。
怎么获取DBGrid Cell坐标
The code to show over what cell in a DBGrid the cursor is, and how to change the cursor over the tite bar: ~~~~~~~~~~~~~~~~~~~~~~~~~ procedure TForm1.GridMouseMove (Sender: TObject; Shift: TShiftS
World Action Model:经典论文
郑困时,图prorpt为机量人压务时,退过驱制解弱词表(constrsinsd decoding), 强附模型只从.256个者动作token中保H, B象总注活地。始VLA之一,RT-2使用了大量的五联网VQ据与少里的机械网的AcSonDat行CoFine-Tunng, 独组sl, 共i744个episode,Mous使用三个专累模,分是vidogonmedel,actonesget,understandng。包的核定之的的观到沟血黄动作,预之后现(vorlemodel),tseing,2。
DBGrid 使用大全
在 Delphi 语言的数据库编程中,DBGrid 是显示数据的主要手段之一。但是 DBGrid 缺省的外观未免显得单调和缺乏创意。其实,我们完全可以在我们的程序中通过编程来达到美化DBGrid 外观的目的。通过编程,我们可以改变 DBGrid 的表头、网格、网格线的前景色和背景色,以及相关的字体的大小和风格。 以下的示例程序演示了对 DBGrid 各属性的设置,使 Delphi 显示的表格就
解决AutoDock与Python版本冲突导致的内存泄漏问题:从BHtree *错误到环境配置优化
本文深入解析了AutoDock分子对接中常见的‘BHtree *’内存泄漏错误,其根源在于SWIG接口模块与Python运行环境的版本不匹配。文章提供了根治方案:通过构建Python 2.5.4与MGLTools 1.5.6的黄金兼容组合,并详细指导环境清理、安装配置及实战测试,从而彻底解决该内存泄漏问题,确保AutoDock工作流的稳定运行。
用VINS-Fusion跑通EuRoC数据集:Ubuntu22.04+ROS2环境下的保姆级评测指南
本文详细介绍了在Ubuntu22.04和ROS2 Humble环境下使用VINS-Fusion处理EuRoC数据集的完整流程。从环境配置、数据集转换到参数调优和性能评估,提供了一套全面的多传感器融合分析方案,帮助开发者在无人机精准定位场景中实现高效部署与优化。
DBGrid使用全书(四)
DbGrid控件的标题栏弹出菜单procedure TFrmOrderPost.DbgOrderPostMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);var CurPost:TPoint;begin GetCursorPos(CurPost);//获得鼠标当前坐标 if
从想法到零件:手把手拆解一个汽车功能如何从PRD写到SSTS和CTS
本文详细拆解了汽车电子需求从市场文档(MRD)到零部件技术规范(CTS)的完整流程,以雨天自动关窗功能为例,展示了PRD、SSTS和CTS的编写要点与交互设计。文章重点解析了系统分解的艺术和零部件落地的精确参数要求,为汽车电子工程师提供了从概念到实现的全流程实践指南。
DBGrid显示行号的几种方法
先在DataSet控件的加号点开,在里面的fields点右键add all fields,然后再右键new fields,这里添加一个数据表里没有的字段比如NO,这个NO字段设置为Integer,下面设置为calculated,确定,然后在这个NO字段的事件OnGetText里面添加这个代码: int r=Sender->DataSet->RecNo; Text=(
基于近邻列表法的团簇识别与冷凝成核分析(Matlab+Ovito)
本文将介绍如何使用Matlab和Ovito软件进行近邻列表法的团簇识别和冷凝成核分析,并提供相应的源代码。Ovito还提供了丰富的可视化功能,如颗粒渲染、团簇着色、团簇大小统计等,方便我们对冷凝成核现象进行可视化分析。通过使用Matlab和Ovito软件,我们可以方便地进行团簇识别和冷凝成核分析,并对系统中的冷凝行为进行研究和可视化展示。通过识别团簇,我们可以分析系统中的冷凝成核现象,即小团簇的形成和演化过程。通过统计团簇的大小,我们可以得到团簇大小大于等于10的团簇数目,这被认为是冷凝成核的现象。
YOLOv8【第十章:多任务扩展深度篇·第18节】不规则工业缺陷分割——针对划痕、裂纹的 Seg 模型调优!
🏆 本文收录于 《YOLOv8实战:从入门到深度优化》 专栏。该专栏系统复现并梳理全网各类 YOLOv8 改进与实战案例(当前已覆盖分类 / 检测 / 分割 / 追踪 / 关键点 / OBB 检测等方向),坚持持续更新 + 深度解析,质量分长期稳定在 97 分以上,可视为当前市面上 覆盖较全、更新较快、实战导向极强 的 YOLO 改进系列内容之一。
delphi学习点滴——DBGrid的实用技巧
1.隔行不同颜色显示 with TDBGrid(Sender) do begin if (gdSelected in State) or (gdFocused in State) then Canvas.Brush.Color := clAqua else if DataSource.DataSet.RecNo mod 2 = 0 then Canvas.Brush.Color :=
Qt之自定义QToolTip,去掉显示动画和隐藏延时
先来看看Qt原生QToolTip的缺点:1.当提示内容无变化时,弹窗无法移动。只能先传个空字符串强制弹窗隐藏,然后在新位置再传个字符串。2.默认显示10多秒才消失,当然这个时间是可以设置的,但是如果我想一直显示呢?总不能设置一个超级大的时间吧。3.鼠标移出控件后(调用QToolTip::showText时传入了控件指针)默认300毫秒弹窗才隐藏。而且这个时间没法设置,如果想立即隐藏就没办法了。
Dbgrid使用技巧(上)
在 Delphi 语言的数据库编程中,DBGrid 是显示数据的主要手段之一。但是 DBGrid 缺省的外观未免显得单调和缺乏创意。其实,我们完全可以在我们的程序中通过编程来达到美化DBGrid 外观的目的。通过编程,我们可以改变 DBGrid 的表头、网格、网格线的前景色和背景色,以及相关的字体的大小和风格。 以下的示例程序演示了对 DBGrid 各属性的设置,使 Delphi 显
lwip-2.0.3
lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。
IMSL CNL 7.0.0 (x86-64)Crack
IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件
Dbgrid使用技巧(下)-
Dbgrid使用技巧(下)- - 二、建立项目,实现功能 1.新建一项目,并为表单添加相关控件,各控件主要属性如下表: 2.建立各Click的事件代码 Button1(打开表)的Click事件代码如下: procedure TForm1.Button1Click(Sender: TObject); begin
ssm框架搭建
这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载
Dbgrid使用技巧(下)
Dbgrid使用技巧(下) 二、建立项目,实现功能 1.新建一项目,并为表单添加相关控件,各控件主要属性如下表: 2.建立各Click的事件代码 Button1(打开表)的Click事件代码如下: procedure TForm1.Button1Click(Sender: TObject); begin Tabl
STM32F407中文手册
STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。
DBGrid相关技术整理
DBGrid相关技术整理;注:对于DBGrid相关属性、方法的学习融入到技术整理过程中一,多选设置属性: Options->dgMultiSelect = True; ->dgRowSelect = True;应用属性: SelectedRows;操作方法: -Ctrl + Mouse Clicks -Shift + Arro
Delphi 技巧集锦一 (DBGrid的操作)
1、读取表格中(DBGrid)一行的各列的值 第一种 Edit.text:= DBGrid1.Columns.Grid.Fields[i].Text; ....... Edit.text:= DBGrid1.Columns.Grid.Fields[n].Text; 如果一个表格连接两个以上表的话,这种方法通用性更好一些。 第二种(如果由ADOTable3连接) edit1....
DBGrid应用
在Delphi语言数据库编程中,DBGrid是显示数据的常用控件之一,下面来介绍一些DBGrid的用法。 1. 获取DBGrid选中单元格的一些信息 procedure TForm2.DBGrid1CellClick(Column: TColumn); var strValue:string; iCol,iRow:Integer; rRect:TRect; beg...
数据网格自动适应宽度 dbgrid应用二
数据网格自动适应宽度 ///////源代码开始uses Math; function DBGridRecordSize(mColumn: TColumn): Boolean;{ 返回记录数据网格列显示最大宽度是否成功 }begin Result := False; if not Assigned(mColumn.Field) then Exit; mColumn.Field.Tag :...
DBGrid 应用全书
DBGrid 应用全书 {***********************************************************************} {*在 Delphi 语言的数据库编程中,DBGrid 是显示数据的主要手段之一。 {*但是 DBGrid 缺省的外观未免显得单调和缺乏创意。其实,我们完全可 {*以在我们的程序中通过编程来达到美化DBGrid 外观的目的。
delphi中的dbgrid使用
新手,还在熟悉,这段时间dbgrid用的比较多,刚开始的时候也是找了很多资料,现在整理了一下,有需要的就拿去看看,做个参考,O(∩_∩)O~ dbgrid连接数据库我就不说了。 1.dbgrid设置标题栏 通常在使用的时候,标题栏使用中文命名的,但是数据库的字段名都是英文,不做修改的话,很不方便,我们可以给dbgrid添加column,将column的fieldname设置为字段名,capt...
DBGrid1
A、ShowMessage(IntToStr(Column.Index)); B、ShowMessage(IntToStr(dbgrid1.SelectedField.Index)); 1、得到当前格子中的内容: DBGrid1.Fields[DBGrid1.SelectedIndex].DisplayText; 把DBGrid1.SelectedIndex改为你所希望引用的字段...
如何在DBGrid的每一行前加一个单选框?
Unit Unit1;InterfaceUses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, DBGrids, DB, ADODB;Type TForm1 = Class(TForm) DataSource1: TDataSource;
C++建立数据库VCL
随着数据库的广泛应用,数据库编程已经成为程序设计中发展迅猛的一支。C++ Builder在数据库开发方面具有的强大功能是无可比拟的,你甚至可以不写一行程序就生成漂亮的数据库程序。 下面对C++Builder中的几个数据库VCL的使用技巧做一下介绍: 一、DBGrid控件 1.设置DBGrid的字段显示宽度属性 为了在DBGrid中建立较小的列,你必须建立一个显示标题
1万+




被折叠的 条评论
为什么被折叠?



