网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 网络学院 >> 程序设计 >> Delphi编程 >> 文章正文
  CxGrid ,自动行号            【字体:
CxGrid ,自动行号
作者:佚名    文章来源:不详    点击数:    更新时间:2007-9-12    
正在装载数据……

unit Unit3;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
  cxEdit, DB, cxDBData, cxGridCustomTableView, cxGridTableView,
  cxGridDBTableView, ADODB, cxGridLevel, cxClasses, cxControls,
  cxGridCustomView, cxGrid, cxLookAndFeels;

type
  TForm3 = class(TForm)
    cxgrdbtblvwGrid1DBTableView1: TcxGridDBTableView;
    cxgrdlvlGrid1Level1: TcxGridLevel;
    cxgrd1: TcxGrid;
    qry1: TADOQuery;
    ds1: TDataSource;
    cxgrdbclmnGrid1DBTableView1job_id: TcxGridDBColumn;
    cxgrdbclmnGrid1DBTableView1job_desc: TcxGridDBColumn;
    cxgrdbclmnGrid1DBTableView1min_lvl: TcxGridDBColumn;
    cxgrdbclmnGrid1DBTableView1max_lvl: TcxGridDBColumn;
    cxgrdbclmnGrid1DBTableView1bit: TcxGridDBColumn;
    cxStyleRepository1: TcxStyleRepository;
    styleSelected: TcxStyle;
    styleNormal: TcxStyle;
    LookAndFeelController: TcxLookAndFeelController;
    procedure cxgrdbtblvwGrid1DBTableView1CustomDrawIndicatorCell(
      Sender: TcxGridTableView; ACanvas: TcxCanvas;
      AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form3: TForm3;

implementation

uses
  cxLookAndFeelPainters;

{$R *.dfm}

procedure TForm3.cxgrdbtblvwGrid1DBTableView1CustomDrawIndicatorCell(
  Sender: TcxGridTableView; ACanvas: TcxCanvas;
  AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
var
  AIndicatorViewInfo: TcxGridIndicatorRowItemViewInfo;
  ATextRect: TRect;
  AStyle: TcxStyle;
begin
  if not (AViewInfo is TcxGridIndicatorRowItemViewInfo) then
    Exit;
  ATextRect := AViewInfo.ContentBounds;
  AIndicatorViewInfo := AViewInfo as TcxGridIndicatorRowItemViewInfo;
  InflateRect(ATextRect, -2, -1);
  if AIndicatorViewInfo.GridRecord.Selected then
    AStyle := styleSelected
  else
    AStyle := styleNormal;
  Sender.LookAndFeelPainter.DrawHeader(ACanvas, AViewInfo.ContentBounds,
    ATextRect, [], cxBordersAll, cxbsNormal, taCenter, vaCenter,
    False, False, IntToStr(AIndicatorViewInfo.GridRecord.Index + 1),
    AStyle.Font, AStyle.TextColor, AStyle.Color);
  ADone := True;
end;

end.

---------------------------------------------------------------------------------------------------------------
object Form3: TForm3
  Left = 0
  Top = 0
  Caption = 'Form3'
  ClientHeight = 343
  ClientWidth = 669
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object cxgrd1: TcxGrid
    Left = 0
    Top = 0
    Width = 669
    Height = 343
    Align = alClient
    TabOrder = 0
    ExplicitLeft = -10
    ExplicitTop = 12
    object cxgrdbtblvwGrid1DBTableView1: TcxGridDBTableView
      NavigatorButtons.ConfirmDelete = False
      DataController.DataSource = ds1
      DataController.Summary.DefaultGroupSummaryItems = <>
      DataController.Summary.FooterSummaryItems = <>
      DataController.Summary.SummaryGroups = <>
      OptionsView.Indicator = True
      OptionsView.IndicatorWidth = 40
      OnCustomDrawIndicatorCell = cxgrdbtblvwGrid1DBTableView1CustomDrawIndicatorCell
      object cxgrdbclmnGrid1DBTableView1job_id: TcxGridDBColumn
        DataBinding.FieldName = 'job_id'
      end
      object cxgrdbclmnGrid1DBTableView1job_desc: TcxGridDBColumn
        DataBinding.FieldName = 'job_desc'
      end
      object cxgrdbclmnGrid1DBTableView1min_lvl: TcxGridDBColumn
        DataBinding.FieldName = 'min_lvl'
      end
      object cxgrdbclmnGrid1DBTableView1max_lvl: TcxGridDBColumn
        DataBinding.FieldName = 'max_lvl'
      end
      object cxgrdbclmnGrid1DBTableView1bit: TcxGridDBColumn
        DataBinding.FieldName = 'bit'
      end
    end
    object cxgrdlvlGrid1Level1: TcxGridLevel
      GridView = cxgrdbtblvwGrid1DBTableView1
    end
  end
  object qry1: TADOQuery
    Active = True
    ConnectionString =
      'Provider=SQLOLEDB.1;Password=sa;Persist Security Info=True;User ' +
      'ID=sa;Initial Catalog=pubs;Data Source=.'
    CursorType = ctStatic
    Parameters = <>
    SQL.Strings = (
      'select * from jobs')
    Left = 255
    Top = 238
  end
  object ds1: TDataSource
    DataSet = qry1
    Left = 297
    Top = 239
  end
  object cxStyleRepository1: TcxStyleRepository
    Left = 294
    Top = 197
    object styleSelected: TcxStyle
      AssignedValues = [svFont, svTextColor]
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = [fsBold]
      TextColor = clRed
    end
    object styleNormal: TcxStyle
    end
  end
  object LookAndFeelController: TcxLookAndFeelController
    Kind = lfOffice11
    Left = 253
    Top = 197
  end
end
-------------------------------------------------------------------------------------------------------------

 




本文来源:http://blog.csdn.net/jinzhili/archive/2007/08/09/1733533.aspx
站内文章搜索 高级搜索
文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
     在delphi中使用xml文档有…
     初探delphi 7 中的插件编…
     delphi 2006(dexter) & …
     获得windows的版本信息。
     “序列号输入助手”源代…
     rs232串口通讯模块
     ado方式下判断数据表是否…
  • Struts2学习:在struts2中集…

  • 设计模式之--Bridge

  • Ant入门-配置和使用     选…

  • 浅析Spring框架下PropertyPl…

  • SPRING+STRUTS+HIBERNATE登录…

  • 根据sessionid找回session

  • 摘:主题:   using springmo…

  • 在spring MVC中配置多个视图

  • 看完了第二遍C++Primer,学习…

  • Solaris10下,使用SunStudio…

  •   网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    网络学院©2007 www.23book.net
    为您提供web编程,vb编程,vc编程,服务器架设管理,数据库设计等方面的知识 站长:David