Article Preview
Buy Now
COLUMN
More Graphics
Picture Fills and Scrolling Pictures
Issue: 19.2 (March/April 2021)
Author: Marc Zeedar
Author Bio: Marc taught himself programming in high school when he bought his first computer but had no money for software. He's had fun learning ever since.
Article Description: No description available.
Article Length (in bytes): 13,099
Starting Page Number: 53
Article Number: 19207
Resource File(s):
project19207.zip Updated: 2021-02-28 23:15:54
Related Link(s): None
Excerpt of article text...
Last issue, I wrote about some of Xojo's new graphics features, focusing on gradient fills. However, I left off one new type of fill: picture fill. This allows you to set a
picture
as the brush and then fill agraphics
object with a repeating pattern of that picture.That's really too simple for a whole demo, though, so I thought today I'd also answer a reader question about how to make a canvas that can scroll a large picture.
Creating the Demo
To start, we'll create a new Xojo project and onto the default
Window1
we want to drag several controls: acanvas
, a horizontalscrollbar
, and a verticalscrollbar
(see Figure 1).Name the scrollbars
sbHorz
andsbVert
and put them on the bottom and right sides of the window. Extend their size to fill the full width and height ofWindow1
. Because we want these bars to expand when the window is resized, be sure to adjust the locking of each:sbHorz
should lock on the sides and bottom (see Figure 2) andsbVert
should lock on the tops and right (see Figure 3). I also like to turn on the "Allow Live Scrolling" option.Call the canvas
cvDisplay
and position it so it fills the remaining portion of the window (just touching the edges of the scrollbars). You'll want to set its locking with all four points locked (see Figure 4).
...End of Excerpt. Please purchase the magazine to read the full article.