难道真的没有人愿意陈述一个简单的问题么,我只有15分,全部奉上了!!!!(15分)

  • 主题发起人 主题发起人 stonehuang
  • 开始时间 开始时间
S

stonehuang

Unregistered / Unconfirmed
GUEST, unregistred user!
如何将一个数据库或者一个table或者table中某一项内容倒入tstringgrid中,并且在tstringgrid
中可以自由新增/删除/修改等,若如果删除掉一记录的话,它会自动将后面的记录往上移等!!!
谢谢!!!谢谢!!!谢谢!!!谢谢!!!谢谢!!!谢谢!!!谢谢!!!谢谢!!!谢谢!!!谢谢!!!谢谢!!!
 
用TDbGrid ,用TStringGrid 需要自己处理。
读每条记录依次在 StringGrid 中添加。
 
可否给一点源代码让我参考,谢谢!!!
 
这东东做得太多了,关于 Grid 系列,我一直在自己扩展,
先是象你哪样的要求,接着是多编辑样式。都实现了,不太
繁,也不是太容易。

关键是在多选状态下的删除,有你受的。
 
用TStringGrid处理数据库的操作是相当麻烦的,
TDBGrid是已经封装好了的,为什么不用?如果功能不能实现,可以考虑一下第三方控件
如果你向ddev一样,有现成的代码,可能好处理一些,否则,真有你受的!
还是考虑一下第三方控件吧!
 
下面是一个我自己做的网格,为数据处理方便及效率考虑,
在网格中没有处理数据的存储,是参考 TCustomGrid 全部
手工实现的。

增加删除事件(一般)
procedure TadvGrid.DeleteRow(ARow: Longint);
var
Accept : Boolean;
begin
Accept := False;
if Assigned(FOnDeleteRows) then
FOnDeleteRows(Self, ARow, Accept);

if Accept and (RowCount > FFixedRows + 1) then
begin
MoveRow(ARow, RowCount - 1, False);
RowCount := RowCount - 1;
end;

if Accept and Assigned(FAfterDeleteRows) then
FAfterDeleteRows(Self, ARow);
end;


下面是一个完全的类声明部分,源文件太大了,有5000多行:

uses
Messages, Windows, SysUtils, Classes, Controls, StdCtrls, Graphics, Forms;

type
TadvGetExtents = function(Index: Longint): Integer of object;
TadvTextNotifyEvent = procedure(const s: string) of object;

TadvGridAxisDrawInfo = record
EffectiveLineWidth: Integer;
FixedBoundary: Integer;
GridBoundary: Integer;
GridExtent: Integer;
LastFullVisibleCell: Longint;
FullVisBoundary: Integer;
FixedCellCount: Integer;
FirstGridCell: Integer;
GridCellCount: Integer;
GetExtent: TadvGetExtents;
end;

TadvGridDrawInfo = record
Horz, Vert: TadvGridAxisDrawInfo;
end;

TadvGridState = (gsNormal, gsSelecting, gsRowSizing, gsColSizing, gsRowMoving, gsColMoving, gsFixedSelect);
TadvGridMovement = gsRowMoving..gsColMoving;

TadvGridOption = (goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine,
goRowSizing, goColSizing, goRowMoving, goColMoving, goEditing, goTabs,
goRowSelect, goFocusSelected, goAlwaysShowEditor, goThumbTracking,
goAutoRows, goAutoCols, goCellWrap);
TadvGridOptions = set of TadvGridOption;
TadvGridDrawState = set of (gdSelected, gdFocused, gdFixed);
TadvGridScrollDirection = set of (sdLeft, sdRight, sdUp, sdDown);

TadvGridCoord = record
X: Longint;
Y: Longint;
end;

TadvGridRect = record
case Integer of
0: (Left, Top, Right, Bottom: Longint);
1: (TopLeft, BottomRight: TadvGridCoord);
end;

TadvSelectCellEvent = procedure(Sender: TObject; ACol, ARow: Longint; var CanSelect: Boolean) of object;
TadvDrawCellEvent = procedure(Sender: TObject; ACol, ARow: Longint; Rect: TRect; State: TadvGridDrawState; var DefaultDraw: Boolean) of object;

