📜  VLC .net - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:12.894000             🧑  作者: Mango

代码示例1
1public void ShortcutEvent(object sender, KeyEventArgs e)
 2{
 3    if (e.KeyCode == Keys.Escape && isFullscreen) // from fullscreen to window
 4    {
 5        this.FormBorderStyle = FormBorderStyle.Sizable; // change form style
 6        this.WindowState = FormWindowState.Normal; // back to normal size
 7        this.Size = oldFormSize;
 8        menuStrip1.Visible = true; // the return of the menu strip 
 9        videoView1.Size = oldVideoSize; // make video the same size as the form
10        videoView1.Location = oldVideoLocation; // remove the offset
11        isFullscreen = false;
12    }
13
14    if (isPlaying) // while the video is playing
15    {
16        if (e.KeyCode == Keys.Space) // Pause and Play
17        {
18            if (_mp.State == VLCState.Playing) // if is playing
19            {
20                _mp.Pause(); // pause
21            }
22            else // it's not playing?
23            {
24                _mp.Play(); // play
25            }
26        }
27
28        if (e.KeyCode == Keys.J) // skip 1% backwards
29        {
30            _mp.Position -= 0.01f;
31        }
32        if (e.KeyCode == Keys.L) // skip 1% forwards
33        {
34            _mp.Position += 0.01f;
35        }
36    }
37}