destructorTCsCustomPanel.Destroy; begin FreeAndNil(FBorderLeft); FreeAndNil(FBorderRight); FreeAndNil(FBorderTop); FreeAndNil(FBorderBottom);
inheritedDestroy; end;
procedureTCsCustomPanel.SetBorderLeft(Value:TCsBorderStyle); begin FBorderLeft.Assign(Value); Invalidate; end;
procedureTCsCustomPanel.SetBorderRight(Value:TCsBorderStyle); begin FBorderRight.Assign(Value); Invalidate; end;
procedureTCsCustomPanel.SetBorderBottom(Value:TCsBorderStyle); begin FBorderBottom.Assign(Value); Invalidate; end;
procedureTCsCustomPanel.SetBorderTop(Value:TCsBorderStyle); begin FBorderTop.Assign(Value); Invalidate; end;
procedureTCsCustomPanel.Loaded; begin inheritedLoaded; //Repaint; end;
procedureTCsCustomPanel.DrawBorder(Style:TCsBorderStyle; Position:TCsBorderPosition); var Coord:TPoint; begin ifStyle.Visiblethen begin Canvas.Pen.Color:=Style.Color; Canvas.Pen.Width:=Style.Width; Canvas.PenPos:=GetBorderStartPosition(Position);
Coord:=GetBorderEndPosition(Position);
Canvas.LineTo(Coord.X, Coord.Y); end; end;
functionTCsCustomPanel.GetBorderStartPosition(Position:TCsBorderPosition):TPoint; begin casePositionof cbpTop: begin Result.X:=0; Result.Y:=0; end; cbpBottom: begin Result.X:=0; Result.Y:=Height; end; cbpLeft: begin Result.X:=0; Result.Y:=0; end; cbpRight: begin Result.X:=Width; Result.Y:=0; end; end; end;
functionTCsCustomPanel.GetBorderEndPosition(Position:TCsBorderPosition):TPoint; begin casePositionof cbpTop: begin Result.X:=Width; Result.Y:=0; end; cbpBottom: begin Result.X:=Width; Result.Y:=Height; end; cbpLeft: begin Result.X:=0; Result.Y:=Height; end; cbpRight: begin Result.X:=Width; Result.Y:=Height; end; end; end;
procedureTCsCustomPanel.Paint; begin inheritedPaint;
{ TCsBorderStyle ------------------------------------------------------------- } procedureTCsBorderStyle.Assign(Source:TPersistent); begin ifSourceisTCsBorderStylethen begin FColor:=TCsBorderStyle(Source).Color; FWidth:=TCsBorderStyle(Source).Width; FVisible:=TCsBorderStyle(Source).Visible; end else inheritedAssign(Source); end;
procedureTCsBorderStyle.AssignTo(Dest:TPersistent); begin ifDestisTCsBorderStylethen begin TCsBorderStyle(Dest).Color:=FColor; TCsBorderStyle(Dest).Width:=FWidth; TCsBorderStyle(Dest).Visible:=FVisible; end else inheritedAssignTo(Dest); end;
AW: [TCanvas] Komponente wird nicht richtig aktualisiert
23. Mai 2011, 10:14
Anhangvergessen?
Detlef "Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
AW: [TCanvas] Komponente wird nicht richtig aktualisiert
23. Mai 2011, 10:37
So, sieheAnhangfunktioniertes...
Thomas Wassermann H₂♂ Das Problem steckt meistens zwischen den Ohren
DRY DRY KISS
H₂♂ (wenn bei meinen Snipplets nichts anderes angegeben ist Lizenz: WTFPL)
destructorTCsCustomPanel.Destroy; begin FreeAndNil(FBorderLeft); FreeAndNil(FBorderRight); FreeAndNil(FBorderTop); FreeAndNil(FBorderBottom);
inheritedDestroy; end;
procedureTCsCustomPanel.SetBorderLeft(Value:TCsBorderStyle); begin FBorderLeft.Assign(Value); Invalidate; end;
procedureTCsCustomPanel.SetBorderRight(Value:TCsBorderStyle); begin FBorderRight.Assign(Value); Invalidate; end;
procedureTCsCustomPanel.SetBorderBottom(Value:TCsBorderStyle); begin FBorderBottom.Assign(Value); Invalidate; end;
procedureTCsCustomPanel.SetBorderTop(Value:TCsBorderStyle); begin FBorderTop.Assign(Value); Invalidate; end;
procedureTCsCustomPanel.Loaded; begin inheritedLoaded; //Repaint; end;
procedureTCsCustomPanel.DrawBorder(Style:TCsBorderStyle; Position:TCsBorderPosition); var Coord:TPoint; begin ifStyle.Visiblethen begin Canvas.Pen.Color:=Style.Color; Canvas.Pen.Width:=Style.Width; Canvas.PenPos:=GetBorderStartPosition(Position);
Coord:=GetBorderEndPosition(Position);
Canvas.LineTo(Coord.X, Coord.Y); end; end;
functionTCsCustomPanel.GetBorderStartPosition(Position:TCsBorderPosition):TPoint; begin casePositionof cbpTop: begin Result.X:=0; Result.Y:=0; end; cbpBottom: begin Result.X:=0; Result.Y:=Height; end; cbpLeft: begin Result.X:=0; Result.Y:=0; end; cbpRight: begin Result.X:=Width; Result.Y:=0; end; end; end;
functionTCsCustomPanel.GetBorderEndPosition(Position:TCsBorderPosition):TPoint; begin casePositionof cbpTop: begin Result.X:=Width; Result.Y:=0; end; cbpBottom: begin Result.X:=Width; Result.Y:=Height; end; cbpLeft: begin Result.X:=0; Result.Y:=Height; end; cbpRight: begin Result.X:=Width; Result.Y:=Height; end; end; end;
procedureTCsCustomPanel.Paint; begin inheritedPaint;
{ TCsBorderStyle ------------------------------------------------------------- } constructorTCsBorderStyle.Create(AOwner:TCsCustomPanel); begin //inheritedCreate;
FOwner:=AOwner; end;
procedureTCsBorderStyle.Assign(Source:TPersistent); begin ifSourceisTCsBorderStylethen begin FColor:=TCsBorderStyle(Source).Color; FWidth:=TCsBorderStyle(Source).Width; FVisible:=TCsBorderStyle(Source).Visible; end else inheritedAssign(Source); end;
procedureTCsBorderStyle.AssignTo(Dest:TPersistent); begin ifDestisTCsBorderStylethen begin TCsBorderStyle(Dest).Color:=FColor; TCsBorderStyle(Dest).Width:=FWidth; TCsBorderStyle(Dest).Visible:=FVisible; end else inheritedAssignTo(Dest); end;
procedureTCsBorderStyle.SetColor(Value:TColor); begin FColor:=Value; ifAssigned(FOwner) then FOwner.Invalidate; end;
procedureTCsBorderStyle.SetWidth(Value:Byte); begin FWidth:=Value; ifAssigned(FOwner) then FOwner.Invalidate; end;
procedureTCsBorderStyle.SetVisible(Value:Boolean); begin FVisible:=Value; ifAssigned(FOwner) then FOwner.Invalidate; end;
procedureTCsBorderStyle.setWidth(constValue:Byte); begin FWidth:=Value; ifAssigned(FOwner) thenFOwner.Invalidate; end;
Thomas Wassermann H₂♂ Das Problem steckt meistens zwischen den Ohren
DRY DRY KISS
H₂♂ (wenn bei meinen Snipplets nichts anderes angegeben ist Lizenz: WTFPL)
AW: [TCanvas] Komponente wird nicht richtig aktualisiert
23. Mai 2011, 12:03
ichmeine:
ifAssigned(FOwner) thenFOwner.Invalidate;
EDIT:
sorryichhatteDeineEditsnichtgesehen....
Thomas Wassermann H₂♂ Das Problem steckt meistens zwischen den Ohren
DRY DRY KISS
H₂♂ (wenn bei meinen Snipplets nichts anderes angegeben ist Lizenz: WTFPL)