Thema: Delphi Formular Ableiten

Einzelnen Beitrag anzeigen

Hammer

Registriert seit: 23. Apr 2003
11 Beiträge
 
#13

Re: Formular Ableiten

  Alt 10. Sep 2007, 10:39
Hallo

Hier mein Aktueller Code, hat jemand noch ne idee denn das WMPaint scheint mir nicht Optimal zu sein.
Beim Anklicken von Kombos auf dem Form gibts Grafik Fehler und das Form wird nicht richtig gezeichnet!

Bin um jede Hilfe dankbar...

Grüsse
Adrian


Delphi-Quellcode:
unit DescendantForm;

interface

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


type

  TCustomNewDescendantForm = class(TForm)
  private
    fContentWindow : Boolean ;
    procedure SetContentWindow(const Value: Boolean);
    procedure WMPaint(var msg: TWMPaint); message WM_PAINT;
  protected
    procedure Paint; override;
    procedure Resizing(State: TWindowState); override;
    property ContentWindow : Boolean read fContentWindow write SetContentWindow;
  public
    constructor Create(aOwner: TComponent); override;
    destructor Destroy; override ;
  end;
  
  TNewDescendantForm = class(TCustomNewDescendantForm)
  published
    property ContentWindow : Boolean read fContentWindow write SetContentWindow;
    property OnPaint;
    property OnResize;
  end;

implementation

{ TCustomNewDescendantForm }

constructor TCustomNewDescendantForm.Create(aOwner: TComponent);
begin
  Inherited;
end;

destructor TCustomNewDescendantForm.Destroy;
begin
  Inherited;
end;

procedure TCustomNewDescendantForm.Paint;
var xPoint1 : TPoint ;
    xRect1 : TRect ;
begin
  Color := clWhite ;
  
  aRect1.Left := 0 ;
  aRect1.Top := 0 ;
  aRect1.Bottom := ClientHeight ;
  aRect1.Right := ClientWidth ;
  Canvas.Brush.Color:= clWhite ;
  Canvas.FillRect( aRect1 ) ;

  Canvas.Pen.Color := clBlack ;
  Canvas.RoundRect(2, 2, ClientWidth - 2, ClientHeight - 2, 20, 20);

  aPoint1.X := 2 ;
  aPoint1.Y := 100 ;
  Canvas.Pen.Color := clBlack ; ;
  Canvas.PenPos := aPoint1 ;
  Canvas.LineTo(ClientWidth - 2 , 100) ;

  Canvas.Brush.Color:= clRed ; ;
  Canvas.FloodFill(10,10,clWhite,fsSurface) ;
end;

procedure TCustomNewDescendantForm.Resizing(State: TWindowState);
begin
  Refresh;
  Inherited;
end;

procedure TCustomNewDescendantForm.SetContentWindow(const Value: Boolean);
begin
  fContentWindow := Value ;
end;

procedure TCustomNewDescendantForm.WMPaint(var msg: TWMPaint);
begin
  Inherited ;
  Paint;
end;

end.
  Mit Zitat antworten Zitat