Solved

Canvas Resizing question.

Posted on 2007-03-25
7
316 Views
Last Modified: 2010-08-05
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



0
Comment
Question by:peterkiers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 18791787
    Hi!
Try this
Canvas.Font.Size := round(FCellHeight* 0.65);

Regards,
  Tomas Helgi
0
 
LVL 1

Author Comment

by:peterkiers
ID: 18793086
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
0
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 18793251
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
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:peterkiers
ID: 18793299
Oke, and how can I do that?

Peter
0
 
LVL 25

Accepted Solution

by:
Tomas Helgi Johannsson earned 500 total points
ID: 18793485
It's called double buffering.
Here is an similar example with bitmaps:
http://delphi.about.com/library/bluc/text/uc092700b.htm

Regards,
   Tomas Helgi
0
 
LVL 1

Author Comment

by:peterkiers
ID: 18793609
Thanks.

Peter Kiers

500 p. comming your way.
0
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 18793639
:)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi TcxGrid group footer summary 3 389
creating threads in delphi 1 196
how to change, disabled button color FMX ? 1 63
FMX TEdit KeyUp handler detecting  "enter" key 4 61
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question