Inheritance: System.Windows.Forms.Form
コード例 #1
0
ファイル: FormMain.cs プロジェクト: sytone/XBMC_WebBrowser
 private void InitCursor()
 {
     //Show the cursor
     if (useCustomCursor)
     {
         Cursor.Hide();
         formCursor = new FormCursor();
         String cursorPath = userDataFolder + "\\cursor.png";
         Bitmap oImage = null;
         if (File.Exists(cursorPath))
         {
             oImage = new Bitmap(cursorPath);
         }
         else
         {
             oImage = new Bitmap(XBMC_WebBrowser.Properties.Resources.cursorBlue);
         }
         formCursor.BackgroundImage = oImage;
         formCursor.MinimumSize = new System.Drawing.Size(32, 32);
         formCursor.Size = new System.Drawing.Size(customCursorSize, customCursorSize);
         formCursor.Location = new Point(Cursor.Position.X + 1, Cursor.Position.Y + 1);
         formCursor.Show();
     }
 }
コード例 #2
0
ファイル: FormMain.cs プロジェクト: Gmemerson/XBMC_WebBrowser
        public FormMain(String[] args)
        {
            InitializeComponent();

            mainTitle        = "";
            mainUrl          = "http://www.imdb.com/";
            userAgent        = "";
            minMouseSpeed    = 10;
            maxMouseSpeed    = 10;
            userDataFolder   = "";
            zoom             = 100;
            magnifierWidth   = 1280;
            magnifierHeigth  = 720;
            magnifierZoom    = 3;
            showPopups       = false;
            showScrollBar    = true;
            useCustomCursor  = true;
            customCursorSize = 64;
            mouseEnabled     = true;
            scrollSpeed      = 20;

            if (args.Length > 0)
            {
                userDataFolder = args[0].Replace("\"", "");
                mainTitle      = args[1].Replace("\"", "");
                mainUrl        = Uri.UnescapeDataString(args[2]);
                zoom           = Convert.ToInt32(args[3]);
                showPopups     = (args[4] == "yes");
                minMouseSpeed  = Convert.ToInt32(args[5]);
                maxMouseSpeed  = Convert.ToInt32(args[6]);
                String[] spl = args[7].Split('x');
                magnifierWidth   = Convert.ToInt32(spl[0]);
                magnifierHeigth  = Convert.ToInt32(spl[1]);
                useCustomCursor  = (args[8] == "true");
                customCursorSize = Convert.ToInt32(args[9]);
                showScrollBar    = (args[10] == "yes");
                scrollSpeed      = Convert.ToInt32(args[11]);
                userAgent        = args[12].Replace("\"", "");
            }

            //When using Windows
            String file  = userDataFolder + "\\keymap";
            String file2 = "C:\\xbmc_webbrowser\\keymap";

            if (File.Exists(file))
            {
                importKeymap(file);
            }
            //When using Wine
            else if (File.Exists(file2))
            {
                importKeymap(file2);
            }
            //Default key mapping
            else
            {
                keyMapUp          = "NumPad8";
                keyMapDown        = "NumPad2";
                keyMapLeft        = "NumPad4";
                keyMapRight       = "NumPad6";
                keyMapUpLeft      = "NumPad7";
                keyMapUpRight     = "NumPad9";
                keyMapDownLeft    = "NumPad1";
                keyMapDownRight   = "NumPad3";
                keyMapToggleMouse = "Multiply";
                keyMapClick       = "NumPad5";
                keyMapZoomIn      = "Add";
                keyMapZoomOut     = "Subtract";
                keyMapContextMenu = "Divide";
                keyMapClose       = "NumPad0";
                keyMapMagnifier   = "";
                keyMapFavourites  = "";
                keyMapShortCuts   = "";
                keyMapNavigate    = "";
                keyMapDoubleClick = "";
                keyMapKeyboard    = "";
                keyMapTAB         = "";
                keyMapESC         = "";
                keyMapF5          = "";
            }
            allKeys = new ArrayList();
            allKeys.Add(keyMapUp);
            allKeys.Add(keyMapDown);
            allKeys.Add(keyMapLeft);
            allKeys.Add(keyMapRight);
            allKeys.Add(keyMapUpLeft);
            allKeys.Add(keyMapUpRight);
            allKeys.Add(keyMapDownLeft);
            allKeys.Add(keyMapDownRight);
            allKeys.Add(keyMapClose);
            allKeys.Add(keyMapMagnifier);
            allKeys.Add(keyMapNavigate);
            allKeys.Add(keyMapZoomIn);
            allKeys.Add(keyMapZoomOut);
            allKeys.Add(keyMapClick);
            allKeys.Add(keyMapDoubleClick);
            allKeys.Add(keyMapKeyboard);
            allKeys.Add(keyMapFavourites);
            allKeys.Add(keyMapShortCuts);
            allKeys.Add(keyMapTAB);
            allKeys.Add(keyMapESC);
            allKeys.Add(keyMapToggleMouse);
            allKeys.Add(keyMapContextMenu);
            allKeys.Add(keyMapF5);

            formZoom           = null;
            formPopup          = null;
            formKeyboardNavi   = null;
            formKeyboardSearch = null;
            formFavourites     = null;
            formShortcuts      = null;
            formContextMenu    = null;

            lastMousePositionChange = 0;
            acceleration            = minMouseSpeed;
            this.Size = new System.Drawing.Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
            webBrowser1.ScrollBarsEnabled = showScrollBar;
            if (useCustomCursor)
            {
                Cursor.Hide();
                formCursor = new FormCursor();
                String cursorPath = userDataFolder + "\\cursor.png";
                Bitmap oImage     = null;
                if (File.Exists(cursorPath))
                {
                    oImage = new Bitmap(cursorPath);
                }
                else
                {
                    oImage = new Bitmap(XBMC_WebBrowser.Properties.Resources.cursorBlue);
                }
                formCursor.BackgroundImage = oImage;
                formCursor.MinimumSize     = new System.Drawing.Size(32, 32);
                formCursor.Size            = new System.Drawing.Size(customCursorSize, customCursorSize);
                formCursor.Location        = new Point(Cursor.Position.X + 1, Cursor.Position.Y + 1);
                formCursor.Show();
            }
            if (userAgent == "")
            {
                webBrowser1.Navigate(mainUrl);
            }
            else
            {
                webBrowser1.Navigate(mainUrl, null, null, "User-Agent: " + userAgent);
            }
            nativeBrowser                  = (SHDocVw.WebBrowser)webBrowser1.ActiveXInstance;
            nativeBrowser.NewWindow2      += nativeBrowser_NewWindow2;
            webBrowser1.DocumentCompleted += webBrowser1_DocumentCompleted;
            mouse_event(MOUSEEVENTF_MOVE, 1, 1, 0, 0);
        }
