绘制阴影线条和形状 [英] Drawing shaded lines and shapes

查看:69
本文介绍了绘制阴影线条和形状的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在45度角(或任何其他

color)。


我可以通过使用GraphicsPath对象获取该行,但无法计算出

着色部分。


这也可以说是一个外线宽度为10px的圆圈来自

从内到外围绕着红色到灰色的阴影

圈子。


TIA

JB

解决方案



" John Baro" <乔*** @ NOSPAMmesware.com.au>在留言中写道

news:3z ****************** @ news-server.bigpond.net.au ...

我希望在45度角(或任何其他角度)画一条10px宽的线,然后将它从灰色再到红色再说成灰色(或任何其他颜色)。

我可以通过使用GraphicsPath对象来获取该行,但无法找到
着色部分。

这也可以说是一个带外线的圆圈宽度为10px
从圆圈周围从内到外从红色变为灰色。

TIA
JB


如下所示:


protected override void OnPaint(PaintEventArgs e)


{


base.OnPaint(e);


刷b =新的LinearGradientBrush(新点(10,10),全新Point(100,100),

Color.Gray,Color.Red);


Pen p = new Pen(b,2);


e.Graphics.Dr awLine(p,new Point(10,10),new Point(100,100));


刷b1 = new LinearGradientBrush(new Point(100,100),new Point(200,200),

Color.Red,Color.Gray);


笔p1 =新笔(b1,2);


e.Graphics.DrawLine(p1,new Point(100,100),new Point(200,200));


}


" John气压" <乔*** @ NOSPAMmesware.com.au>在留言中写道

news:3z ****************** @ news-server.bigpond.net.au ...

我希望在45度角(或任何其他角度)画一条10px宽的线,然后将它从灰色再到红色再说成灰色(或任何其他颜色)。

我可以通过使用GraphicsPath对象来获取该行,但无法找到
着色部分。

这也可以说是一个带外线的圆圈宽度为10px
从圆圈周围从内到外从红色变为灰色。

TIA
JB


感谢回复Malek


我忘记提到它必须沿着轴线呈蓝色,并呈蓝色。

这条线。

即如果线是扁平的,那么沿着顶部的红色到中间的蓝色和

再次回到红色底部,但又是45度角。


干杯

JB


" Malek" <柯**** @ arrabeta.com>在消息中写道

news:%2 ****************** @ TK2MSFTNGP11.phx.gbl ...

如下所示:

受保护的覆盖void OnPaint(PaintEventArgs e)


base.OnPaint(e);

画笔b =新的LinearGradientBrush(新点(10,10),新点(100,100),
Color.Gray,Color.Red);

笔p =新笔( b,2);

e.Graphics.DrawLine(p,new Point(10,10),new Point(100,100));

Brush b1 = new LinearGradientBrush(新点(100,100),新点(200,200),
Color.Red,Color.Gray);

笔p1 =新笔(b1,2);

e.Graphics.DrawLine(p1,new Point(100,100),new Point(200,200));

}

" John Baro" <乔*** @ NOSPAMmesware.com.au>在消息中写道
新闻:3z ****************** @ news-server.bigpond.net.au ...

我希望在45度角(或任何其他角度)画一条10px宽的线,并将它从灰色再到红色再说灰​​色(或任何
其他颜色)。

我可以通过使用GraphicsPath对象来获取该行,但是无法计算出阴影部分的


这也可以说是一个外线宽为$ b的圆圈$ b 10px

to

从内到外围绕圆圈从红色变为灰色



of圈子。

TIA
JB




I wish to draw a line say 10px wide at a 45 degree angle (or any other
angle) and have it shaded say from gray to red to gray again (or any other
color).

I can get the line by using a GraphicsPath object but cannot work out the
shading part.

Is this also possible for say a circle with an outside line width of 10px to
be shaded from red to gray from the inside out around the circumference of
the circle.

TIA
JB

解决方案


"John Baro" <jo***@NOSPAMmesware.com.au> wrote in message
news:3z******************@news-server.bigpond.net.au...

I wish to draw a line say 10px wide at a 45 degree angle (or any other
angle) and have it shaded say from gray to red to gray again (or any other
color).

I can get the line by using a GraphicsPath object but cannot work out the
shading part.

Is this also possible for say a circle with an outside line width of 10px to be shaded from red to gray from the inside out around the circumference of
the circle.

TIA
JB



how about something like :

protected override void OnPaint(PaintEventArgs e)

{

base.OnPaint (e);

Brush b = new LinearGradientBrush(new Point(10,10),new Point(100,100),
Color.Gray, Color.Red);

Pen p = new Pen(b,2);

e.Graphics.DrawLine(p,new Point(10,10),new Point(100,100));

Brush b1 = new LinearGradientBrush(new Point(100,100),new Point(200,200),
Color.Red, Color.Gray);

Pen p1 = new Pen(b1,2);

e.Graphics.DrawLine(p1,new Point(100,100),new Point(200,200));

}

"John Baro" <jo***@NOSPAMmesware.com.au> wrote in message
news:3z******************@news-server.bigpond.net.au...

I wish to draw a line say 10px wide at a 45 degree angle (or any other
angle) and have it shaded say from gray to red to gray again (or any other
color).

I can get the line by using a GraphicsPath object but cannot work out the
shading part.

Is this also possible for say a circle with an outside line width of 10px to be shaded from red to gray from the inside out around the circumference of
the circle.

TIA
JB



Thanks for the reply Malek

I forgot to mention that it has to be shaded blue red blue along the axis of
the line.
i.e. if the line was flat then red along the top to blue in the middle and
back to red again at the bottom but again on a 45 angle.

Cheers
JB

"Malek" <ke****@arrabeta.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...

how about something like :

protected override void OnPaint(PaintEventArgs e)

{

base.OnPaint (e);

Brush b = new LinearGradientBrush(new Point(10,10),new Point(100,100),
Color.Gray, Color.Red);

Pen p = new Pen(b,2);

e.Graphics.DrawLine(p,new Point(10,10),new Point(100,100));

Brush b1 = new LinearGradientBrush(new Point(100,100),new Point(200,200),
Color.Red, Color.Gray);

Pen p1 = new Pen(b1,2);

e.Graphics.DrawLine(p1,new Point(100,100),new Point(200,200));

}

"John Baro" <jo***@NOSPAMmesware.com.au> wrote in message
news:3z******************@news-server.bigpond.net.au...

I wish to draw a line say 10px wide at a 45 degree angle (or any other
angle) and have it shaded say from gray to red to gray again (or any other color).

I can get the line by using a GraphicsPath object but cannot work out the shading part.

Is this also possible for say a circle with an outside line width of 10px

to

be shaded from red to gray from the inside out around the circumference


of the circle.

TIA
JB




这篇关于绘制阴影线条和形状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