比较尴尬自己研究半天也一点没研究出来。
要求是这样的:
编写打印三角形算法程序,根据角度绘制直线。(要求放置三个编辑框,输入不同的角度,形成不同的三角形)
小弟在此谢过了能不能毕业就靠你们了。

解决方案 »

  1.   

    http://download.csdn.net/source/1154026
      

  2.   

    你在这里问这个问题。估计没有多少人会害你。
               System.Drawing.Graphics g = this.CreateGraphics();
                g.DrawPolygon 你试试自己用这个试试。
    如果你想干这行的话
    需要努力啊。
      

  3.   

    ?? 可怜的娃娃. 你是用什么东西画出来的啊?
    用gdi 画就行了啊
      

  4.   

    我用过。画验证码就是用Graphics画的。
    问题是老师让输入角度,只要符合三角形内角和,就可以任意画三角形。
      

  5.   

    看看GDI+吧,楼上的g.DrawPolygon应该不符合要角度的题意
      

  6.   


    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;namespace WindowsApplication263
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        void button1_Click(object sender, EventArgs e)
            {
                double A1 = double.Parse(textBox1.Text);
                double A2 = double.Parse(textBox2.Text);
                double A3 = double.Parse(textBox3.Text);            if (A1 + A2 + A3 != 180)
                {
                    MessageBox.Show("内角之合必须等于180度");
                    return;
                }            Bitmap Bmp = new Bitmap(100, 100);
                
                using (Graphics G = Graphics.FromImage(Bmp))
                {
                    PointF[] PS=new PointF[4];
                    
                    PS[0]= new Point(50, 50);                double LC = 30;
                    double LM = Math.Sin(A1 * Math.PI / 180) * LC;
                    double LA1 =Math.Cos(A1 * Math.PI / 180) * LC;                PS[1] = PointF.Add(PS[0], new SizeF((float)LA1, (float)-LM));                double LA2 = LM / Math.Tan(A2 * Math.PI / 180);                PS[2] = PointF.Add(PS[1], new SizeF((float)LA2, (float)LM));                PS[3] = new Point(50, 50);                G.DrawLines(Pens.Red, PS); 
                }            pictureBox1.Image = Bmp;
            }
        }
    }
      

  7.   

    using System;
    using System.Collections.Generic;
    using System.Windows.Forms;
    using System.Drawing; 
    public class MyClass:Form
    {
     private  int  Length=200; //一条边的长度
     private  Point[] p=new Point[4];
     private int start_x=0,start_y=0;
     private int jiaodu_1=100; //角度1
     private int jiaodu_2=30; //角度2
     
    public static void Main()
    {
     Application.Run(new MyClass()); 
    }
    //初始化初
    public MyClass()
    {
    start_x=this.Width/2;
    start_y=this.Height/2;
    this.p[0]=new Point(start_x,start_y); //起点
    this.p[1]=new Point(start_x+this.Length,start_y); //第二个点
    //this.p[2]=new Point(0,0);
    this.p[3]=this.p[0];                 //回到起点
    this.ResizeRedraw=true;
    }
    //重载 OnPaint函数
        protected  override void OnPaint(PaintEventArgs pea)
    {
           this.Compult();
       Graphics grfx=pea.Graphics;
       grfx.DrawLines(System.Drawing.Pens.Black ,this.p  ); }
    ///计算第三个坐标
    public void Compult()
    {
    double  k1=Math.Tan((this.jiaodu_1* Math.PI) / 180);
    double  k2=Math.Tan((this.jiaodu_2* Math.PI) / 180);
            double x1=(double)this.p[0].X;
    double y1=(double)this.p[0].Y;
    double x2=(double)this.p[1].X;
    double y2=(double)this.p[1].Y;
    double x3=(k1*x1-k2*x2+y2-y1)/(k1-k2); // 初中时候公式
    double y3=(x3-x1)*k1+y1;
    this.p[2]=new Point((int)x3,(int)y3);

     
    }
    }
    估计 还有问题 你在琢磨琢磨吧