专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > C++ Builder

程序出现参数有冲突 各位指点一下解决方法

发布时间:2011-06-28 14:06:23 文章来源:www.iduyao.cn 采编人员:星星草
程序出现参数有冲突 各位指点一下
下面是一个简单c#程序 但不知怎么出现参数冲突 软件没有给位置给我 不知在何处 怎样改 好晕
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace windows_表单
{
   
  public partial class myfirstwinform: Form
  {
  public myfirstwinform()
  {
  InitializeComponent();
  }

  private void Form1_Load(object sender, EventArgs e)
  {}
  private System.Windows.Forms.Label mytextlabel;
  private System.Windows.Forms.Button mycancelbutton;
  public myfirstwinform()
  {
  //创建对象
  this.mytextlabel=new System.Windows.Forms.Label();
  this.mycancelbutton=new System.Windows.Forms.Button();
  this.Text="我的表单";
  //设置标签
  this.mytextlabel.Location=new System.Drawing.Point(18,24);
  this.mytextlabel.Text="这是一个简单的windows表单";
  this.mytextlabel.Size=new System.Drawing.Size(200,24);
  //设置取消按钮
  this.mycancelbutton.Location=new System.Drawing.Point(148,200);
  this.mycancelbutton.Size=new System.Drawing.Size(112,24);
  this.mycancelbutton.Text="取消";
  //设置事件
  mycancelbutton.Click+=new EventHandler(mycancelbutton_Click);
  //添加控件
  this.AutoScaleDimensions=new System.Drawing.Size(5,12);
  this.ClientSize=new System.Drawing.Size(200,200);
  this.Controls.Add(this.mycancelbutton);
  this.Controls.Add(this.mytextlabel);


  }
   
  //退出事件
   
  public static void main()
  {
  Application.Run(new myfirstwinform());
  }

  private void button1_Click(object sender, EventArgs e)
  {
  Application.Exit();
   
  }

  private void textBox1_TextChanged(object sender, EventArgs e)
  {
   
  }  
  }
  }


------解决方案--------------------
两个缺省构造函数

public myfirstwinform() 

InitializeComponent(); 



public myfirstwinform() 

//创建对象 
this.mytextlabel=new System.Windows.Forms.Label(); 
this.mycancelbutton=new System.Windows.Forms.Button(); 
this.Text="我的表单"; 
//设置标签 
this.mytextlabel.Location=new System.Drawing.Point(18,24); 
this.mytextlabel.Text="这是一个简单的windows表单"; 
this.mytextlabel.Size=new System.Drawing.Size(200,24); 
//设置取消按钮 
this.mycancelbutton.Location=new System.Drawing.Point(148,200); 
this.mycancelbutton.Size=new System.Drawing.Size(112,24); 
this.mycancelbutton.Text="取消"; 
//设置事件 
mycancelbutton.Click+=new EventHandler(mycancelbutton_Click); 
//添加控件 
this.AutoScaleDimensions=new System.Drawing.Size(5,12); 
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: