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
-------------------------------------------------------------------------------------------------------------