首页 > 开发 > 综合 > 正文

C# 绘图--飘带

2024-07-21 02:19:11
字体:
来源:转载
供稿:网友
c# 绘图--飘带

杨贺宏


//-------------------------------------

// drawstreamer.cs by flycrane

//-------------------------------------



using system;



using system.drawing;



using system.windows.forms;






class drawstreamer : form



{



publicstaticvoidmain()



{



application.run( new drawstreamer() );



}



public drawstreamer()



{



text= "飘带图案-flycrane";



backcolor= color.aliceblue;



forecolor= color.gold;



resizeredraw= true;



width= 600;



height= 350;



}






protectedoverridevoid onpaint(painteventargs e)



{



graphics mygraphics= e.graphics;



pen mypen= new pen( forecolor,2 );




// center of the circle.



float originx=clientsize.width/2;



float originy=clientsize.height;





float x1,x2,y1;





// draw streamer,which comprise series of horizontal line segment;

for ( double a=0;a<=math.pi ;a+=math.pi/380 )

{

x1 =(float) ( 280*math.cos( 1.6*a ) +originx );

y1 =(float) ( 479-( ( 90*math.sin( 8*a ) )*math.cos( a/2.5 )+originy ) );

x2 =(float) ( 280*math.cos( 1.8*a )+originx );



mygraphics.drawline ( mypen,x1,y1,x2,y1);

}







}



}





收集最实用的网页特效代码!

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表