开发者

how to draw a slanting line in blackberry using Graphics class

I want to know,how to draw the slanting line with thickness using the graphics.Any ideas how to achieve this?

Regards

Rakes开发者_运维问答h Shankar.P


The drawLine() method will draw a straight line in any direction, including on a "slant." If you want the line to be thicker than a single pixel, then simply call drawLine() multiple times, adjusting the start and end points. So for example, to draw a horizontal line that is two pixels thick:

g.drawLine(10, 10, 110, 10);
g.drawLine(10, 11, 110, 11);


Another possibility would be to draw a rectangle:

int[] xPts = { 20, 40, 240, 220 };
int[] yPts = { 40, 20, 220, 240 };
graphics.setColor(Color.GREEN);
graphics.drawFilledPath(xPts, yPts, null, null);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