Hello!

I tried to draw strings in the center of a rectangle. While it's alright to
execute the code, and the font is correctly shown, the alignment is wrong.
(still on the left side...)


the following is the codes for drawing the string. Does anyone know what's
wrong with it? or simply drawing string doesn't support alignment?


NSFont *font = [[[NSFont fontWithName:@"Verdana" size:12.0] retain]
autorelease];

NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];

[style setAlignment:NSCenterTextAlignment];

NSDictionary *attrsDictionary =

[NSDictionary dictionaryWithObjectsAndKeys: font, NSFontAttributeName,
style,NSFontAttributeName,nil];

[style release];

[name drawInRect:aRect withAttributes:attrsDictionary];


Thanks a lot!
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to