Link to home
Start Free TrialLog in
Avatar of Peter Kiers
Peter KiersFlag for Netherlands

asked on

Canvas Resizing question.

Dear Experts,

I want to make a Telnet-program. So I  have made an example that draws on the
canvas of the form, I have devided the canvas in 80 columns and 25 rows, and I
have draw a cursor on it. I have made a mainmenu-item that when you click on it
it will fill all cells with characters and numbers, I use this menu-item for testing.

My problem is the Resizing, I want to resize the form and when I do that the
FontWidth and FontHeight have to adjust automaticly. For example if I resize
the form to the half of the screen the font still have to be readable.

I really need your help, because I can't solve this on my own. This is the
only problem I have to finish my application. Who can help me?

I have put the example on my site: http://members.home.nl/peterkiers/
Beneath the Under Construction bar you see a floppy-disk, Click on it to
download the example.

Thank you in advanced.

Greetings,

Peter Kiers



Avatar of Tomas Helgi Johannsson
Tomas Helgi Johannsson
Flag of Iceland image

    Hi!
Try this
Canvas.Font.Size := round(FCellHeight* 0.65);

Regards,
  Tomas Helgi
Avatar of Peter Kiers

ASKER

I have found something else and it works for me.

procedure TMainForm.Resize;
begin
  FontWidthPix :=ClientWidth  div (SCRCOLS);
  FontHeightPix:=(ClientHeight-2) div (SCRROWS+1);
end;

But their is still a change to earn the 500 points.
When I use the code above in my example, I does
just what I want, only the canvas keeps on flickering!
What can I do about that?

Peter Kiers
One solution is to have a Canvas in the background and draw on that canvas and then after finishing the drawing switch to that canvas.

Regards,
   Tomas Helgi
Oke, and how can I do that?

Peter
ASKER CERTIFIED SOLUTION
Avatar of Tomas Helgi Johannsson
Tomas Helgi Johannsson
Flag of Iceland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks.

Peter Kiers

500 p. comming your way.