summaryrefslogtreecommitdiff
path: root/script-editor/CustomControl.cs
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2010-06-10 15:30:25 -0700
committerPixel <pixel@nobis-crew.org>2010-06-10 15:30:25 -0700
commitdd86dcc28629225881de61f63394132eb0cb0e2a (patch)
tree26bcfb8c0e64117e9a4489c308adf9ca7940319f /script-editor/CustomControl.cs
parentc07307cb655e8449bb05052ec28993857ac27836 (diff)
parentbb7745a988db1c4be68e4b12b51e16a7e5a21f8e (diff)
Merge branch 'master' of ssh+git://git.grumpycoder.net/pub/repo.git/VP-hack
Diffstat (limited to 'script-editor/CustomControl.cs')
-rw-r--r--script-editor/CustomControl.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/script-editor/CustomControl.cs b/script-editor/CustomControl.cs
new file mode 100644
index 0000000..829565c
--- /dev/null
+++ b/script-editor/CustomControl.cs
@@ -0,0 +1,35 @@
+using System.Windows.Forms;
+
+namespace CustomControl
+{
+ public class MyPanel : Panel
+ {
+ protected override void OnPaintBackground(PaintEventArgs pevent) { }
+ }
+
+ public class MyRichTextBox : RichTextBox
+ {
+ private bool allowedKeypress;
+
+ protected override void OnKeyPress(KeyPressEventArgs e)
+ {
+ e.Handled = true;
+ if (!allowedKeypress)
+ System.Media.SystemSounds.Beep.Play();
+ }
+
+ protected override void OnKeyDown(KeyEventArgs e)
+ {
+ allowedKeypress = e.Control && (e.KeyCode == Keys.A || e.KeyCode == Keys.C || e.KeyCode == Keys.Insert || e.KeyCode == Keys.Y || e.KeyCode == Keys.Z);
+
+ if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Back || e.KeyCode == Keys.Delete || (e.Control && (e.KeyCode == Keys.V || e.KeyCode == Keys.X)) || (e.Shift && (e.KeyCode == Keys.Insert || e.KeyCode == Keys.Delete)))
+ {
+ if (e.KeyCode == Keys.Delete || (e.Shift && (e.KeyCode == Keys.Insert || e.KeyCode == Keys.Delete)))
+ System.Media.SystemSounds.Beep.Play();
+ e.Handled = true;
+ }
+ else
+ base.OnKeyDown(e);
+ }
+ }
+}