黑莓圆形按钮的厚边框
我明白了...我想要下面的图片
我是 Blackberry 新手。
我想为应用程序中的圆形按钮字段提供粗边框。
下面是我的代码。
我创建了一个 CustomBasicEditField 类。
protected void paint(Graphics graphics)
{
int x = (this.getWidth() - getFont().getAdvance(text)) >> 1;
int y = (this.getHeight() - getFont().getHeight()) >> 1;
graphics.setColor(backgroundColour);
graphics.fillRoundRect(0, 0, fieldWidth, fieldHeight, 40, 40);
graphics.setColor(border_color);
graphics.setStrokeWidth(5);
graphics.drawRoundRect(0, 0, fieldWidth, fieldHeight, 40, 40);
graphics.setColor(0x2bb1ff);
graphics.setFont(myFont);
graphics.drawText(text, x, y);
super.paint(graphics);
}
如果我制作drawRoundRect(0,0,fieldWidth,fieldHeight,0,0),那么它会打印一个带有粗边框的正方形。
但我不想要一个正方形。当我保留上面的代码时,它确实创建了一个圆形编辑框,但边框很细。
提前致谢。
I am getting this... I want the below imageI am newbee in Blackberry.
I want to give thick border to the rounded button field in my application.
Below is my code.
I have created a CustomBasicEditField class.
protected void paint(Graphics graphics)
{
int x = (this.getWidth() - getFont().getAdvance(text)) >> 1;
int y = (this.getHeight() - getFont().getHeight()) >> 1;
graphics.setColor(backgroundColour);
graphics.fillRoundRect(0, 0, fieldWidth, fieldHeight, 40, 40);
graphics.setColor(border_color);
graphics.setStrokeWidth(5);
graphics.drawRoundRect(0, 0, fieldWidth, fieldHeight, 40, 40);
graphics.setColor(0x2bb1ff);
graphics.setFont(myFont);
graphics.drawText(text, x, y);
super.paint(graphics);
}
If I make drawRoundRect(0,0,fieldWidth, fieldHeight, 0, 0), then it prints a square with thick border.
But I don't want a square. When I keep the above code, it does create a rounded edit box but a thin border.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
试试这个代码:
我得到这样的:
Try this code:
I got like this:
试试这个,效果很好。
Try this, it work fine.