ReDraw Canvas without using Invalidate

Hello FRers,

I want to ReDraw only one memo on the EMFPages,
ie : Change the Text into 'abc'.
If I use PaintBox.Invalidate, it will change, but the problem is the page is become blinking.. because it change whole of the canvas area.

So, i want to try to only Redraw just for that memoView that want to change..
Can i get the solution of it?

I already try to make it but it won't change until i call Invalidate..

procedure RedrawView( iView : TfrView); //on TPBox
begin
TfrMemoView(iView).Memo.Text := 'abc';
TfrMemoView(iView).Draw(Canvas);
end;

Thanx a lot for any comment

Comments

  • edited 10:12PM
    I already solved it.

    procedure TPBox.ReDraw_View(iView: TObject);
    var
    vRect : TRect;
    vMemoText : String;
    begin
    //refresh the background
    if (iView is TfrMemoView) then begin
    vRect := Rect( TfrMemoView(iView).DRect.Left,
    TfrMemoView(iView).DRect.Top + TfrMemoView(iView).gapy,
    TfrMemoView(iView).DRect.Right,
    TfrMemoView(iView).DRect.Bottom );
    Canvas.FillRect(vREct);
    //fill the new text
    TfrMemoView(iView).Memo.Text := 'abc';
    TfrMemoView(iView).Draw(Canvas);
    end;
    end;

    The first problem caused, because i forgot to refresh the canvas, it make the previous text didn't refresh. After i call FillRect, it refresh to blank canvas.
    And after that i just call Draw to make the new Text.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.