• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: re Hiding controls and another question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: re Hiding controls and another question


  • Subject: Re: re Hiding controls and another question
  • From: Timothy Ritchey <email@hidden>
  • Date: Fri, 1 Mar 2002 08:05:15 -0500

While I'm asking is there any way to make a picture stretch to fit in a button?? (also simple in Carbon)


not tested, but something like this should do it. Subclass NSButtonCell, and override the drawInteriorWithFrame:inView:

- (void)drawInteriorWithFrame:aRect inView:aView
{
NSSize size = [[self image] size];
[[self image] drawInRect:aRect
fromRect:NSMakeRect(0,0,size.width, size.height)
operation:NSCompositeSourceOver // <-- or whatever op you want
fraction:1.0];
}

If the two rectangles are not the same size, the image will be stretched, shrunk, whatever.



- tim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: re Hiding controls and another question
  • Next by Date: Re: NSMovieView & movie controller separating :-0
  • Previous by thread: Re: re Hiding controls and another question
  • Next by thread: Re: re Hiding controls and another question
  • Index(es):
    • Date
    • Thread