前回もにてる質問をしたのですが、
直したところ新しいエラーが出たので質問させていただきます。
こちらの記事にかかれている内容を順番に進んで、
最後のコードを入力する部分で困ってます。
//Program.cs using System; using System.Drawing; using System.Windows.Forms; namespace NewPro //名前変更から変えました。 { public partial class Form1 : Form { string path; private int mouseX; private int mouseY; public Form1() { InitializeComponent(); //背景透過 this.TransparencyKey = BackColor; //手前表示 this.TopMost = !this.TopMost; } private void Form1_Load(object sender, EventArgs e) { //パスの指定 path = @"Resources\Player.png"; //自分の作った.pngのファイル名に変えました。 show(path); } //画像を表示する private void show(string path) { //フォームの境界線をなくす this.FormBorderStyle = FormBorderStyle.None; //フォームのサイズ変更 size_change(@path); //背景画像を指定する this.BackgroundImage = Image.FromFile(@path); } //ウィンドウの大きさを画像の大きさに変更 private void size_change(string path) { //元画像の縦横サイズを調べる System.Drawing.Bitmap bmpSrc = new System.Drawing.Bitmap(@path); int width = bmpSrc.Width; int height = bmpSrc.Height; //ウィンドウのサイズを変更 this.Size = new Size(width, height); } //マウスドラッグ移動処理 private void Form1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { this.mouseX = e.X; this.mouseY = e.Y; } } private void Form1_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { this.Left += e.X - mouseX; this.Top += e.Y - mouseY; } } } }
エラー
CS0111 (型'Form1'は'.ctor'と呼ばれるメンバーを同じパラメーターの型で既に定義しています)
どなたか解決できる方お願いします....
回答3件
あなたの回答
tips
プレビュー