NSButton how to color the text

后端 未结 12 1529
伪装坚强ぢ
伪装坚强ぢ 2020-12-13 00:35

on OSX I have an NSButton with a pretty dark image and unfortunately it is not possible to change the color using the attributes inspector. See picture the big black button,

12条回答
  •  旧时难觅i
    2020-12-13 01:07

    NSColor color = NSColor.White;  
    NSMutableAttributedString colorTitle = new NSMutableAttributedString (cb.Cell.Title);                
    NSRange titleRange = new NSRange (0, (nint)cb.Cell.Title.Length);
    colorTitle.AddAttribute (NSStringAttributeKey.ForegroundColor, color, titleRange);      
    cb.Cell.AttributedTitle = colorTitle;  
    

提交回复
热议问题