Registriert seit: 11. Nov 2003
Ort: Oldenburg
1.446 Beiträge
Delphi 10.2 Tokyo Enterprise
|
Re: Zugriffsverletzung bei zuweisung von Self
5. Nov 2007, 15:45
Delphi-Quellcode:
Tonl_kalender = class(TWinControl)
private
FHGColor: TColor;
FDayColor: TColor;
FNightColor: TColor;
FFont: TFont;
FOnChange: TOnChange;
FDatum: TDate;
FAnzTimes : Integer;
FHeaderHeigth : Longint;
FPHeader : TPanel;
FTimeResult: TTimeResult;
FTimeWidth : Integer;
FPaintda : Boolean;
FStartDay: TTime;
FEndDay: TTime;
FAktTime: TTime;
FPaint : TPaintBox;
FS1,FS2 : TScrollBar;
FHeaderColor: TColor;
FJahr: Word;
FUserWidth: Integer;
FUsers: Tonl_kalusers;
FZeitList : TZeitList;
FAnzTimeRec : Longint;
FDblBuffer : graphics.TBitmap;
FOnGetFeierTag: TOnGetFeierTag;
FFeiertagFont: TFont;
FXMark,FYMark : Longint;
FOnChangeTag: TOnChangeTag;
FAktDayColor: TColor;
FZK: TZk;
FZKEffect: TzkEffekt;
FTermine: Tonl_kaltermine;
FCreateTermin: Boolean;
FNewtermin: Tonl_kaltermin;
procedure WMSize(var Message: TWMSize); message WM_SIZE;
procedure WMPaint(var AMessage : TWMPaint); message wm_Paint;
procedure SetDayColor(const Value: TColor);
procedure SetFont(const Value: TFont);
procedure SetHGColor(const Value: TColor);
procedure SetNightColor(const Value: TColor);
procedure SetOnChange(const Value: TOnChange);
procedure SetDatum(const Value: TDate);
Procedure SetAnzTimes;
procedure SetTimeResult(const Value: TTimeResult);
procedure SetEndDay(const Value: TTime);
procedure SetStartDay(const Value: TTime);
procedure SetAktTime(const Value: TTime);
procedure SetOnGetFeierTag(const Value: TOnGetFeierTag);
procedure SetFeiertagFont(const Value: TFont);
Procedure CreateHeaders(C : TCanvas);
Procedure CreateUsers(C : TCanvas);
Procedure CreateView;
procedure SetHeaderColor(const Value: TColor);
function LinearBlendedColor(Color1, Color2: TColor; alpha: Integer): TColor;
procedure SetUserWidth(const Value: Integer);
procedure SetUsers(const Value: Tonl_kalusers);
Procedure ZeichneKasten(x,y,w,h : Longint;C : TCanvas;Farbe : TColor;Style : TZk;effekt : TzkEffekt;Farbe1 : TColor=0);
Procedure ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;var ScrollPos: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);
procedure SetOnChangeTag(const Value: TOnChangeTag);
procedure SetAktDayColor(const Value: TColor);
procedure SetZK(const Value: TZk);
procedure SetZKEffect(const Value: TzkEffekt);
procedure SetTermine(const Value: Tonl_kaltermine);
{ Private-Deklarationen }
protected
{ Protected-Deklarationen }
public
{ Public-Deklarationen }
Constructor Create(AOwner: TComponent); override;
Destructor Destroy; override;
published
{ Published-Deklarationen }
property Align;
Property HGColor : TColor read FHGColor write SetHGColor;
Property DayColor : TColor read FDayColor write SetDayColor;
Property NightColor : TColor read FNightColor write SetNightColor;
Property HeaderColor: TColor read FHeaderColor write SetHeaderColor;
Property AktDayColor: TColor read FAktDayColor write SetAktDayColor;
Property Font : TFont read FFont write SetFont;
Property FeiertagFont : TFont read FFeiertagFont write SetFeiertagFont;
Property Datum : TDate read FDatum write SetDatum;
Property TimeResult : TTimeResult read FTimeResult write SetTimeResult;
Property StartDay : TTime read FStartDay write SetStartDay;
Property EndDay : TTime read FEndDay write SetEndDay;
Property AktTime : TTime read FAktTime write SetAktTime;
Property Jahr : Word read FJahr;
Property UserWidth : Integer read FUserWidth write SetUserWidth;
Property ZK : TZk read FZK write SetZK;
Property ZKEffect : TzkEffekt read FZKEffect write SetZKEffect;
Property Users : Tonl_kalusers read FUsers write SetUsers;
Property Termine : Tonl_kaltermine read FTermine write SetTermine;
Property OnChange : TOnChange read FOnChange write SetOnChange;
Property OnGetFeierTag : TOnGetFeierTag read FOnGetFeierTag write SetOnGetFeierTag;
Property OnChangeTag : TOnChangeTag read FOnChangeTag write SetOnChangeTag;
end;
procedure Tonl_kalender.FormMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
Var
xp,yp : Longint;
begin
xp:=(x-FUserWidth) DIV TimeWidth;
yp:=(y-FHeaderHeigth) DIV TimeHeight;
If (xp>=0) and (yp>=0) then
Begin
FCreateTermin:=True;
FNewtermin:=Tonl_kaltermin.Create(Self);
FNewtermin.Parent:=Self;
FNewtermin.Color:=clBlack;
FNewtermin.Left:=x;
FNewtermin.Top:=y;
End;
end;
constructor Tonl_kalender.Create(AOwner: TComponent);
begin
inherited;
FCreateTermin:=False;
FZeitList:=TZeitList.Create;
FPaintda:=False;
FHGColor:=clBtnFace;
FDayColor:=clCream;
FNightColor:=clSkyBlue;
FHeaderColor:=clBlue;
FFont:=TFont.Create;
FFont.Name:='Arial';
FFont.Size:=10;
FFont.Color:=clBlack;
FFeiertagFont:=TFont.Create;
FFeiertagFont.Name:='Arial';
FFeiertagFont.Size:=10;
FFeiertagFont.Color:=clRed;
FAktDayColor:=clLime;
FPHeader:=TPanel.Create(Self);
FStartDay:=StrToTime('08:00');
FEndDay:=StrToTime('18:00');
FUserWidth:=60;
FDatum:=Date;
FAktTime:=Now;
FJahr:=StrToInt(FormatDateTime('yyyy',FDatum));
FAnzTimes:=0;
FTimeWidth:=0;
FTimeResult:=onltk_15min;
With FPHeader do
Begin
Name:='p_header';
Caption:='';
Parent:=Self;<= Warum geht das hier
Left:=0;
Top:=0;
Height:=20;
Width:=Self.Width;
Align:=alTop;
Visible:=False;
End;
FS1:=TScrollBar.Create(Self);
With FS1 do
Begin
Parent:=Self;
Align:=alBottom;
Visible:=False;
Kind:=sbHorizontal;
OnScroll:=ScrollBar1Scroll;
End;
FS2:=TScrollBar.Create(Self);
With FS2 do
Begin
Parent:=Self;
Align:=alRight;
Visible:=False;
Kind:=sbVertical;
End;
FPaint:=TPaintBox.Create(Self);
With FPaint do
Begin
Parent:=Self;
Align:=alClient;
OnMouseMove:=FormMouseMove;
OnMouseDown:=FormMouseDown;
OnMouseUp:=FormMouseUp;
End;
FDblBuffer:=graphics.TBitmap.Create;
FUsers:=Tonl_kalusers.Create;
SetAnzTimes;
end;
Hier ist mehr
Frank Tux sein Lieblingsquellcode
While anzfische<TuxSatt do begin
Fisch:=TFisch.Create; Tux.EssenFisch(Fisch); Fisch.Free;inc(anzfische); end;
|
|
Zitat
|