PageRenderTime 19ms CodeModel.GetById 14ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/UIMisc.cs

#
C# | 115 lines | 70 code | 14 blank | 31 comment | 0 complexity | 51a3aedb04cccc1de29b235395b2cebd MD5 | raw file
  1/*
  2 * Please leave this Copyright notice in your code if you use it
  3 * Written by Decebal Mihailescu [http://www.codeproject.com/script/articles/list_articles.asp?userid=634640]
  4 */
  5using System;
  6using System.Collections.Generic;
  7using System.Text;
  8using System.ComponentModel;
  9using System.Data;
 10using System.Drawing;
 11using System.Windows.Forms;
 12using System.Runtime.InteropServices;
 13using System.Windows.Forms.Design;
 14
 15namespace FreeTranslator
 16{
 17
 18    //public class MyHook : IMessageFilter
 19    //{
 20    //    public bool PreFilterMessage(ref Message m)
 21    //    {
 22    //        if (m.Msg == 0x0102)//this will give you the key pressed "in your application" 
 23    //        {
 24    //            MessageBox.Show(m.WParam.ToString());
 25    //            return true;
 26    //        }
 27    //        return false;
 28    //    }
 29    //}
 30    //static class Program
 31    //{
 32    //    /// <summary> 
 33    //    /// The main entry point for the application. 
 34    //    /// </summary> 
 35    //    [STAThread]
 36    //    static void Main()
 37    //    {
 38    //        MyHook mh = new MyHook();
 39    //        Application.AddMessageFilter(mh);
 40    //        Application.EnableVisualStyles();
 41    //        Application.SetCompatibleTextRenderingDefault(false);
 42    //        Application.Run(new Form1());
 43    //    }
 44    //}
 45
 46    internal enum VirtualKeys : int
 47    {
 48        VK_LBUTTON = 0x01,
 49        VK_RBUTTON = 0x02,
 50        VK_CANCEL = 0x03,
 51        VK_MBUTTON = 0x04,
 52        VK_XBUTTON1 = 0x05,
 53        VK_XBUTTON2 = 0x6,
 54        VK_BACK = 0x08,
 55        VK_TAB = 0x09,
 56        VK_RETURN = 0x0D,
 57        VK_SHIFT = 0x10,
 58        VK_CONTROL = 0x11,
 59        VK_ESCAPE = 0x1B,
 60        VK_SPACE = 0x20,
 61        VK_LEFT = 0x25,
 62        VK_UP = 0x21,
 63        VK_RIGHT = 0x27,
 64        VK_DOWN = 0x22,
 65        VK_DELETE = 0x2E,
 66        VK_F1 = 0x70,
 67        VK_F2 = 0x71,
 68        VK_F3 = 0x72,
 69        VK_F4 = 0x73,
 70        VK_F5 = 0x74,
 71        VK_F6 = 0x75,
 72        VK_F7 = 0x76,
 73        VK_F8 = 0x77,
 74        VK_F9 = 0x78,
 75        VK_F10 = 0x79,
 76        VK_F11 = 0x7A,
 77        VK_F12 = 0x7B,
 78        VK_F13 = 0x7C,
 79        VK_F14 = 0x7D,
 80    }
 81
 82
 83    [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.ToolStrip | ToolStripItemDesignerAvailability.StatusStrip)]
 84    public class ToolStripCheckedBox : ToolStripControlHost
 85    {
 86
 87        public ToolStripCheckedBox()
 88            : base(new CheckBox())
 89        {
 90
 91        }
 92
 93
 94
 95        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
 96
 97        public CheckBox CheckBox
 98        {
 99
100            get { return (CheckBox)this.Control; }
101
102        }
103
104    }
105    struct Marker
106    {
107        public readonly int source;
108        public readonly int destination;
109        public Marker(int s, int d)
110        {
111            source = s;
112            destination = d;
113        }
114    }
115}