再次感谢你的帮助-
将colorWell中显示的颜色的60x60像素正方形表示插入到textView中的最佳方法是什么?我知道如何引用显示的颜色的值。
再来一次。谢谢。
-paul。
此操作使用colorWell作为发送方。当我将它添加到按钮初始化操作中时,它不起作用:
NSColor *wellColor;
wellColor = [colorWell color];
float
red, green, blue;
red = [wellColor redComponent];
green = [wellColor greenComponent];
blue = [wellColor blueComponent];
[colorWell setColor:wellColor];
[colorWell setColor:[NSColor colorWithCalibratedRed:red green:green blue:blue alpha:1.0]];
wellColor = [colorWell color];
NSRect r = NSMakeRect(190, 130, 100, 100);
NSBezierPath *bp = [NSBezierPath bezierPathWithRect:r];
NSColor *color = wellColor;
[color set];
[bp fill];发布于 2012-08-23 02:30:00
最简单的方法是使用NSTextAttachment并将其附加为图像(绘制纯色填充图像是一项简单的任务,您可以通过基本的绘图文档了解该任务)。否则,您将不得不对文本系统的各个部分进行子类化和自定义,以便为自己腾出空间并在其中绘制颜色。
https://stackoverflow.com/questions/12078743
复制相似问题