Re: NSWindow background image tiled from top-left corner?
Re: NSWindow background image tiled from top-left corner?
- Subject: Re: NSWindow background image tiled from top-left corner?
- From: Scott Ruda <email@hidden>
- Date: Sun, 19 Sep 2004 12:38:15 -0700
On Sep 19, 2004, at 12:22 PM, Rainer Brockerhoff wrote:
At 12:02 -0700 19/09/2004, email@hidden wrote:
From: Scott Ruda <email@hidden>
Date: Sun, 19 Sep 2004 11:57:00 -0700
How can I get a window to have a background image which is tiled and
when the window is resized it grows from the top-left corner instead
of the bottom-left?
Currently I am doing this, but it tiles from the bottom-left, which
looks wrong when the window is live-resized:
[window setBackgroundColor:[NSColor colorWithPatternImage:[NSImage
imageNamed:@"walnut.gif"]]];
After this, add something like:
NSRect windowFrame = [window frame];
NSPoint upperLeftCorner = NSMakePoint(windowFrame.origin.x,
windowFrame.origin.y+windowFrame.size.height);
[[NSGraphicsContext graphicsContextWithWindow:window]
setPatternPhase:upperLeftCorner];
which should do what you want. Disclaimer: compiled in Eudora, etc. ;-)
Hmmm, that didn't work. I'm currently doing all this in the
awakeFromNib of the window's controller. Do I have to subclass the
window and do it in its init method or something special like that?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden