void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (listBox1.SelectedIndex == -1) { return; } if (shaderRenderer1.shader != null) { shaderRenderer1.OnStop += shaderRenderer1_OnStop; ShaderRenderer.Stop(); } else { shaderRenderer1_OnStop(sender, e); } }
protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); ShaderRenderer.Stop(); }