Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fitting a drawing in canvas to a page

Status
Not open for further replies.

firelex

Programmer
Jan 10, 2002
118
DE
Hello, all!
My problem is:
I have drawing in a canvas. I want it (the drawing) to be the size of A4-page. Not so difficult, but not so easy :

If I make the canvas the A4-size - it gets below the screen range and I can't see the whole pic. I tried to use the scrollbars but it didn't work somehow.
The last way for me is to make the pic small and then, scale it when using [tt]poscript[/tt] option of canvas. But then the drawing gets too small.
The best way for me is to get (somehow) the drawing be
[tt]-width 20c -height 29c[/tt] and thus the canvas get the size of something like [tt]-width 200 -height 150[/tt]. So, that I could see the rest of the pic by scrolling.
Any ideas?
 
If you want a A4 canvas with scroll bars, it is easy to do:
Code:
  canvas .c -width 300  -height 200 -bg beige             -xscrollcommand {.hs set}             -yscrollcommand {.vs set}
  scrollbar .hs -command {.c xview} -orient horizontal
  scrollbar .vs -command {.c yview}
  grid .c  -row 0 -column 0
  grid .vs -row 0 -column 1 -sticky ns
  grid .hs -row 1 -column 0 -sticky ew
  .c create text 0c 0c -anchor nw -text (0,0)
  .c create text 21c 29c -anchor se -text (21c,29c)
  .c config -scrollregion [list 0 0 21c 29c]
HTH

ulis
 
Thanks, ulis!
Just stretch the canvas between two points - it's a great idea...
Everything is so easy, when you look at it from another point of view.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top