using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
Using System. Drawing. Drawing2D;
Public partial class triangle calculator: System. Web. UI. Page
{
Protected void Button1_Click (object sender, EventArgs e)
{
Double area=0, a=0, b=0, c=0, p=0;
Double x1=the Convert. ToDouble (TextBox1. Text);
Double y1.=the Convert ToDouble (TextBox2. Text);
Double x2=the Convert. ToDouble (TextBox3. Text);
Double y2=the Convert. ToDouble (TextBox4. Text);
Double x3=the Convert. ToDouble (TextBox5. Text);
Double y3=the Convert. ToDouble (TextBox6. Text);
A=Math. Sqrt ((x1 - x2) * (x1, x2) + (y1, y2) * (y1, y2));
B=math.h Sqrt ((x1 - x3) * (x1 - x3) + (y1, y3) * (y1, y3));
C=math.h Sqrt ((x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2));
If (a + b & gt; C & amp; & A + c & gt; B & amp; & B + c & gt; A)
{
P=(a + b + c)/2;
Area=math.h Sqrt (p * (p - a) * (p - b) * (p - c));
Label1. Text="is the area of a triangle is:" + area. The ToString ();
}
The else
{
Label1. Text="the three cannot constitute a triangle, please input again".
}
}
Protected void Button2_Click (object sender, EventArgs e)
{
Int the x1=the Convert. ToInt32 (TextBox1. Text);
Int y1.=the Convert ToInt32 (TextBox2. Text);
Int x2=the Convert. ToInt32 (TextBox3. Text);
Int y2=the Convert. ToInt32 (TextBox4. Text);
Int x3=the Convert. ToInt32 (TextBox5. Text);
Int y3=the Convert. ToInt32 (TextBox6. Text);
//create a canvas
Bitmap MyMap=new Bitmap (10, 10);//create a 100 wide, 100 canvas
Graphics g=Graphics. FromImage (MyMap);
//create the brush
Pen Pen=new Pen (Brushes. Black, 2);
//create three coordinate points
Point p=new Point (x1, y1);
Point p2=new Point (x2, y2);
Point p3=new Point (x3, y3);
Point [] p={p1, p2, p3};
Right to Lear (Color. White);
G.D rawPolygon (pen, p);
MyMap. Save (Response OutputStream, System. Drawing. Imaging. ImageFormat. Gif);
MyMap. The Dispose ();
G.D ispose ();
}
}
CodePudding user response:
You just put the images output to the stream, but I don't have write, how to use the front front end also want corresponding processingCodePudding user response:
Is to add an image control? Just started to learn asp, many don't understand, please understanding