コード例 #3
0
        public FormMain(String[] args)
        {
            InitializeComponent();

            mainTitle = "";
            mainUrl = "http://www.imdb.com/";
            userAgent = "";
            minMouseSpeed = 10;
            maxMouseSpeed = 10;
            userDataFolder = "";
            zoom = 100;
            magnifierWidth = 1280;
            magnifierHeigth = 720;
            magnifierZoom = 3;
            showPopups = false;
            showScrollBar = true;
            useCustomCursor = true;
            customCursorSize = 64;
            mouseEnabled = true;
            scrollSpeed = 20;

            if (args.Length > 0)
            {
                userDataFolder = args[0].Replace("\"", "");
                mainTitle = args[1].Replace("\"", "");
                mainUrl = Uri.UnescapeDataString(args[2]);
                zoom = Convert.ToInt32(args[3]);
                showPopups = (args[4] == "yes");
                minMouseSpeed = Convert.ToInt32(args[5]);
                maxMouseSpeed = Convert.ToInt32(args[6]);
                String[] spl = args[7].Split('x');
                magnifierWidth = Convert.ToInt32(spl[0]);
                magnifierHeigth = Convert.ToInt32(spl[1]);
                useCustomCursor = (args[8] == "true");
                customCursorSize = Convert.ToInt32(args[9]);
                showScrollBar = (args[10] == "yes");
                scrollSpeed = Convert.ToInt32(args[11]);
                userAgent = args[12].Replace("\"", "");
            }

            //When using Windows
            String file = userDataFolder + "\\keymap";
            String file2 = "C:\\xbmc_webbrowser\\keymap";
            if (File.Exists(file))
            {
                importKeymap(file);
            }
            //When using Wine
            else if (File.Exists(file2))
            {
                importKeymap(file2);
            }
            //Default key mapping
            else
            {
                keyMapUp = "NumPad8";
                keyMapDown = "NumPad2";
                keyMapLeft = "NumPad4";
                keyMapRight = "NumPad6";
                keyMapUpLeft = "NumPad7";
                keyMapUpRight = "NumPad9";
                keyMapDownLeft = "NumPad1";
                keyMapDownRight = "NumPad3";
                keyMapToggleMouse = "Multiply";
                keyMapClick = "NumPad5";
                keyMapZoomIn = "Add";
                keyMapZoomOut = "Subtract";
                keyMapContextMenu = "Divide";
                keyMapClose = "NumPad0";
                keyMapMagnifier = "";
                keyMapFavourites = "";
                keyMapShortCuts = "";
                keyMapNavigate = "";
                keyMapDoubleClick = "";
                keyMapKeyboard = "";
                keyMapTAB = "";
                keyMapESC = "";
                keyMapF5 = "";
            }
            allKeys = new ArrayList();
            allKeys.Add(keyMapUp);
            allKeys.Add(keyMapDown);
            allKeys.Add(keyMapLeft);
            allKeys.Add(keyMapRight);
            allKeys.Add(keyMapUpLeft);
            allKeys.Add(keyMapUpRight);
            allKeys.Add(keyMapDownLeft);
            allKeys.Add(keyMapDownRight);
            allKeys.Add(keyMapClose);
            allKeys.Add(keyMapMagnifier);
            allKeys.Add(keyMapNavigate);
            allKeys.Add(keyMapZoomIn);
            allKeys.Add(keyMapZoomOut);
            allKeys.Add(keyMapClick);
            allKeys.Add(keyMapDoubleClick);
            allKeys.Add(keyMapKeyboard);
            allKeys.Add(keyMapFavourites);
            allKeys.Add(keyMapShortCuts);
            allKeys.Add(keyMapTAB);
            allKeys.Add(keyMapESC);
            allKeys.Add(keyMapToggleMouse);
            allKeys.Add(keyMapContextMenu);
            allKeys.Add(keyMapF5);

            formZoom = null;
            formPopup = null;
            formKeyboardNavi = null;
            formKeyboardSearch = null;
            formFavourites = null;
            formShortcuts = null;
            formContextMenu = null;

            lastMousePositionChange = 0;
            acceleration = minMouseSpeed;
            this.Size = new System.Drawing.Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
            webBrowser1.ScrollBarsEnabled = showScrollBar;
            if (useCustomCursor)
            {
                Cursor.Hide();
                formCursor = new FormCursor();
                String cursorPath = userDataFolder + "\\cursor.png";
                Bitmap oImage = null;
                if (File.Exists(cursorPath))
                {
                    oImage = new Bitmap(cursorPath);
                }
                else
                {
                    oImage = new Bitmap(XBMC_WebBrowser.Properties.Resources.cursorBlue);
                }
                formCursor.BackgroundImage = oImage;
                formCursor.MinimumSize = new System.Drawing.Size(32, 32);
                formCursor.Size = new System.Drawing.Size(customCursorSize, customCursorSize);
                formCursor.Location = new Point(Cursor.Position.X + 1, Cursor.Position.Y + 1);
                formCursor.Show();
            }
            if (userAgent=="")
                webBrowser1.Navigate(mainUrl);
            else
                webBrowser1.Navigate(mainUrl, null, null, "User-Agent: " + userAgent);
            nativeBrowser = (SHDocVw.WebBrowser)webBrowser1.ActiveXInstance;
            nativeBrowser.NewWindow2 += nativeBrowser_NewWindow2;
            webBrowser1.DocumentCompleted += webBrowser1_DocumentCompleted;
            mouse_event(MOUSEEVENTF_MOVE, 1, 1, 0, 0);
        }