在cxGrid表格列宽怎么设置中怎么获得当前列的字段名

如何在delphi中把主、从表cxgrid中的内容导出excel
如何在delphi中把主、从表cxgrid中的内容导出excel
09-07-31 &
忆君软件出的EjunGrid表格控件能够满足你的要求,官方网站上有提供免费下载版本&a href=&&&&/a&EjunGrid是一款类似Excel风格的高品质的表格控件,支持Delphi、ActiveX等开发方式,其 导入导出Excel 合并单元格、多表头 树表结合TreeGrid DBGrid虚拟列计算字段 自动分页打印功能 打印预览时支持鼠标拖动调整页边距、行高、列宽 支持自定义纸张大小、支持连续打印 等众多优质的功能,让EjunGrid跻身于高端表格控件之列,EjunGrid是纯Delphi表格控件,同时提供ActiveX版本,我们设计的目标是让广大软件开发者能够轻松快速开发出专业、高水准的软件产品,,使您的软件具备方便快捷的录入界面、清晰漂亮的数据显示界面、完美强大的打印预览功能、可以让您的用户在打印预览时实时方便的调整页面布局,所见即所得,操作方式与Excel完全兼容,输出的报表精美典雅                  参考资料:&a href=&&&&/a&
请登录后再发表评论!CxGrid显示数据时有多少条记录就画多表格线,其它地方为空,有没有办法可以像DbGrid一样画满
Description of your first forum.
10 篇帖子 & 分页:1 / 1
由 golove & 星期一, 日 14:37
CxGrid显示数据时有多少条记录就画多表格线,其它地方为空,有没有办法可以像DbGrid一样画满
由 yxp132 & 星期一, 日 14:49
你试一下。在OnDrawColumnCell
with dbgSecond.Canvas do
& &Pen.Color := clB
& &MoveTo(Rect.Left, Rect.Bottom);
& &LineTo(Rect.Right, Rect.Bottom);
& &Pen.Color := clG
& &MoveTo(Rect.Right, Rect.Top);
& &LineTo(Rect.Right, Rect.Bottom);
由 hongxing_dl & 星期一, 日 15:06
“有没有办法可以像DbGrid一样画满”???
没大看懂哦~~~
dbgrid也是这样的啊~~~CxGrid是什么样的??
由 golove & 星期一, 日 15:14
比如说CxGrid的数据源只有三条记录那么只画出了三个表格线,其它部分为空白,我需要他把空白的地方补全!
另楼上dbgSecond.Canvas 我怎么找不到这个属性啊
由 坚持信念 & 星期一, 日 15:16
看胜天的进小村源码就可以了。他实现DXGRID画。
由 hongxing_dl & 星期一, 日 15:17
对呀,dbgrid也是这样的啊~~~~~
他的dbgSecond.Canvas改为(Sender as TCxGrid).Canvas就可以了
由 golove & 星期一, 日 15:18
正如楼上所说俺正在研究呢,呵呵
由 golove & 星期二, 日 12:51
function DrawFullGrid(dxGrid: TdxDBG ACanvas: TC ARect: TR ANode:
&TdxTreeListNode): B
&lMaxRow: I
&Rect1: TR
&procedure DrawUltraBandButton(var ARect: TR ABrush: HBRUSH);
& &DrawEdge(ACanvas.Handle, ARect, BDR_SUNKENOUTER, BF_BOTTOM or BF_RIGHT or
& & &BF_FLAT or BF_ADJUST);
& &ACanvas.Brush.Color := AB
& &ACanvas.FillRect(ARect);
& &InflateRect(ARect, -1, 0);
&procedure DrawBandButton(var ARect: TR ABrush: HBRUSH; ALookAndFeel:
& &TdxLookAndFeel);
& &ACanvas.Brush.Color := AB
& &if ALookAndFeel = lfStandard then
& & &DrawEdge(ACanvas.Handle, ARect, BDR_RAISEDINNER, BF_BOTTOMRIGHT or
& & & &BF_ADJUST);
& & &DrawEdge(ACanvas.Handle, ARect, BDR_RAISEDINNER, BF_TOPLEFT or BF_ADJUST);
& & &ACanvas.FillRect(ARect);
& & &if ALookAndFeel = lfUltraFlat then
& & &begin
& & & &FrameRect(ACanvas.Handle, ARect, GetSysColorBrush(COLOR_BTNSHADOW));
& & & &InflateRect(ARect, -1, -1);
& & & &DrawEdge(ACanvas.Handle, ARect, BDR_RAISEDINNER, BF_RECT or BF_ADJUST);
& & &ACanvas.FillRect(ARect);
& & &InflateRect(ARect, -1, 0);
&ACanvas.L
&//计算最多画多少行
&while (ARect.Bottom - ARect.Top + 2) * i &= dxGrid.Height do
& &inc(i);
&lMaxRow := i - 3; //计算画多少行
&//开始画表格
&if ANode.Index = dxGrid.Count - 1 then //ANode.Index为当前行的 DXGrid.Count为总共有多少行,这两个属性不知道在CXGrid里怎么取出来
& &for i := 1 to lMaxRow - ANode.Index do
& & &//画表格
& & &Rect1.Top := ARect.Top - 1 + (ARect.Bottom - ARect.Top) *
& & &Rect1.Bottom := ARect.Bottom + (ARect.Bottom - ARect.Top) *
& & &Rect1.Left := ARect.Left - 1;
& & &Rect1.Right := ARect.Right + 1;
& & &ACanvas.Brush.Color := clS
& & &ACanvas.FrameRect(Rect1);
& & &//画标尺列
& & &if (edgoIndicator in dxGrid.OptionsView) then
& & &begin
& & & &Rect1.Left := 0;
& & & &Rect1.Right := 12;
& & & &Rect1.Top := Rect1.Top + 1;
& & & &if i = 1 then
& & & & &Rect1.Top := Rect1.Top + 1;
& & & &if dxGrid.LookAndFeel = lfUltraFlat then
& & & & &DrawUltraBandButton(Rect1, dxGrid.HeaderColor)
& & & &else
& & & & &DrawBandButton(Rect1, dxGrid.HeaderColor, dxGrid.LookAndFeel);
&ACanvas.U
&Result := T
ANode.Index为当前行的 DXGrid.Count为总共有多少行,这两个属性不知道在CXGrid里怎么取出来
由 golove & 星期二, 日 13:07
AViewInfo.GridRecord.Index
Sender.ViewData.RecordCount
由 golove & 星期二, 日 13:46
unit Unit1;
&Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
&Dialogs, Grids, DBGrids, DB, cxGraphics,cxGridLevel, cxClasses, cxControls,
&cxGridCustomView, cxGridCustomTableView, cxGridTableView,
&cxGridDBTableView, cxGrid, ExtCtrls, ADODB, QLDBLkp, cxStyles,
&cxStorage,
&cxGridCommon,
&cxCustomData, cxData,cxEdit,cxLookAndFeels, StdC
&TForm1 = class(TForm)
& &Panel1: TP
& &cxGrid1: TcxG
& &gridMain: TcxGridDBTableV
& &cxGrid1Level1: TcxGridL
& &DataSource1: TDataS
& &ADOConnection1: TADOC
& &ADOTable1: TADOT
& &ADOTable2: TADOT
& &DataSource2: TDataS
& &cxStyleRepository1: TcxStyleR
& &cxStyle1: TcxS
& &cxStyle2: TcxS
& &cxStyleRepository2: TcxStyleR
& &cxStyle3: TcxS
& &gridMainid: TcxGridDBC
& &gridMaindt: TcxGridDBC
& &gridMaincode: TcxGridDBC
& &Memo1: TM
& &procedure gridMainCustomDrawCell(Sender: TcxCustomGridTableV
& & &ACanvas: TcxC AViewInfo: TcxGridTableDataCellViewI
& & &var ADone: Boolean);
& &private
& &{ Private declarations }
&function DrawFullGrid(GridTableView: TcxCustomGridTableV ACanvas: TcxC &AViewInfo: TcxGridTableDataCellViewInfo): B
&protected
& { Public declarations }
&Form1: TForm1;
implementation
{$R *.dfm}
function TForm1.DrawFullGrid(GridTableView: TcxCustomGridTableV
&ACanvas: TcxC
& AViewInfo: TcxGridTableDataCellViewInfo): B
&lMaxRow: I
&Rect1: TR
&procedure DrawUltraBandButton(var ARect: TR ABrush: HBRUSH);
& &DrawEdge(ACanvas.Handle, ARect, BDR_SUNKENOUTER, BF_BOTTOM or BF_RIGHT or
& & &BF_FLAT or BF_ADJUST);
& &ACanvas.Brush.Color := AB
& &ACanvas.FillRect(ARect);
& &InflateRect(ARect, -1, 0);
&procedure DrawBandButton(var ARect: TR ABrush: HBRUSH; ALookAndFeel:
& &TCxLookAndFeel);
& &ACanvas.Brush.Color := AB
& &if ALookAndFeel.Kind = lfStandard then
& & &DrawEdge(ACanvas.Handle, ARect, BDR_RAISEDINNER, BF_BOTTOMRIGHT or
& & & &BF_ADJUST);
& & &DrawEdge(ACanvas.Handle, ARect, BDR_RAISEDINNER, BF_TOPLEFT or BF_ADJUST);
& & &ACanvas.FillRect(ARect);
& & &if ALookAndFeel.Kind = lfUltraFlat then
& & &begin
& & & &FrameRect(ACanvas.Handle, ARect, GetSysColorBrush(COLOR_BTNSHADOW));
& & & &InflateRect(ARect, -1, -1);
& & & &DrawEdge(ACanvas.Handle, ARect, BDR_RAISEDINNER, BF_RECT or BF_ADJUST);
& & &ACanvas.FillRect(ARect);
& & &InflateRect(ARect, -1, 0);
&ACanvas.Canvas.L
&//计算最多画多少行
&while (AViewInfo.editBounds.Bottom - AViewInfo.editBounds.Top + 2) * i &=cxGrid1.Height do
& &inc(i);
&lMaxRow := i - 3; //计算画多少行
& //开始画表格
&if AViewInfo.GridRecord.Index = GridTableView.ViewData.RecordCount - 1 then
& &for i := 1 to lMaxRow - AViewInfo.GridRecord.Index do
& & &//画表格
& & &Rect1.Top := AViewInfo.EditBounds.Top - 1 + (AViewInfo.EditBounds.Bottom - AViewInfo.EditBounds.Top) *
& & &Rect1.Bottom := AViewInfo.EditBounds.Bottom + (AViewInfo.EditBounds.Bottom - AViewInfo.EditBounds.Top) *
& & &Rect1.Left := AViewInfo.EditBounds.Left - 1;
& & &Rect1.Right := AViewInfo.EditBounds.Right + 1;
& & &ACanvas.Canvas.Brush.Color := clS
& & &ACanvas.Canvas.FrameRect(Rect1);
& & &memo1.Lines.Add('Rect1.Top:'+InttoStr(Rect1.Top));
& & &memo1.Lines.Add('Rect1.Bottom: '+InttoStr(Rect1.Bottom ));
& & &memo1.Lines.Add('Rect1.Left:'+InttoStr(Rect1.Left));
& & &memo1.Lines.Add('Rect1.Right:'+InttoStr(Rect1.Right));
& & &memo1.Lines.Add('I:'+InttoStr(i));
& & &memo1.Lines.Add('lMaxRow:'+InttoStr(lMaxRow));
& & &//画标尺列
// & & &if (Indicator in Sender.OptionsView) then
// & & &begin
// & & & &AViewInfo.Bounds.Left := 0;
// & & & &AViewInfo.Bounds.Right := 12;
// & & & &AViewInfo.Bounds.Top := AViewInfo.Bounds.Top + 1;
& & & // if i = 1 then
// & & & & &AViewInfo.Bounds.Top := AViewInfo.Bounds.Top + 1;
// & & & &if cxGrid1.LookAndFeel.Kind = lfUltraFlat then
// & & & & &DrawUltraBandButton(AViewInfo.Bounds, AViewInfo.Style.Color)
// & & & &else
// & & & & &DrawBandButton(AViewInfo.Bounds, AViewInfo.Style.Color, cxGrid1.LookAndFeel);
// & & &//
&ACanvas.Canvas.U
&Result:=T
procedure TForm1.gridMainCustomDrawCell(Sender: TcxCustomGridTableV
&ACanvas: TcxC AViewInfo: TcxGridTableDataCellViewI
&var ADone: Boolean);
&//ADone:=
&DrawFullGrid(Sender,ACanvas,AViewInfo);
哪位帮我看一下这段程序有什么问题,我执行出来的结果,看着他在那画表格,但马上就没有了???
10 篇帖子 & 分页:1 / 1温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
larger than life
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
阅读(3990)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_',
blogTitle:'cxgrid数据导出到Excel方法',
blogAbstract:'cxgrid数据导出到Excel方法,ExportGrid4ToExcel的详细解读',
blogTag:'delphi,技术探索',
blogUrl:'blog/static/8537299',
isPublished:1,
istop:false,
modifyTime:2,
publishTime:8,
permalink:'blog/static/8537299',
commentCount:0,
mainCommentCount:0,
recommendCount:0,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'larger than life',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}&>&delphi Cxgrid表格
delphi Cxgrid表格
上传大小:2.78MB
Cxgrid 数据录入
行号自动添加
综合评分:4(1位用户评分)
所需积分/C币:
下载个数:18
{%username%}回复{%com_username%}{%time%}\
/*点击出现回复框*/
$(".respond_btn").on("click", function (e) {
$(this).parents(".rightLi").children(".respond_box").show();
e.stopPropagation();
$(".cancel_res").on("click", function (e) {
$(this).parents(".res_b").siblings(".res_area").val("");
$(this).parents(".respond_box").hide();
e.stopPropagation();
/*删除评论*/
$(".del_comment_c").on("click", function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_invalid/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parents(".conLi").remove();
alert(data.msg);
$(".res_btn").click(function (e) {
var q = $("#form1").serializeArray();
console.log(q);
var res_area_r = $.trim($(".res_area_r").val());
if (res_area_r == '') {
$(".res_text").css({color: "red"});
$.post("/index.php/comment/do_comment_reply/", q,
function (data) {
if (data.succ == 1) {
var $target,
evt = e || window.
$target = $(evt.target || evt.srcElement);
var $dd = $target.parents('dd');
var $wrapReply = $dd.find('.respond_box');
console.log($wrapReply);
var mess = $(".res_area_r").val();
var str = str.replace(/{%header%}/g, data.header)
.replace(/{%href%}/g, 'http://' + window.location.host + '/user/' + data.username)
.replace(/{%username%}/g, data.username)
.replace(/{%com_username%}/g, _username)
.replace(/{%time%}/g, data.time)
.replace(/{%id%}/g, data.id)
.replace(/{%mess%}/g, mess);
$dd.after(str);
$(".respond_box").hide();
$(".res_area_r").val("");
$(".res_area").val("");
$wrapReply.hide();
alert(data.msg);
}, "json");
/*删除回复*/
$(".rightLi").on("click",'.del_comment_r', function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_comment_del/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parent().parent().parent().parent().parent().remove();
$(e.target).parents('.res_list').remove()
alert(data.msg);
//填充回复
function KeyP(v) {
$(".res_area_r").val($.trim($(".res_area").val()));
评论共有1条
没有数据库结构
审核通过送C币
Delphi 1.0~7.0合集+文章+代码+控件
创建者:caozhy
Borland Delphi合集
创建者:wuwei666888
Delphi编程
创建者:zang
上传者其他资源上传者专辑
Java访问数据库
出租车GPS管理系统
双链表插入
delphi触发器
DBGird显示不同颜色源代码
开发技术热门标签
VIP会员动态
下载频道积分规则调整V1710.18
CSDN下载频道积分调整公告V1710.17
开通VIP,海量IT资源任性下载
spring mvc+mybatis+mysql+maven+bootstrap 整合实现增删查改简单实例.zip
CSDN&VIP年卡&4000万程序员的必选
为了良好体验,不建议使用迅雷下载
delphi Cxgrid表格
会员到期时间:
剩余下载个数:
剩余C币:200
剩余积分:6726
为了良好体验,不建议使用迅雷下载
积分不足!
资源所需积分/C币
当前拥有积分
您可以选择
程序员的必选
绿色安全资源
资源所需积分/C币
当前拥有积分
当前拥有C币
(仅够下载10个资源)
全站1200个资源免积分下载
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
全站1200个资源免积分下载
资源所需积分/C币
当前拥有积分
当前拥有C币
您的积分不足,将扣除 10 C币
全站1200个资源免积分下载
为了良好体验,不建议使用迅雷下载
你当前的下载分为234。
你还不是VIP会员
开通VIP会员权限,免积分下载
你下载资源过于频繁,请输入验证码
你下载资源过于频繁,请输入验证码
您因违反CSDN下载频道规则而被锁定帐户,如有疑问,请联络:!
若举报审核通过,可奖励20下载分
被举报人:
举报的资源分:
请选择类型
资源无法下载
资源无法使用
标题与实际内容不符
含有危害国家安全内容
含有反动色情等内容
含广告内容
版权问题,侵犯个人或公司的版权
*详细原因:
delphi Cxgrid表格CxGrid 表格列内容居中
时间: 17:46:07
&&&& 阅读:96
&&&& 评论:
&&&& 收藏:0
标签:&&&&&&&&&&&&&&&&&&&&&&&&&&&首先每一列 Cxgrid 都不知道要当成什么来出来,所以每一列都有个properties 让你来设置,告诉cxgrid 这列的内容是什么,然后根据你给出的内容 再来决定用什么居中方式;
就是说 官方再设计的时候,想的是 居中的方式与你所认为这列的内容格式有关,因为如果是字符串、数值类型,那么可以居中,如果是个进度条呢,那么就没有必要居中;如果是图片呢,等等;
不同的格式的居中方式也可能不同,所以官方先让你设置下这列的格式属性。
如果内容是普通文本,那么你可以用TextEdit,然后展开 这个属性对应的设置内容,可以设置水平方向居中:
如果是memo的话,设置成memo,然后设置下 对应的居中。&
&标签:&&&&&&&&&&&&&&&&&&&&&&&&&&&原文:/del88/p/6705064.html
教程昨日排行
&&国之画&&&& &&&&&&
&& &&&&&&&&&&&&&&
鲁ICP备号-4
打开技术之扣,分享程序人生!

我要回帖

更多关于 数据透视表字段名并列 的文章

 

随机推荐