TadvGetCellTextEvent = procedure(Sender: TObject; ACol, ARow: Longint; var Value: string) of object;
TadvSetCellTextEvent = procedure(Sender: TObject; ACol, ARow: Longint; const Value: string) of object;
TadvMovedEvent = procedure(Sender: TObject; FromIndex, ToIndex: Longint) of object;

TadvAlignment = (taLeft, taCenter, taRight);
TadvEditStyle = (esSimple, esMultiLine, esEllipsis, esDropDown, esUpDown);
TadvUpdownButton = (btUp, btDown);

TadvChangeEditStyleEvent = procedure(Sender: TObject; ACol, ARow: Longint; var EditStyle: TadvEditStyle) of object;

TadvAlignmentEvent = procedure(Sender: TObject; ACol, ARow: Longint; var Alignment: TadvAlignment) of object;

TadvUpdownChangeEvent = procedure(Sender: TObject; Button: TadvUpdownButton) of object;
TadvListChangeEvent = procedure(Sender: TObject; Strings: TStrings) of object;
TadvTextChangeEvent = procedure(Sender: TObject; var s: string) of object;
TadvExtentQueryEvent = function(Sender: TObject; ACol, ARow: Longint): Longint of object;
TadvGridCellEvent = procedure(Sender: TObject; ACol, ARow: Longint) of object;
TadvRowColNotifyEvent = procedure(Sender: TObject; Index: Longint; var Accept: Boolean) of object;
TadvGridNotifyEvent = procedure(Sender: TObject; var Accept: Boolean) of object;
TadvRowColChangedEvent = procedure(Sender: TObject; Index: Longint) of object;

{ TadvGridEdit }

TadvInplaceListBox = class(TCustomListbox)
private
FSearchText: string;
FSearchTickCount: Longint;
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWnd; override;
procedure KeyPress(var Key: Char); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
end;

TadvGrid = class;
TadvGridEdit = class(TCustomEdit)
private
FGrid: TadvGrid;
FClickTime: Longint;
FAlignment: TadvAlignment;
FEditStyle: TadvEditStyle;
FButtonWidth: Integer;
FInplaceList: TadvInplaceListBox;
FListVisible: Boolean;
FTracking: Boolean;
FPressed: Boolean;
FDropDownCount: LongInt;
FUpDownButton: TadvUpdownButton;
procedure SetGrid(Value: TadvGrid);
procedure SetAlignment(const Value: TadvAlignment);
procedure SetEditStyle(const Value: TadvEditStyle);
procedure InternalMove(const Loc: TRect; Redraw: Boolean);
procedure ListMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure StopTracking;
procedure TrackButton(X, Y: Integer);
procedure CMShowingChanged(var Message: TMessage); message CM_SHOWINGCHANGED;
procedure WMGetDlgCode(var Message: TWMGetDlgCode); message WM_GETDLGCODE;
procedure WMPaste(var Message); message WM_PASTE;
procedure WMCut(var Message); message WM_CUT;
procedure WMClear(var Message); message WM_CLEAR;
procedure WMPaint(var Message: TWMPaint); message wm_Paint;
procedure CMCancelMode(var Message: TCMCancelMode); message CM_CancelMode;
procedure WMCancelMode(var Message: TMessage); message WM_CancelMode;
procedure WMKillFocus(var Message: TMessage); message WM_KillFocus;
procedure WMLButtonDblClk(var Message: TWMLButtonDblClk); message wm_LButtonDblClk;
procedure WMSetCursor(var Message: TWMSetCursor); message WM_SetCursor;
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure DoDropDownKeys(var Key: Word; Shift: TShiftState);
procedure DblClick; override;
function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;
function EditCanModify: Boolean;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure KeyPress(var Key: Char); override;
procedure KeyUp(var Key: Word; Shift: TShiftState); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure BoundsChanged; virtual;
procedure UpdateContents; virtual;
procedure WndProc(var Message: TMessage); override;
procedure PaintWindow(DC: HDC); override;
procedure DropDown;
procedure CloseUp(Accept: Boolean);
procedure ButtonClick; dynamic;
procedure UpdownChange; dynamic;
procedure PrepareListItems(Strings: TStrings);
procedure SelectListItem(var s: string);
property Grid: TadvGrid read FGrid;
public
constructor Create(AOwner: TComponent); override;
procedure Deselect;
procedure Hide;
procedure Invalidate; reintroduce;
procedure Move(const Loc: TRect);
function PosEqual(const Rect: TRect): Boolean;
procedure SetFocus; reintroduce;
procedure UpdateLoc(const Loc: TRect);
function Visible: Boolean;
property Alignment: TadvAlignment read FAlignment write SetAlignment default taLeft;
property EditStyle: TadvEditStyle read FEditStyle write SetEditStyle default esSimple;
end;

