private void mainForm_Load(object sender, EventArgs e) { //创建模式 hkm = new HotKeyMananger(this.Handle); modes.Add(this.mnuNormalPlayMode, new NormalPlayMode(real, bm)); modes.Add(this.mnuMakePlayMode, new MakePlayMode(real, bm)); modes.Add(this.mnuRepeatPlayMode, new RepeatPlayMode(real,bm)); modes.Add(this.mnuReviewPlayMode, new ReviewPlayMode(real, bm)); modes.Add(this.mnuBookmarkPlayMode, new BookmarkPlayMode(real, bm)); //设置初始参数 mnuMakePlayMode.Checked = true; this.currentMode = modes[mnuMakePlayMode]; //注册热键 hkm.RegisterHotKey(HotKeyMananger.KeyModifiers.Control, Keys.A); hkm.RegisterHotKey(HotKeyMananger.KeyModifiers.Control, Keys.S); hkm.RegisterHotKey(HotKeyMananger.KeyModifiers.Control, Keys.D); hkm.RegisterHotKey(HotKeyMananger.KeyModifiers.Control, Keys.F); hkm.RegisterHotKey(HotKeyMananger.KeyModifiers.Control, Keys.B); //创建屏幕 bps = new BreakPointScreen(image, bm); bm.setListener(bps); fileName = "start.rm"; //创建播放器 wmp = new WMPLib.WindowsMediaPlayer(); }
/// <summary> /// 根据菜单选项,进行模式改变 /// </summary> /// <param name="sender"></param> private void changeMode(object sender) { ToolStripMenuItem tsmi = (ToolStripMenuItem)sender; if (tsmi.Checked) return; foreach (KeyValuePair<ToolStripMenuItem, PlayMode> item in modes) { if (item.Key == sender) { tsmi.Checked = !tsmi.Checked; currentMode = item.Value; } else { item.Key.Checked = false; } } }