Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 19.2 ('Shake It')
Instant purchase and download via GumRoad!

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):

Download Icon 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 a graphics 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: a canvas, a horizontal scrollbar, and a vertical scrollbar (see Figure 1).

Name the scrollbars sbHorz and sbVert and put them on the bottom and right sides of the window. Extend their size to fill the full width and height of Window1. 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) and sbVert 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.