Cs0111(тип уже определяет член)
мне нужна помощь она мой код
/* * Created by Gary Perkin. * Date: 02/11/2004 * Time: 14:30 * */ using System; using System.Windows.Forms; using System.Threading; namespace DefaultNamespace { /// <summary> /// Demo application for vuMeterLED -perhaps not the most elegant design in the world, /// but it gets the job done. /// </summary> public partial class Form1 : System.Windows.Forms.Form { private Gary.Perkin.UserControls.vuMeterLED vuMeterLED2; private Gary.Perkin.UserControls.vuMeterLED vuMeterLED3; private Gary.Perkin.UserControls.vuMeterLED vuMeterLED4; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button1; private System.Windows.Forms.Timer timer1; private Gary.Perkin.UserControls.vuMeterLED vuMeterLED1; int cycleCount; Random r = new Random(); [STAThread] public static void Main(string[] args) { Application.Run(new Form1()); } #region Windows Forms Designer generated code /// <summary> /// 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. /// </summary> public void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.vuMeterLED1 = new Gary.Perkin.UserControls.vuMeterLED(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.vuMeterLED4 = new Gary.Perkin.UserControls.vuMeterLED(); this.vuMeterLED3 = new Gary.Perkin.UserControls.vuMeterLED(); this.vuMeterLED2 = new Gary.Perkin.UserControls.vuMeterLED(); this.SuspendLayout(); // // vuMeterLED1 // vuMeterLED1.Location = new System.Drawing.Point(40, 72); vuMeterLED1.Name = "vuMeterLED1"; vuMeterLED1.Size = new System.Drawing.Size(16, 123); vuMeterLED1.TabIndex = 5; vuMeterLED1.Volume = 0; // // timer1 // this.timer1.Enabled = true; this.timer1.Interval = 500; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // button1 // this.button1.Location = new System.Drawing.Point(24, 16); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(56, 23); this.button1.TabIndex = 1; this.button1.Text = "Start"; this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // this.button2.Location = new System.Drawing.Point(88, 16); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(56, 23); this.button2.TabIndex = 4; this.button2.Text = "Stop"; this.button2.Click += new System.EventHandler(this.button2_Click); // // vuMeterLED4 // this.vuMeterLED4.Location = new System.Drawing.Point(112, 72); this.vuMeterLED4.Name = "vuMeterLED4"; this.vuMeterLED4.Size = new System.Drawing.Size(16, 123); this.vuMeterLED4.TabIndex = 8; this.vuMeterLED4.Volume = 0; // // vuMeterLED3 // this.vuMeterLED3.Location = new System.Drawing.Point(88, 72); this.vuMeterLED3.Name = "vuMeterLED3"; this.vuMeterLED3.Size = new System.Drawing.Size(16, 123); this.vuMeterLED3.TabIndex = 7; this.vuMeterLED3.Volume = 0; // // vuMeterLED2 // this.vuMeterLED2.Location = new System.Drawing.Point(64, 72); this.vuMeterLED2.Name = "vuMeterLED2"; this.vuMeterLED2.Size = new System.Drawing.Size(16, 123); this.vuMeterLED2.TabIndex = 6; this.vuMeterLED2.Volume = 0; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(184, 245); Controls.Add(vuMeterLED4); this.Controls.Add(vuMeterLED3); this.Controls.Add(vuMeterLED2); this.Controls.Add(vuMeterLED1); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Name = "Form1"; this.Opacity = 0.99; this.Text = "vuMeterLED Demo"; this.ResumeLayout(false); } #endregion // Activate each LED in turn, at about 120bpm (500 msec per tick) private void timer1_Tick(object sender, System.EventArgs e) { cycleCount++; LightLEDs(cycleCount); if (cycleCount == 4) cycleCount = 0; } // Light each LED in turn, depending which "beat" we're on private void LightLEDs(int count) { int sleepLength = 100; // Controls speed at which levels decay int rSeed = 15; // Range for random number generator if (count == 1) { for (int j = 5 + (r.Next(rSeed)); j >= 0; j--) { vuMeterLED1.Volume = j; vuMeterLED1.Refresh(); Thread.Sleep(sleepLength / (j + 1)); // Make the LEDs "bounce" } } if (count == 2) { for (int j = 5 + (r.Next(rSeed)); j >= 0; j--) { vuMeterLED2.Volume = j; vuMeterLED2.Refresh(); Thread.Sleep(sleepLength / (j + 1)); // Make the LEDs "bounce" } } if (count == 3) { for (int j = 5 + (r.Next(rSeed)); j >= 0; j--) { vuMeterLED3.Volume = j; vuMeterLED3.Refresh(); Thread.Sleep(sleepLength / (j + 1)); // Make the LEDs "bounce" } } if (count == 4) { for (int j = 5 + (r.Next(rSeed)); j >= 0; j--) { vuMeterLED4.Volume = j; vuMeterLED4.Refresh(); Thread.Sleep(sleepLength / (j + 1)); // Make the LEDs "bounce" } } } private void button1_Click(object sender, System.EventArgs e) { timer1.Start(); } private void button2_Click(object sender, System.EventArgs e) { timer1.Stop(); } } }
я все время получаю ошибку
cs0111(type 'form 1' already defines a member'initialize component')
Что я уже пробовал:
это забавно, потому что я только что избавился от этой линии, чтобы исправить cs0121
public Form1() { InitializeComponent(); }
Richard Deeming
Вот это да partial
класс, так что, вероятно, где-то есть еще одна часть. Скорее всего, вложенный под основной файл, с ".designer" в имени файла.
Вы обнаружите, что у вас есть метод под названием InitializeComponent
в обеих частях.