//通道显示改变事件 private void isShow_Changed(object sender) { ChannelListItem chan = (ChannelListItem)sender; if (chan.isShow) { channel.Chans[chan.chID].ChannelIsShow = true; } else { channel.Chans[chan.chID].ChannelIsShow = false; } showWave(); }
//添加通道按钮 private void button2_Click(object sender, EventArgs e) { //添加通道 channel.AddChannel(100); ChannelListItem chan = new ChannelListItem(); int chanCount = 0; foreach (Control c in panelBottom.Controls) { if (c is ChannelListItem) { chanCount++; } } chan.Name = channel.Chans[chanCount].ChannelName; chan.chColor = channel.Chans[chanCount].ChannelColor; chan.Location = new Point(12, 140); panelBottom.Controls.Add(chan); panelBottom.VerticalScroll.Value = panelBottom.VerticalScroll.Maximum; //添加选项卡 slideTab.AddTab(channel.Chans[chanCount].ChannelColor); }
//窗体加载 private void WaveOs_Load(object sender, EventArgs e) { //tab选项卡 slideTab.Location = new Point(9, 13); slideTab.tabDefaultCount = 4; //初始化四个通道 for (int i = 0; i < 4; i++) { channel.AddChannel(100); switch (i) { case 0: channel.Chans[i].ChannelType = ChannelType.input; channel.Chans[i].ChannelColor = Color.FromArgb(255, 24, 206, 180); break; case 1: channel.Chans[i].ChannelType = ChannelType.output; channel.Chans[i].ChannelColor = Color.FromArgb(255, 244, 200, 49); break; case 2: channel.Chans[i].ChannelType = ChannelType.composite; channel.Chans[i].ChannelColor = Color.FromArgb(255, 255, 76, 118); break; case 3: channel.Chans[i].ChannelType = ChannelType.function; channel.Chans[i].ChannelColor = Color.FromArgb(255, 117, 94, 255); break; } ch[i] = new ChannelListItem(); ch[i].chID = channel.Chans[i].ChannelID; ch[i].Name = channel.Chans[i].ChannelName; ch[i].chColor = channel.Chans[i].ChannelColor; ch[i].icon = DisposeIcon(i); ch[i].Size = new Size(1870, 35); ch[i].Location = new Point(12, i * 35); ch[i].isShowChanged += new ChannelListItem.ChangedEventHandler(this.isShow_Changed); panelBottom.Controls.Add(ch[i]); slideTab.tabColors.Add(channel.Chans[i].ChannelColor); } panelTopRight.Controls.Add(slideTab); //通道面板初始化 comboChannelType.SelectedItem = returnCombo(channel.Chans[chanSID].ChannelType); comboChannelInterface.SelectedItem = returnCombo(channel.Chans[chanSID].Interface); labDataSource.Text = Convert.ToString(channel.Chans[chanSID].InterfaceValue); xian0.BackColor = xian1.BackColor = xian2.BackColor = channel.Chans[chanSID].ChannelColor; //初始化显示界面网格 gShow = pbDisplay.CreateGraphics(); bmpBuffer = new Bitmap(pbDisplay.Width, pbDisplay.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); bmpGrid = (Bitmap)bmpBuffer.Clone(); gBuffer = Graphics.FromImage(bmpBuffer); gGrid = Graphics.FromImage(bmpGrid); gBuffer.ResetTransform(); gBuffer.TranslateTransform(0, 300); this.comboFold_x.SelectedItem = "1X"; this.comboFold_y.SelectedItem = "1X"; }