起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 150|回复: 6

【结】StringGrid的行合并问题**

[复制链接]
发表于 2008-4-10 10:51:52 | 显示全部楼层 |阅读模式
我要实现StringGrid的行合并,代码如下:

with StringGrid1.Canvas do
begin
     Brush.Color := graphics.clWindow;
     Font.Color := graphics.clWindowText;
     if (acol=1) or (acol=3) then
         rect.Right:=rect.Right+rect.Right-rect.Left;
     if (acol=2) or (acol=4)then
         rect.Left:=rect.Right;

     if gdFixed in State then
        Brush.Color := StringGrid1.FixedColor;
        FillRect(Rect);
     with StringGrid1 do
          TextRect(Rect, Rect.Left + 2, Rect.Top + 2, Cells[ACol, ARow]);
     if gdFixed in State then
        DrawEdge(Handle, Rect, BDR_RAISEDINNER, BF_RECT);
end;

编译出错错误:[错误]Biz:\WICCWGL\WLGL\KHWLLQGN.FUNC.DIR\KHWLLQ.Form.pas(106, 9): Undeclared identifier "gdFixed"
[错误]Biz:\WICCWGL\WLGL\KHWLLQGN.FUNC.DIR\KHWLLQ.Form.pas(111, 9): Undeclared identifier "gdFixed"

delphi 代码的贴:http://www.kfdoc.com/delphibbs2005/306/3060209.htm

大哥大姐,帮忙修改下,从delphi转到这平台,有些东西真不知道怎么变才对!!先谢过
回复

使用道具 举报

发表于 2008-4-10 12:04:15 | 显示全部楼层
有些代码在delphi 中能运行,在x3中报错
回复 支持 反对

使用道具 举报

发表于 2008-4-10 13:30:54 | 显示全部楼层
gdFixed 是怎么声明的
回复 支持 反对

使用道具 举报

发表于 2008-4-10 14:11:37 | 显示全部楼层
NameSpace: Business.Forms
--------------------------------------------------------------------------------
TGridDrawStateEnum = (gdSelected, gdFocused, gdFixed);
回复 支持 反对

使用道具 举报

发表于 2008-4-10 14:13:50 | 显示全部楼层
with StringGrid1.Canvas do
  begin
       Brush.Color := graphics.clWindow;
       Font.Color := graphics.clWindowText;
       if (acol=1) or (acol=3) then
           rect.Right:=rect.Right+rect.Right-rect.Left;
       if (acol=2) or (acol=4)then
           rect.Left:=rect.Right;
       if Business.Forms.TGridDrawStateEnum.gdFixed in State then
          Brush.Color := StringGrid1.FixedColor;
          FillRect(Rect);
       with StringGrid1 do
            TextRect(Rect, Rect.Left + 2, Rect.Top + 2, Cells[ACol, ARow]);
       if Business.Forms.TGridDrawStateEnum.gdFixed in State then
          Borland.Delphi.Windows.DrawEdge(Handle, Rect, Borland.Delphi.Windows.BDR_RAISEDINNER, Borland.Delphi.Windows.BF_RECT);
  end;
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-4-10 15:13:24 | 显示全部楼层
感谢 atiger和shangxy 的帮忙
问题已解决
可以结了

代码如下:
with StringGrid1.Canvas do
     begin
          Brush.Color := graphics.clWindow;
          Font.Color := graphics.clWindowText;
          if (acol=1) or (acol=3) then
              rect.Right:=rect.Right+rect.Right-rect.Left
          else
          if (acol=2) or (acol=4)then
             rect.Left:=rect.Right;

         if Business.Forms.TGridDrawStateEnum.gdFixed in State then
            Brush.Color := StringGrid1.FixedColor;
            FillRect(Rect);
         with StringGrid1 do
              TextRect(Rect, Rect.Left + 2, Rect.Top + 2, Cells[ACol, ARow]);
         if Business.Forms.TGridDrawStateEnum.gdFixed in State then
            Borland.Delphi.Windows.DrawEdge(Handle, Rect, borland.Delphi.Windows.BDR_RAISEDINNER, Borland.Delphi.Windows.BF_RECT);
     end;
回复 支持 反对

使用道具 举报

发表于 2008-4-10 15:23:16 | 显示全部楼层
ok
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-7-10 00:09 , Processed in 0.038549 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表