此人已疯
当你有了仁慈之心,你就不再是妖了,是人妖!

这是画一个立体感的圆柱代码,自己组织下:
private void TestForm_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
DrawVertPipe(e.Graphics);
}

private void DrawVertPipe(System.Drawing.Graphics g)
{
System.Drawing.Drawing2D.GraphicsContainer gCon;
gCon = g.BeginContainer();
Rectangle bound=new Rectangle(50,50,50,50);
GraphicsPath gp = new GraphicsPath();
g.SmoothingMode = SmoothingMode.AntiAlias;
gp.AddRectangle(bound);
g.FillPath(new SolidBrush(Color.Violet),gp);
FillCylinderShadow(g,gp,0.5f,Color.FromArgb(100, 0, 0, 0),Color.FromArgb(100, Color.White));   
gp.Dispose();
g.EndContainer(gCon);
}
public void FillCylinderShadow(Graphics g,GraphicsPath gp,float focus,Color BeginColor,Color EndColor)
{
 
LinearGradientBrush linGrBrush = new LinearGradientBrush(
gp.PathPoints[0],gp.PathPoints[1],
BeginColor,     
EndColor
);  
linGrBrush.SetSigmaBellShape(focus);
g.FillPath(linGrBrush, gp);

linGrBrush.Dispose();
}

posted on 2006-06-26 15:33  此人已疯  阅读(453)  评论(0)    收藏  举报