private void tMenuItemShowType_Click(object sender, EventArgs e) { ToolStripMenuItem tsMenuItem = (sender as ToolStripMenuItem); if (tsMenuItem == null) { return; } if (this.State == IMLibrary3.Enmu.ShowType.Offline) { tButShowType.Image = tMenuItemStateOffline.Image; labShowType.Text = tMenuItemStateOffline.Text; } else if (OldState == IMLibrary3.Enmu.ShowType.Offline && //如果原值为离线,并且新值不为在线 (IMLibrary3.Enmu.ShowType)tsMenuItem.Tag != IMLibrary3.Enmu.ShowType.Offline) { tButShowType.Image = tMenuItemStateOffline.Image; labShowType.Text = tMenuItemStateOffline.Text; } else if (OldState != (IMLibrary3.Enmu.ShowType)tsMenuItem.Tag) //如果原值为在线,现值为离线 { tButShowType.Image = tsMenuItem.Image; this.labShowType.Text = tsMenuItem.Text; } OldState = (IMLibrary3.Enmu.ShowType)tsMenuItem.Tag; tButShowType.ToolTipText = tsMenuItem.Text; if (ShowTypeChanged != null) { ShowTypeChanged(this, new ShowTypeEventArgs((IMLibrary3.Enmu.ShowType)tsMenuItem.Tag, tsMenuItem.Text)); } }
private void tMenuItemShowType_Click(object sender, EventArgs e) { ToolStripMenuItem tsMenuItem = (sender as ToolStripMenuItem); if (tsMenuItem == null) return; if (this.State == IMLibrary3.Enmu.ShowType.Offline) { tButShowType.Image = tMenuItemStateOffline.Image; labShowType.Text = tMenuItemStateOffline.Text; } else if (OldState == IMLibrary3.Enmu.ShowType.Offline && //如果原值为离线,并且新值不为在线 (IMLibrary3.Enmu.ShowType)tsMenuItem.Tag != IMLibrary3.Enmu.ShowType.Offline) { tButShowType.Image = tMenuItemStateOffline.Image; labShowType.Text = tMenuItemStateOffline.Text; } else if (OldState != (IMLibrary3.Enmu.ShowType)tsMenuItem.Tag) //如果原值为在线,现值为离线 { tButShowType.Image = tsMenuItem.Image; this.labShowType.Text = tsMenuItem.Text; } OldState = (IMLibrary3.Enmu.ShowType)tsMenuItem.Tag; tButShowType.ToolTipText = tsMenuItem.Text; if (ShowTypeChanged != null) ShowTypeChanged(this, new ShowTypeEventArgs((IMLibrary3.Enmu.ShowType)tsMenuItem.Tag, tsMenuItem.Text)); }
public ShowTypeEventArgs(IMLibrary3.Enmu.ShowType ShowType, string ShowTypeString) { this.ShowType = ShowType; this.ShowTypeString = ShowTypeString; }