PDA

View Full Version : درخواست توضیح کد نمودار سینوس



زهرا علیزاده
شنبه 18 دی 1395, 16:19 عصر
سلام اگر ممکنه میشه یه نفر اینو توضیح بده؟؟


Random r = new Random();
string file = "~/image.jpg";
static Bitmap img = new Bitmap(520, 520);
Graphics g = Graphics.FromImage(img);
static int w = 500, h = 500, ox, oy, ofsx = 10, ofsy = 10;



protected void btn_sin_Click(object sender, EventArgs e)
{
int x_math, y_math, x_com, y_com;
double r;
Brush b = new SolidBrush(Color.Red);
for (x_math = -180; x_math <= 180; x_math++)
{
x_com = ox + x_math;
r = x_math * Math.PI / 180;
y_math = Convert.ToInt32(100 * Math.Sin(r));
y_com = oy - y_math;
g.FillEllipse(b, x_com, y_com, 3, 3);
}
img.Save(Server.MapPath(file), ImageFormat.Jpeg);
web_img.ImageUrl = file;
}