{ TDynamicIntArray }
TadvIntegerList = class
private
FArray: array of Longint;
function Get(Index: Integer): Longint;
procedure Put(Index: Integer; const Value: Longint);
function GetCount: Longint;
procedure SetCount(const Value: Longint);
public
constructor Create;
destructor Destroy; override;

procedure Clear;
procedure Add(const N: Longint);
procedure Delete(const N: Longint);
procedure AssignTo(Arr: TadvIntegerList);
function Include(const N: Longint): Boolean;

property Count: Longint read GetCount write SetCount;
property Items[Index: Longint]: Longint read Get write Put; default;
end;

TCellGroup = record
ACol, ARow: Longint;
SpanCols, SpanRows: Longint;
end;

{ TadvGrid }
TadvGrid = class(TCustomControl)
private
FAnchor: TadvGridCoord;
FBorderStyle: TBorderStyle;
FCanEditModify: Boolean;
FColCount: Longint;
FColWidths: Pointer;
FTabStops: Pointer;
FCurrent: TadvGridCoord;
FDefaultColWidth: Integer;
FDefaultRowHeight: Integer;
FFixedCols: Integer;
FFixedRows: Integer;
FFixedColor: TColor;
FGridLineWidth: Integer;
FGridLineColor: TColor;
FOptions: TadvGridOptions;
FRowCount: Longint;
FRowHeights: Pointer;
FScrollBars: TScrollStyle;
FTopLeft: TadvGridCoord;
FSizingIndex: Longint;
FSizingPos, FSizingOfs: Integer;
FMoveIndex, FMovePos: Longint;
FHitTest: TPoint;
FInplaceEdit: TadvGridEdit;
FInplaceCol, FInplaceRow: Longint;
FColOffset: Integer;
FDefaultDrawing: Boolean;
FEditorMode: Boolean;
FOnDrawCell: TadvDrawCellEvent;
FOnGetCellText: TadvGetCellTextEvent;
FOnRowMoved: TadvMovedEvent;
FOnColumnMoved: TadvMovedEvent;
FOnTopLeftChanged: TNotifyEvent;
FOnSelectCell: TadvSelectCellEvent;
FOnSetCellText: TadvSetCellTextEvent;
FMultiSelect: Boolean;
FFixedDarkColor: TColor;
FHighLightColor: TColor;
FHighLightTextColor: TColor;
FExtendSelections: TadvIntegerList; //存储当前行以外的选择行
FMergeList: TList;
FOnEditChange: TadvTextNotifyEvent;
FOnChangeCellAlignment: TadvAlignmentEvent;
FOnChangeEditStyle: TadvChangeEditStyleEvent;
FOnEditButtonClick: TNotifyEvent;
FOnPrepareListItems: TadvListChangeEvent;
FOnSelectListItem: TadvTextChangeEvent;
FOnUpdownChange: TadvUpdownChangeEvent;
FOnChangeEditLimit: TadvExtentQueryEvent;
FOnFixedCellClick: TadvGridCellEvent;
FOnFixedMouseDown: TMouseEvent;
FOnFixedMouseUp: TMouseEvent;
FOnDeleteRows: TadvRowColNotifyEvent;
FOnInsertRows: TadvRowColNotifyEvent;
FFocusColor: TColor;
FOnAppendRows: TadvGridNotifyEvent;
FAfterDeleteRows: TadvRowColChangedEvent;
FAfterInsertRows: TadvRowColChangedEvent;
FAfterAppendRows: TadvRowColChangedEvent;
FEditLimit: Longint;
function CalcCoordFromPoint(X, Y: Integer; const DrawInfo: TadvGridDrawInfo): TadvGridCoord;
procedure CalcDrawInfoXY(var DrawInfo: TadvGridDrawInfo; UseWidth, UseHeight: Integer);
function CalcMaxTopLeft(const Coord: TadvGridCoord; const DrawInfo: TadvGridDrawInfo): TadvGridCoord;
procedure CancelMode;
procedure ChangeGridOrientation(RightToLeftOrientation: Boolean);
procedure ChangeSize(NewColCount, NewRowCount: Longint);
procedure ClampInView(const Coord: TadvGridCoord);
procedure DrawSizingLine(const DrawInfo: TadvGridDrawInfo);
procedure DrawMove;
procedure FocusCell(ACol, ARow: Longint; MoveAnchor: Boolean);
procedure GridRectToScreenRect(GridRect: TadvGridRect; var ScreenRect: TRect; IncludeLine: Boolean);
procedure HideEdit;
procedure Initialize;
procedure ModifyScrollBar(ScrollBar, ScrollCode, Pos: Cardinal; UseRightToLeft: Boolean);
procedure MoveAdjust(var CellPos: Longint; FromIndex, ToIndex: Longint);
procedure MoveAnchor(const NewAnchor: TadvGridCoord);
procedure MoveAndScroll(Mouse, CellHit: Integer; var DrawInfo: TadvGridDrawInfo;
var Axis: TadvGridAxisDrawInfo; Scrollbar: Integer; const MousePt: TPoint);
procedure MoveCurrent(ACol, ARow: Longint; MoveAnchor, Show: Boolean);
procedure MoveTopLeft(ALeft, ATop: Longint);
procedure ResizeCol(Index: Longint; OldSize, NewSize: Integer);
procedure ResizeRow(Index: Longint; OldSize, NewSize: Integer);
procedure SelectionMoved(const OldSel: TadvGridRect);
procedure ScrollDataInfo(DX, DY: Integer; var DrawInfo: TadvGridDrawInfo);
procedure TopLeftMoved(const OldTopLeft: TadvGridCoord);
procedure UpdateScrollPos;
procedure UpdateScrollRange;
function GetColWidths(Index: Longint): Integer;
function GetRowHeights(Index: Longint): Integer;
function GetSelection: TadvGridRect;
function GetTabStops(Index: Longint): Boolean;
function GetVisibleColCount: Integer;
function GetVisibleRowCount: Integer;
procedure ReadColWidths(Reader: TReader);
procedure ReadRowHeights(Reader: TReader);
procedure SetBorderStyle(Value: TBorderStyle);
procedure SetCol(Value: Longint);
procedure SetColCount(Value: Longint);
procedure SetColWidths(Index: Longint; Value: Integer);
procedure SetDefaultColWidth(Value: Integer);
procedure SetDefaultRowHeight(Value: Integer);
procedure SetEditorMode(Value: Boolean);
procedure SetFixedColor(Value: TColor);
procedure SetHighLightColor(const Value: TColor);
procedure SetHighLightTextColor(const Value: TColor);
procedure SetFixedCols(Value: Integer);
procedure SetFixedRows(Value: Integer);
procedure SetGridLineWidth(Value: Integer);
procedure SetGridLineColor(Value: TColor);
procedure SetLeftCol(Value: Longint);
procedure SetOptions(Value: TadvGridOptions);
procedure SetRow(Value: Longint);
procedure SetRowCount(Value: Longint);
procedure SetRowHeights(Index: Longint; Value: Integer);
procedure SetScrollBars(Value: TScrollStyle);
procedure SetSelection(Value: TadvGridRect);
procedure SetTabStops(Index: Longint; Value: Boolean);
procedure SetTopRow(Value: Longint);
procedure SetMultiSelect(const Value: Boolean);
procedure SetFixedDarkColor(const Value: TColor);
procedure WriteColWidths(Writer: TWriter);
procedure WriteRowHeights(Writer: TWriter);
procedure CMCancelMode(var Msg: TMessage); message CM_CANCELMODE;
procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
procedure CMCtl3DChanged(var Message: TMessage); message CM_CTL3DCHANGED;
procedure CMDesignHitTest(var Msg: TCMDesignHitTest); message CM_DESIGNHITTEST;
procedure CMWantSpecialKey(var Msg: TCMWantSpecialKey); message CM_WANTSPECIALKEY;
procedure CMShowingChanged(var Message: TMessage); message CM_SHOWINGCHANGED;
procedure WMChar(var Msg: TWMChar); message WM_CHAR;
procedure WMCancelMode(var Msg: TWMCancelMode); message WM_CANCELMODE;
procedure WMCommand(var Message: TWMCommand); message WM_COMMAND;
procedure WMGetDlgCode(var Msg: TWMGetDlgCode); message WM_GETDLGCODE;
procedure WMHScroll(var Msg: TWMHScroll); message WM_HSCROLL;
procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS;
procedure WMLButtonDown(var Message: TMessage); message WM_LBUTTONDOWN;
procedure WMNCHitTest(var Msg: TWMNCHitTest); message WM_NCHITTEST;
procedure WMSetCursor(var Msg: TWMSetCursor); message WM_SETCURSOR;
procedure WMSetFocus(var Msg: TWMSetFocus); message WM_SETFOCUS;
procedure WMSize(var Msg: TWMSize); message WM_SIZE;
procedure WMTimer(var Msg: TWMTimer); message WM_TIMER;
procedure WMVScroll(var Msg: TWMVScroll); message WM_VSCROLL;
function GetUpdownButton: TadvUpdownButton;
function GetCellText(ACol, ARow: Integer): string;
procedure SetCellText(ACol, ARow: Integer; const Value: string);
function GetEditLimit: Longint;
procedure SetEditLimit(const Value: Longint);
protected
FGridState: TadvGridState;
FSaveCellExtents: Boolean;
DesignOptionsBoost: TadvGridOptions;
VirtualView: Boolean;
FLockCount: Longint;
function IsActiveControl: Boolean;
procedure UpdateEdit;
procedure UpdateText;
procedure CalcDrawInfo(var DrawInfo: TadvGridDrawInfo);
procedure CalcFixedInfo(var DrawInfo: TadvGridDrawInfo);
procedure CalcSizingState(X, Y: Integer; var State: TadvGridState; var Index: Longint;
var SizingPos, SizingOfs: Integer; var FixedInfo: TadvGridDrawInfo); virtual;
function CreateEditor: TadvGridEdit; virtual;
procedure CreateParams(var Params: TCreateParams); override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure KeyPress(var Key: Char); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure AdjustSize(Index, Amount: Longint; Rows: Boolean); reintroduce; dynamic;
function BoxRect(ALeft, ATop, ARight, ABottom: Longint): TRect;
procedure DoExit; override;
function CanEditAcceptKey(Key: Char): Boolean; dynamic;
function CanGridAcceptKey(Key: Word; Shift: TShiftState): Boolean; dynamic;
function CanEditModify: Boolean; dynamic;
function CanEditShow: Boolean; virtual;
function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
function GetEditText(ACol, ARow: Longint): string; dynamic;
procedure SetEditText(ACol, ARow: Longint; const Value: string); dynamic;
function GetGridWidth: Integer;
function GetGridHeight: Integer;
procedure HideEditor;
procedure ShowEditor;
procedure ShowEditorChar(Ch: Char);
procedure InvalidateEditor;
procedure MoveColumn(FromIndex, ToIndex: Longint);
procedure ColumnMoved(FromIndex, ToIndex: Longint); dynamic;
procedure MoveRow(FromIndex, ToIndex: Longint; const ChangeAnchor: Boolean = True);
procedure RowMoved(FromIndex, ToIndex: Longint); dynamic;
procedure DrawCell(ACol, ARow: Longint; ARect: TRect; AState: TadvGridDrawState); virtual;
procedure DefineProperties(Filer: TFiler); override;
procedure MoveColRow(ACol, ARow: Longint; MoveAnchor, Show: Boolean);
function SelectCell(ACol, ARow: Longint): Boolean; virtual;
procedure SizeChanged(OldColCount, OldRowCount: Longint); dynamic;
function Sizing(X, Y: Integer): Boolean;
procedure ScrollData(DX, DY: Integer);
procedure TopLeftChanged; dynamic;
procedure TimedScroll(Direction: TadvGridScrollDirection); dynamic;
procedure Paint; override;
procedure ColWidthsChanged; dynamic;
procedure RowHeightsChanged; dynamic;
procedure UpdateDesigner;
function BeginColumnDrag(var Origin, Destination: Integer; const MousePt: TPoint): Boolean; dynamic;
function BeginRowDrag(var Origin, Destination: Integer; const MousePt: TPoint): Boolean; dynamic;
function CheckColumnDrag(var Origin, Destination: Integer; const MousePt: TPoint): Boolean; dynamic;
function CheckRowDrag(var Origin, Destination: Integer; const MousePt: TPoint): Boolean; dynamic;
function EndColumnDrag(var Origin, Destination: Integer; const MousePt: TPoint): Boolean; dynamic;
function EndRowDrag(var Origin, Destination: Integer; const MousePt: TPoint): Boolean; dynamic;
function GetEditAlignment: TadvAlignment;
function GetEditStyle: TadvEditStyle;
function GetLimitSize(ACol, ARow: Longint): Longint;
procedure EditButtonClick;
procedure DrawFocusRect(ARect: TRect);
property EditorMode: Boolean read FEditorMode write SetEditorMode;
property GridHeight: Integer read GetGridHeight;
property GridWidth: Integer read GetGridWidth;
property HitTest: TPoint read FHitTest;
property InplaceEditor: TadvGridEdit read FInplaceEdit;
property Selection: TadvGridRect read GetSelection write SetSelection;
property TabStops[Index: Longint]: Boolean read GetTabStops write SetTabStops;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function MouseCoord(X, Y: Integer): TadvGridCoord;
procedure MouseToCell(X, Y: Integer; var ACol, ARow: Longint);
function CellRect(ACol, ARow: Longint): TRect; overload;
function CellRect(ACol, ARow: Longint; const SpanCols, SpanRows: Longint): TRect; overload;
function InplaceModified: Boolean;
function RowIsInSel(ARow: Longint): Boolean;
function GetInplaceText(var s: string): Boolean;
procedure InvalidateCell(ACol, ARow: Longint);
procedure InvalidateCol(ACol: Longint);
procedure InvalidateRow(ARow: Longint);
procedure InvalidateGrid;
procedure InvalidateFixed;
procedure InvalidateRect(ARect: TadvGridRect);
procedure DeleteColumn(ACol: Longint); virtual;
procedure InsertColumn(ACol: Longint); virtual;
procedure DeleteRow(ARow: Longint); virtual;
procedure InsertRow(ARow: Longint); virtual;
procedure AppendRow; virtual;
procedure DrawCellText(ACol, ARow: Longint; AText: string; ARect: TRect; uFormat: Longint);
procedure DrawCellCheck(ACol, ARow: Longint; ARect: TRect; AState: TCheckBoxState; const bFlat: Boolean = False);
procedure DrawGlyphCheck(ACol, ARow: Longint; ARect: TRect);
procedure DrawCrossCheck(ACol, ARow: Longint; ARect: TRect);
procedure DrawGlyph(ACol, ARow: Longint; ARect: TRect; ABitmap: TBitmap);
function ReachLast: Boolean;
function ReachFirst: Boolean;
procedure FillOrds(const ACol: Longint = 0);
procedure MergeCells(ACol, ARow, SpanCols, SpanRows: Longint);
procedure UnMergeCells(ACol, ARow: Longint);
procedure DismergeAll;
function GetMergeInfo(ACol, ARow: Longint; var ARec: TCellGroup): Boolean;
procedure Reset;
procedure LockPaint;
procedure UnLockPaint;
procedure GetSelectRows(AList: TadvIntegerList);
function TextDrawFormat(ACol, ARow: Longint): Longint;
property UpdownButton: TadvUpdownButton read GetUpdownButton;
property Col: Longint read FCurrent.X write SetCol;
property Row: Longint read FCurrent.Y write SetRow;
property LeftCol: Longint read FTopLeft.X write SetLeftCol;
property TopRow: Longint read FTopLeft.Y write SetTopRow;
property ColWidths[Index: Longint]: Integer read GetColWidths write SetColWidths;
property RowHeights[Index: Longint]: Integer read GetRowHeights write SetRowHeights;
property CellText[ACol, ARow: Longint]: string read GetCellText write SetCellText;
property EditLimit: Longint read GetEditLimit write SetEditLimit default 0;
property Canvas;
published
property Align;
property Anchors;
property BiDiMode;
property BorderStyle: TBorderStyle read FBorderStyle write SetBorderStyle default bsSingle;
property Color default clWindow;
property ColCount: Longint read FColCount write SetColCount default 5;
property RowCount: Longint read FRowCount write SetRowCount default 5;
property Constraints;
property Ctl3D;
property DefaultColWidth: Integer read FDefaultColWidth write SetDefaultColWidth default 64;
property DefaultRowHeight: Integer read FDefaultRowHeight write SetDefaultRowHeight default 16;
property DefaultDrawing: Boolean read FDefaultDrawing write FDefaultDrawing default True;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property FixedCols: Integer read FFixedCols write SetFixedCols default 1;
property FixedRows: Integer read FFixedRows write SetFixedRows default 1;
property FixedColor: TColor read FFixedColor write SetFixedColor default clBtnFace;
property FixedDarkColor: TColor read FFixedDarkColor write SetFixedDarkColor default clBlack;
property FocusColor: TColor read FFocusColor write FFocusColor;
property Font;
property GridLineWidth: Integer read FGridLineWidth write SetGridLineWidth default 1;
property GridLineColor: TColor read FGridLineColor write SetGridLineColor default clSilver;
property HighLightColor: TColor read FHighLightColor write SetHighLightColor default clBlack;
property HighLightTextColor: TColor read FHighLightTextColor write SetHighLightTextColor default clWhite;
property Options: TadvGridOptions read FOptions write SetOptions default [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goColSizing, goFocusSelected, goThumbTracking];
property ParentBiDiMode;
property ParentColor default False;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ScrollBars: TScrollStyle read FScrollBars write SetScrollBars default ssBoth;
property ShowHint;
property TabOrder;
property TabStop default True;
property Visible;
property VisibleColCount: Integer read GetVisibleColCount;
property VisibleRowCount: Integer read GetVisibleRowCount;
property MultiSelect: Boolean read FMultiSelect write SetMultiSelect default False;
property OnClick;
property OnColumnMoved: TadvMovedEvent read FOnColumnMoved write FOnColumnMoved;
property OnRowMoved: TadvMovedEvent read FOnRowMoved write FOnRowMoved;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnDrawCell: TadvDrawCellEvent read FOnDrawCell write FOnDrawCell;
property OnEditChange: TadvTextNotifyEvent read FOnEditChange write FOnEditChange;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetCellText: TadvGetCellTextEvent read FOnGetCellText write FOnGetCellText;
property OnSetCellText: TadvSetCellTextEvent read FOnSetCellText write FOnSetCellText;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnSelectCell: TadvSelectCellEvent read FOnSelectCell write FOnSelectCell;
property OnStartDock;
property OnStartDrag;
property OnTopLeftChanged: TNotifyEvent read FOnTopLeftChanged write FOnTopLeftChanged;
property OnChangeCellAlignment: TadvAlignmentEvent read FOnChangeCellAlignment write FOnChangeCellAlignment;
property OnChangeEditStyle: TadvChangeEditStyleEvent read FOnChangeEditStyle write FOnChangeEditStyle;
property OnEditButtonClick: TNotifyEvent read FOnEditButtonClick write FOnEditButtonClick;
property OnUpdownChange: TadvUpdownChangeEvent read FOnUpdownChange write FOnUpdownChange;
property OnPrepareListItems: TadvListChangeEvent read FOnPrepareListItems write FOnPrepareListItems;
property OnSelectListItem: TadvTextChangeEvent read FOnSelectListItem write FOnSelectListItem;
property OnChangeEditLimit: TadvExtentQueryEvent read FOnChangeEditLimit write FOnChangeEditLimit;
property OnFixedMouseDown: TMouseEvent read FOnFixedMouseDown write FOnFixedMouseDown;
property OnFixedMouseUp: TMouseEvent read FOnFixedMouseUp write FOnFixedMouseUp;
property OnFixedCellClick: TadvGridCellEvent read FOnFixedCellClick write FOnFixedCellClick;
property OnDeleteRows: TadvRowColNotifyEvent read FOnDeleteRows write FOnDeleteRows;
property OnInsertRows: TadvRowColNotifyEvent read FOnInsertRows write FOnInsertRows;
property OnAppendRows: TadvGridNotifyEvent read FOnAppendRows write FOnAppendRows;
property AfterAppendRows: TadvRowColChangedEvent read FAfterAppendRows write FAfterAppendRows;
property AfterInsertRows: TadvRowColChangedEvent read FAfterInsertRows write FAfterInsertRows;
property AfterDeleteRows: TadvRowColChangedEvent read FAfterDeleteRows write FAfterDeleteRows;
end;

 
接受答案了.
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部