IDEIntf: designer mediator: fixed example invalidaterect

git-svn-id: trunk@21645 -
This commit is contained in:
mattias 2009-09-10 11:25:19 +00:00
parent de3d5fa347
commit 4b39cfdce1
2 changed files with 9 additions and 4 deletions

View File

@ -90,9 +90,13 @@ end;
class function TMyWidgetMediator.CreateMediator(TheOwner, aForm: TComponent
): TDesignerMediator;
var
Mediator: TMyWidgetMediator;
begin
Result:=inherited CreateMediator(TheOwner,aForm);
TMyWidgetMediator(Result).FMyForm:=aForm as TMyForm;
Mediator:=TMyWidgetMediator(Result);
Mediator.FMyForm:=aForm as TMyForm;
Mediator.FMyForm.Designer:=Mediator;
end;
class function TMyWidgetMediator.FormClass: TComponentClass;
@ -165,9 +169,9 @@ procedure TMyWidgetMediator.Paint;
// inner frame
if AWidget.AcceptChildsAtDesignTime then begin
Pen.Color:=clMaroon;
Rectangle(AWidget.BorderLeft,AWidget.BorderTop,
AWidget.Width-AWidget.BorderRight,
AWidget.Height-AWidget.BorderBottom);
Rectangle(AWidget.BorderLeft-1,AWidget.BorderTop-1,
AWidget.Width-AWidget.BorderRight+1,
AWidget.Height-AWidget.BorderBottom+1);
end;
// caption
TextOut(5,2,AWidget.Caption);

View File

@ -292,6 +292,7 @@ end;
procedure TMyWidget.InvalidateRect(ARect: TRect; Erase: boolean);
begin
//writeln('TMyWidget.InvalidateRect ',Name,' ',ARect.Left,',',ARect.Top);
ARect.Left:=Max(0,ARect.Left);
ARect.Top:=Max(0,ARect.Top);
ARect.Right:=Min(Width,ARect.Right);