C # drawing - streamer

xiaoxiao2021-03-06  97

C # drawing - streamer

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

// DrawStreamer.cs by Flycrane

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

Using system;

Using system.drawing;

Using system.windows.forms;

Class Drawstreamer: Form

{

Public static void main ()

{

Application.run (New Drawstreamer ());

}

Public Drawstreamer ()

{

TEXT = "Rifting Pattern - Flycrane";

Backcolor = color.AliceBlue;

Forecolor = color.gold;

Resizeredraw = true;

Width = 600;

HEIGHT = 350;

}

Protected Override Void 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);

}

}

}

Rendering:

references:

CHARLES PETZOLD. Programming Microsoft Windows with c # .microsoft press. 2002.

2. Lu Runmin. C language drawing tutorial. Tsinghua University Press. April 1996 First Edition.

转载请注明原文地址:https://www.9cbs.com/read-124521.html

New Post(0)