D driayu Unregistered / Unconfirmed GUEST, unregistred user! 2007-11-29 #1 简单问是:以下这句中,Index的意思是什么?property Month: Integer index 2 read GetDateElement write SetDateElement stored False; ( 积分: 40 )<br />不明白意,请高手提点.
简单问是:以下这句中,Index的意思是什么?property Month: Integer index 2 read GetDateElement write SetDateElement stored False; ( 积分: 40 )<br />不明白意,请高手提点.
A ANiDelphi Unregistered / Unconfirmed GUEST, unregistred user! 2007-11-29 #2 应该是指read(GetDateElement)和write(SetDateElement)过程中的一个参数的值吧<br>看看Delphi的源码就清楚了(摘自Controls.pas)<br><br> TSizeConstraints = class(TPersistent)<br> private<br> FControl: TControl;<br> FMaxHeight: TConstraintSize;<br> FMaxWidth: TConstraintSize;<br> FMinHeight: TConstraintSize;<br> FMinWidth: TConstraintSize;<br> FOnChange: TNotifyEvent;<br> procedure SetConstraints(Index: Integer; Value: TConstraintSize);<br> protected<br> procedure Change; virtual;<br> procedure AssignTo(Dest: TPersistent); override;<br> property Control: TControl read FControl;<br> public<br> constructor Create(Control: TControl); virtual;<br> property OnChange: TNotifyEvent read FOnChange write FOnChange;<br> published<br> property MaxHeight: TConstraintSize index 0 read FMaxHeight write SetConstraints default 0;<br> property MaxWidth: TConstraintSize index 1 read FMaxWidth write SetConstraints default 0;<br> property MinHeight: TConstraintSize index 2 read FMinHeight write SetConstraints default 0;<br> property MinWidth: TConstraintSize index 3 read FMinWidth write SetConstraints default 0;<br> end;<br><br>procedure TSizeConstraints.SetConstraints(Index: Integer;<br> Value: TConstraintSize);<br>begin<br> case Index of<br> 0:<br> if Value <> FMaxHeight then<br> begin<br> FMaxHeight := Value;<br> if (Value > 0) and (Value < FMinHeight) then<br> FMinHeight := Value;<br> Change;<br> end;<br> 1:<br> if Value <> FMaxWidth then<br> begin<br> FMaxWidth := Value;<br> if (Value > 0) and (Value < FMinWidth) then<br> FMinWidth := Value;<br> Change;<br> end;<br> 2:<br> if Value <> FMinHeight then<br> begin<br> FMinHeight := Value;<br> if (FMaxHeight > 0) and (Value > FMaxHeight) then<br> FMaxHeight := Value;<br> Change;<br> end;<br> 3:<br> if Value <> FMinWidth then<br> begin<br> FMinWidth := Value;<br> if (FMaxWidth > 0) and (Value > FMaxWidth) then<br> FMaxWidth := Value;<br> Change;<br> end;<br> end;<br>end;
应该是指read(GetDateElement)和write(SetDateElement)过程中的一个参数的值吧<br>看看Delphi的源码就清楚了(摘自Controls.pas)<br><br> TSizeConstraints = class(TPersistent)<br> private<br> FControl: TControl;<br> FMaxHeight: TConstraintSize;<br> FMaxWidth: TConstraintSize;<br> FMinHeight: TConstraintSize;<br> FMinWidth: TConstraintSize;<br> FOnChange: TNotifyEvent;<br> procedure SetConstraints(Index: Integer; Value: TConstraintSize);<br> protected<br> procedure Change; virtual;<br> procedure AssignTo(Dest: TPersistent); override;<br> property Control: TControl read FControl;<br> public<br> constructor Create(Control: TControl); virtual;<br> property OnChange: TNotifyEvent read FOnChange write FOnChange;<br> published<br> property MaxHeight: TConstraintSize index 0 read FMaxHeight write SetConstraints default 0;<br> property MaxWidth: TConstraintSize index 1 read FMaxWidth write SetConstraints default 0;<br> property MinHeight: TConstraintSize index 2 read FMinHeight write SetConstraints default 0;<br> property MinWidth: TConstraintSize index 3 read FMinWidth write SetConstraints default 0;<br> end;<br><br>procedure TSizeConstraints.SetConstraints(Index: Integer;<br> Value: TConstraintSize);<br>begin<br> case Index of<br> 0:<br> if Value <> FMaxHeight then<br> begin<br> FMaxHeight := Value;<br> if (Value > 0) and (Value < FMinHeight) then<br> FMinHeight := Value;<br> Change;<br> end;<br> 1:<br> if Value <> FMaxWidth then<br> begin<br> FMaxWidth := Value;<br> if (Value > 0) and (Value < FMinWidth) then<br> FMinWidth := Value;<br> Change;<br> end;<br> 2:<br> if Value <> FMinHeight then<br> begin<br> FMinHeight := Value;<br> if (FMaxHeight > 0) and (Value > FMaxHeight) then<br> FMaxHeight := Value;<br> Change;<br> end;<br> 3:<br> if Value <> FMinWidth then<br> begin<br> FMinWidth := Value;<br> if (FMaxWidth > 0) and (Value > FMaxWidth) then<br> FMaxWidth := Value;<br> Change;<br> end;<br> end;<br>end;