用c#在集成环境中如何编写等腰三角形?求详细代码

 我来答
727617686
2012-05-11 · TA获得超过712个赞
知道小有建树答主
回答量:560
采纳率:0%
帮助的人:314万
展开全部
我日,那么简单,是在窗体上画三角形吗,
追问
应该是的吧、、帮别人问的
追答
namespace DrawTrangle
{
partial class MainForm
{
///
/// Designer variable used to keep track of non-visual components.
///
private System.ComponentModel.IContainer components = null;

///
/// Disposes resources used by the form.
///
/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing) {
if (components != null) {
components.Dispose();
}
}
base.Dispose(disposing);
}

///
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
///
private void InitializeComponent()
{
//
// MainForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Text = "DrawTrangle";
this.Name = "MainForm";
}
}
}

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

namespace DrawTrangle
{
///
/// Description of MainForm.
///
public partial class MainForm : Form
{
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();

//
// TODO: Add constructor code after the InitializeComponent() call.
//
}

protected override void OnPaint(PaintEventArgs e)
{
Point pt1 = new Point (150,200);
Point pt2 = new Point (150,400);
Point pt3 = new Point (300,300);
Pen p = new Pen (Color.Green);
base.OnPaint(e);
e.Graphics.DrawLine(p,pt1,pt2);
e.Graphics.DrawLine(p,pt2,pt3);
e.Graphics.DrawLine(p,pt3,pt1);
p.Dispose();
e.Dispose();
}
}
}
匿名用户
2012-05-11
展开全部
我额额额
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式