예제 #1
0
 private void GetInterface()
 {
     int hr;
     System.Windows.Forms.Form f = new System.Windows.Forms.Form();
     hr = MFExtern.MFCreateVideoRendererActivate(IntPtr.Zero, out m_a);
     MFError.ThrowExceptionForHR(hr);
 }
예제 #2
0
        static void Main(string[] args)
        {
            #if DEBUG
            Microsoft.Msagl.GraphViewerGdi.DisplayGeometryGraph.SetShowFunctions();
            #endif
            //create a form
            System.Windows.Forms.Form form = new System.Windows.Forms.Form();
            //create a viewer object
            Microsoft.Msagl.GraphViewerGdi.GViewer viewer = new Microsoft.Msagl.GraphViewerGdi.GViewer();

            //associate the viewer with the form
            form.SuspendLayout();
            viewer.Dock = System.Windows.Forms.DockStyle.Fill;
            form.Controls.Add(viewer);
            form.ResumeLayout();
                    //create a graph object
            #if GraphModel

            Graph graph = DgmlParser.DgmlParser.Parse("fullstring.dgml");

            SugiyamaLayoutSettings ss = graph.LayoutAlgorithmSettings as SugiyamaLayoutSettings;

            // uncomment this line to see the wide graph
            // ss.MaxAspectRatioEccentricity = 100;

            // uncommment this line to us Mds
            // ss.FallbackLayoutSettings = new MdsLayoutSettings {AdjustScale = true};

            // or uncomment the following line to use the default layering layout with vertical layer
            // graph.Attr.LayerDirection = LayerDirection.LR;

            viewer.Graph = graph;
            form.ShowDialog();
            #endif
        }
 protected override void CloseForm()
 {
     if (_form == null) return;
     _form.Close();
     _form.Dispose();
     _form = null;
 }
 protected override IBOColSelectorControl CreateSelector()
 {
     IEditableGridControl readOnlyGridControl = GetControlFactory().CreateEditableGridControl();
     System.Windows.Forms.Form frm = new System.Windows.Forms.Form();
     frm.Controls.Add((System.Windows.Forms.Control)readOnlyGridControl);
     return GetControlledLifetimeFor(readOnlyGridControl);
 }
예제 #5
0
 protected override IGridBase CreateGridBaseStub()
 {
     GridBaseWinStub gridBase = new GridBaseWinStub();
     System.Windows.Forms.Form frm = new System.Windows.Forms.Form();
     frm.Controls.Add(gridBase);
     return GetControlledLifetimeFor(gridBase);
 }
예제 #6
0
파일: Game1.cs 프로젝트: RaulPB/videogames
        public Game1(IntPtr drawSurface,
                    System.Windows.Forms.Form parentForm,
                    System.Windows.Forms.PictureBox surfacePictureBox)
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            this.drawSurface = drawSurface;
            this.parentForm = parentForm;
            this.pictureBox = surfacePictureBox;

            graphics.PreparingDeviceSettings +=
                new EventHandler<PreparingDeviceSettingsEventArgs>(
                graphics_PreparingDeviceSettings);

            Mouse.WindowHandle = drawSurface;

            gameForm =
                System.Windows.Forms.Control.FromHandle(this.Window.Handle);
            gameForm.VisibleChanged += new EventHandler(gameForm_VisibleChanged);
            pictureBox.SizeChanged += new EventHandler(pictureBox_SizeChanged);

            vscroll =
                (System.Windows.Forms.VScrollBar)parentForm.Controls["vScrollBar1"];
            hscroll =
                (System.Windows.Forms.HScrollBar)parentForm.Controls["hScrollBar1"];

        }
예제 #7
0
        /// <summary>
        /// Open the Shortn dialog window.  Used internally after the Shortn button is pressed, and by Ribbon for the debugging
        /// </summary>
        /// <param name="data"></param>
        public static void openShortnDialog(ShortnData data)
        {
            System.Windows.Forms.Form newForm = new System.Windows.Forms.Form();
            newForm.Width = 1200;
            newForm.Height = int.MaxValue;
            newForm.BackColor = System.Drawing.Color.White;

            // Create the ElementHost control for hosting the
            // WPF UserControl.
            ElementHost host = new ElementHost();
            host.Dock = System.Windows.Forms.DockStyle.Fill;

            // Create the WPF UserControl.
            ShortnDialog sd = new ShortnDialog(data);

            // Assign the WPF UserControl to the ElementHost control's
            // Child property.
            host.Child = sd;

            newForm.Visible = false;
            // Add the ElementHost control to the form's
            // collection of child controls.
            newForm.Controls.Add(host);
            newForm.Show();

            // set the form's height based on what the textbox wants to be
            int dialogHeight = (int)sd.grid.DesiredSize.Height;
            newForm.Height = (int)(sd.DesiredSize.Height + newForm.Padding.Vertical + System.Windows.Forms.SystemInformation.CaptionHeight + System.Windows.SystemParameters.ScrollWidth);
            sd.grid.Height = sd.grid.DesiredSize.Height;
            newForm.Width = 1200;
            host.MaximumSize = new System.Drawing.Size(1200, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height);
            newForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;

            newForm.Visible = true;
        }
예제 #8
0
파일: Chart.cs 프로젝트: RoyChase/CSTherm
        public void GetGraph(Stream outputstream, DateTime from)
        {
            ObjectCache cache = MemoryCache.Default;
            Bitmap bm = cache["graph"] as Bitmap;

            if (bm == null)
            {
                bm = DrawGraph(from);
            }

            if (!System.Diagnostics.Debugger.IsAttached)
                bm.Save(outputstream, System.Drawing.Imaging.ImageFormat.Jpeg);
            else
            {
                System.Windows.Forms.Form f = new System.Windows.Forms.Form();
                f.Height = 610;
                f.Width = 810;
                System.Windows.Forms.PictureBox pb = new System.Windows.Forms.PictureBox();
                pb.Top = 1;
                pb.Left = 1;
                pb.Width = 800;
                pb.Height = 600;
                pb.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                pb.Visible = true;
                f.Controls.Add(pb);

                pb.Image = bm;

                System.Windows.Forms.Application.Run(f);
            }
        }
예제 #9
0
        public void Run()
        {
            // 初期設定を行う。
            var option = new asd.EngineOption
            {
                IsFullScreen = false
            };

            bool closed = false;
            System.Windows.Forms.Form form = new System.Windows.Forms.Form();
            form.FormClosed += (object sender, System.Windows.Forms.FormClosedEventArgs e) =>
                {
                    closed = true;
                };
            form.Show();

            // aceを初期化する。
            asd.Engine.InitializeByExternalWindow(form.Handle, IntPtr.Zero, form.Size.Width, form.Size.Height, option);

            // aceが進行可能かチェックする。
            while (asd.Engine.DoEvents())
            {
                System.Windows.Forms.Application.DoEvents();
                if (closed) break;

                // aceを更新する。
                asd.Engine.Update();
            }

            // aceを終了する。
            asd.Engine.Terminate();
        }
 /// <summary>
 /// Just uses a messagebox to show the external request.
 /// </summary>
 /// <param name="someParameter"></param>
 /// <returns></returns>
 public bool DoSomething(string someParameter)
 {
     if (mMainWindow == null)
     {
         mMainWindow = System.Windows.Forms.Control.FromHandle(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle) as System.Windows.Forms.Form;
     }
     // Just a few manipulations of the main window
     if (mMainWindow != null)
     {
         someParameter = someParameter.ToLowerInvariant();
         switch(someParameter)
         {
             case "hide":
                 mMainWindow.Hide();
                 break;
             case "show":
                 mMainWindow.Show();
                 break;
             case "min":
                 mMainWindow.WindowState = System.Windows.Forms.FormWindowState.Minimized;
                 break;
             case "max":
                 mMainWindow.WindowState = System.Windows.Forms.FormWindowState.Maximized;
                 break;
         }
     }
     else
     {
         System.Windows.Forms.MessageBox.Show("Could not get main window");
     }
     return System.Windows.Forms.MessageBox.Show(String.Format("Plugin does something on remote request: {0}\nSucceeded?", someParameter),
                "Remote request to plugin",
                System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes;
 }
        private CapturedItemsListController(MainWindow mainWindow)
        {
            this.mainWindow = mainWindow;
            this.mainWindowPtr = new System.Windows.Interop.WindowInteropHelper(mainWindow).Handle;

            f = new System.Windows.Forms.Form();
            sh = new ShellHook(f.Handle);
            sh.WindowActivated += sh_WindowActivated;
            sh.RudeAppActivated += sh_WindowActivated;
            ch = new ClipboardHelper(f.Handle);
            ch.ClipboardGrabbed += ch_ClipboardGrabbed;
            ch.RegisterClipboardListener();

            gh = new GlobalHotkeyHelper(f.Handle);
            gh.GlobalHotkeyFired += new GlobalHotkeyHandler(gh_GlobalHotkeyFired);

            gh.RegisterHotKey(666, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_Z);
            gh.RegisterHotKey(667, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_1);
            gh.RegisterHotKey(668, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_2);
            gh.RegisterHotKey(669, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_3);
            gh.RegisterHotKey(670, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_4);
            gh.RegisterHotKey(671, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_5);
            gh.RegisterHotKey(672, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_6);
            gh.RegisterHotKey(673, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_7);
            gh.RegisterHotKey(674, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_8);
            gh.RegisterHotKey(675, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_9);
            gh.RegisterHotKey(676, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_0);
        }
예제 #12
0
        private void HandlePluginLaunch(object sender, EventArgs e)
        {
            //NWN2Toolset.NWN2.Data.Blueprints.NWN2GlobalBlueprintManager bpManager = new NWN2Toolset.NWN2.Data.Blueprints.NWN2GlobalBlueprintManager();
            //bpManager.Initialize();
            NWN2Toolset.NWN2.Data.TypedCollections.NWN2BlueprintCollection items = NWN2Toolset.NWN2.Data.Blueprints.NWN2GlobalBlueprintManager.GetBlueprintsOfType(NWN2Toolset.NWN2.Data.Templates.NWN2ObjectType.Item);
            ALFAItemBlueprint scroll;
            
            System.Windows.Forms.Form form = new System.Windows.Forms.Form();
            /*System.Windows.Forms.TextBox text = new System.Windows.Forms.TextBox();
            text.Size = new System.Drawing.Size(400, 300);
            text.Multiline = true;
            text.WordWrap = false;
            text.AcceptsReturn = true;
            text.AcceptsTab = true;
            text.ScrollBars = System.Windows.Forms.ScrollBars.Both;
            text.Text = scroll.ToString();*/
            System.Windows.Forms.ListBox listBox = new System.Windows.Forms.ListBox();
            listBox.Sorted = true;
            listBox.HorizontalScrollbar = true;
            listBox.Size = new System.Drawing.Size(400, 300);

            form.Controls.Add(listBox);
            form.Size = new System.Drawing.Size(430, 330);
            form.Show();    

            //items.Add(scroll.ItemBlueprint);
            //scroll.TemplateResRef = "TEST RESREF";
            //scroll.AddItemProperty(ALFAItemProperty.CastSpell1ChargeItemProperty(0));
            //scroll.AddItemProperty(ALFAItemProperty.WizardOnlyItemProperty());            
            //items.Add(scroll.ItemBlueprint);

            ConsumableCreator cc = new ConsumableCreator();
            cc.Run();
        }
 protected override IBOColSelectorControl CreateSelector()
 {
     MultiSelectorWin<MyBO> multiSelectorWin = new MultiSelectorWin<MyBO>(GetControlFactory());
     System.Windows.Forms.Form frm = new System.Windows.Forms.Form();
     frm.Controls.Add(multiSelectorWin);
     return multiSelectorWin;
 }
 protected override IBOColSelectorControl CreateSelector()
 {
     GridBaseWinStub gridBase = new GridBaseWinStub();
     System.Windows.Forms.Form frm = new System.Windows.Forms.Form();
     frm.Controls.Add(gridBase);
     SetupGridColumnsForMyBo(gridBase);
     return GetControlledLifetimeFor(gridBase);
 }
예제 #15
0
        public Input(System.Windows.Forms.Form form1_reference, IntPtr window_handle)
        {
            _form1_reference = form1_reference;
            critical_failure = false;

            populate_key_list();
            Initialize_Keyboard(window_handle);
        }
예제 #16
0
 public void SetAlphaBlending(System.Windows.Forms.Form form)
 {
     this.form = form;
     this.form.Opacity = 0.0;
     this.form.Activate();
     this.form.Refresh();
     fadeTimer.Start();
 }
 protected override void AddControlToForm(IControlHabanero control, int formHeight)
 {
     System.Windows.Forms.Form frmLocal = new System.Windows.Forms.Form();
     DisposeOnTearDown(frmLocal);
     frmLocal.Controls.Add((System.Windows.Forms.Control)control);
     frmLocal.Height = formHeight;
     frmLocal.Visible = true;
 }
 public Window()
 {
     nativeBinding = new System.Windows.Forms.Form();
     onShown += new DWMEventArgs(Window_onShown);
     onHide += new DWMEventArgs(Window_onHide);
     onFocus += new DWMEventArgs(Window_onFocus);
     Children = new childContainer(interntroll);
 }
예제 #19
0
파일: Timer.cs 프로젝트: inmount/dyk.dll
        public Timer(System.Windows.Forms.Form owner, int interval) {
            this.Tick += Timer_Tick;

            gParent = owner;

            gnInterval = interval;
            gbWork = false;
            gThread = new System.Threading.Thread(Timing);
        }
예제 #20
0
        public void Init()
        {
            // Create a windows form so that we can use its handle for the sim connection
            System.Windows.Forms.Form form = new System.Windows.Forms.Form();
            IntPtr handle = form.Handle;

            SimManager.Initialise(handle);
            Assert.That(SimManager.Instance, Is.Not.Null, "SimManager singleton initialised");
        }
        public static PythonConsoleHost OpenPythonConsole(System.Windows.Forms.Form mainForm)
        {
            // ipy -D -X:TabCompletion -X:ColorfulConsole
            if (m_pythonConsoleHost == null)
            {
                m_pythonConsoleHost = new PythonConsoleHost();
                //System.Threading.ManualResetEvent eve = new System.Threading.ManualResetEvent(false);

                dispatcher = mainForm;

                System.Threading.AutoResetEvent are = new System.Threading.AutoResetEvent(false);

                System.Threading.Thread _debugThread = new System.Threading.Thread(() =>
                {
                    int r = AllocConsole();
                    if (r == 0)
                    {
                        throw new InvalidOperationException("Can't AllocConsole!");
                    }
                    StreamWriter standardOutput = new StreamWriter(Console.OpenStandardOutput());
                    standardOutput.AutoFlush = true;
                    Console.SetOut(standardOutput);

                    //host.Options.RunAction = Microsoft.Scripting.Hosting.Shell.ConsoleHostOptions.Action.RunConsole;
                    m_pythonConsoleHost.Run(new string[] { "-X:ColorfulConsole", "-X:Debug", "-X:TabCompletion", "-X:ExceptionDetail", "-X:ShowClrExceptions"  }); //

                    //are.Set();

                    m_pythonConsoleHost.Runtime.IO.RedirectToConsole();
                    IronPython.Runtime.ClrModule.SetCommandDispatcher(IronPython.Runtime.DefaultContext.Default, null);

                    r = FreeConsole();
                    if (r == 0)
                    {
                        throw new InvalidOperationException("Can't FreeConsole!");
                    }

                    m_pythonConsoleHost = null;
                });
                _debugThread.IsBackground = true;
                _debugThread.SetApartmentState(System.Threading.ApartmentState.STA);
                _debugThread.Start();

                // Don't establish the alternative input execution behavior until the other thread is ready.  Note, 'are' starts out unsignalled.
                //are.WaitOne();

                while (m_pythonConsoleHost.ScriptScope == null)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                IronPython.Runtime.ClrModule.SetCommandDispatcher(IronPython.Runtime.DefaultContext.Default, DispatchConsoleCommand);
            }

            return m_pythonConsoleHost;
        }
예제 #22
0
 protected override void OnParentChanged(EventArgs e)
 {
   if (m_mainform != ParentForm)
   {
     m_mainform = ParentForm;
     if (m_mainform != null)
       m_mainform.FormClosing += CloseCodeCompletionWindow;
   }
   base.OnParentChanged(e);
 }
예제 #23
0
        public Game()
        {
            graphics = new GraphicsDeviceManager(this);

            GameForm = (System.Windows.Forms.Form)System.Windows.Forms.Form.FromHandle(Window.Handle);
            GameForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

            this.Window.AllowUserResizing = true;
            this.Window.ClientSizeChanged += new EventHandler<EventArgs>(Window_ClientSizeChanged);
            Content.RootDirectory = "Content";
        }
예제 #24
0
        public static void Init(System.Windows.Forms.Form form)
        {
            if (form!=null)
            {
                m_form = form;
                PrepareCWB();
            }

            ms_NCThread = new Thread(NCThreadRunner);
            ms_NCThread.Name = "NavigationCenter";
            ms_NCThread.Start();
        }
예제 #25
0
        public WindowHelper(System.Windows.Forms.Form form, string product, string keyPrefix)
        {
            m_key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\" + product + @"\Window");
            m_form = form;

            m_topKey = keyPrefix + "Top";
            m_leftKey = keyPrefix + "Left";
            m_heightKey = keyPrefix + "Height";
            m_widthKey = keyPrefix + "Width";

            form.Load += new EventHandler(form_Load);
        }
 public void Test_SetDefaultButton_WinOnly()
 {
     //---------------Set up test pack-------------------
     IButtonGroupControl buttons = CreateButtonGroupControl();
     IButton btn = buttons.AddButton("Test");
     System.Windows.Forms.Form frm = new System.Windows.Forms.Form();
     frm.Controls.Add((System.Windows.Forms.Control)buttons);
     //---------------Execute Test ----------------------
     buttons.SetDefaultButton("Test");
     //---------------Test Result -----------------------
     Assert.AreSame(btn, frm.AcceptButton);
 }
예제 #27
0
 /// <summary>
 /// Returns collection of manufacturer Obis codes to implement custom read.
 /// </summary>
 /// <param name="name">Short or Logical Name.</param>
 /// <param name="type">Interface type.</param>        
 /// <returns>True, if data read is handled.</returns>
 public bool Read(object sender, GXDLMSObject item, GXDLMSObjectCollection columns, int attribute, GXDLMSCommunicator comm)
 {
     MainForm = sender as System.Windows.Forms.Form;
     if (!(item is GXDLMSProfileGeneric))
     {
         return false;
     }
     //Actaris do not support other than index 2.
     if (attribute != 0 && attribute != 2)
     {
         return true;
     }
     if (comm.OnBeforeRead != null)
     {
         comm.OnBeforeRead(item, attribute);
     }
     CurrentProfileGeneric = item as GXDLMSProfileGeneric;
     if (item is GXDLMSProfileGeneric)
     {
         GXDLMSProfileGeneric pg = item as GXDLMSProfileGeneric;
         GXReplyData reply = new GXReplyData();
         byte[][] data;
         try
         {
             comm.OnDataReceived += new GXDLMSCommunicator.DataReceivedEventHandler(this.OnProfileGenericDataReceived);
             //Read profile generic columns.
             if (pg.AccessSelector == AccessRange.Range ||
                 pg.AccessSelector == AccessRange.Last)
             {
                 data = comm.client.ReadRowsByRange(pg, Convert.ToDateTime(pg.From).Date, Convert.ToDateTime(pg.To).Date);
                 comm.ReadDataBlock(data[0], "Reading profile generic data", 1, reply);
             }
             else if (pg.AccessSelector == AccessRange.Entry)
             {
                 data = comm.client.ReadRowsByEntry(pg, Convert.ToInt32(pg.From), Convert.ToInt32(pg.To));
                 comm.ReadDataBlock(data[0], "Reading profile generic data " + pg.Name, 1, reply);
             }
             else //Read All.
             {
                 data = comm.client.Read(pg, 2);
                 comm.ReadDataBlock(data[0], "Reading profile generic data " + pg.Name, 1, reply);
             }
         }
         finally
         {
             CurrentProfileGeneric = null;
             comm.OnDataReceived -= new GXDLMSCommunicator.DataReceivedEventHandler(this.OnProfileGenericDataReceived);
         }
         return true;
     }
     return false;
 }
예제 #28
0
		public System.Windows.Forms.Form GetForm()
		{
			if (m_Form==null)
			{
				m_Form = (System.Windows.Forms.Form)Activator.CreateInstance(m_FormType,m_Args);

				m_Form.CreateControl();

				m_Form.Closed +=new EventHandler(m_Form_Closed);
			}

			return m_Form;
		}
 protected override IReadOnlyGridControl CreateReadOnlyGridControl(bool putOnForm)
 {
     Habanero.Faces.Win.ReadOnlyGridControlWin readOnlyGridControlWin =
         new Habanero.Faces.Win.ReadOnlyGridControlWin(GetControlFactory());
     if (putOnForm)
     {
         _form = new System.Windows.Forms.Form();
         _form.Controls.Add(readOnlyGridControlWin);
         _form.Show();
         DisposeOnTearDown(_form);
     }
     return GetControlledLifetimeFor(readOnlyGridControlWin);
 }
        public Game1(IntPtr drawSurface, System.Windows.Forms.Form parentForm, System.Windows.Forms.PictureBox pictureBox)
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            this.drawSurface = drawSurface;
            this.parentForm = parentForm;
            this.pictureBox = pictureBox;

            graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
            gameForm = System.Windows.Forms.Control.FromHandle(this.Window.Handle);
            gameForm.VisibleChanged += new EventHandler(gameForm_VisibleChanged);
        }
예제 #31
0
 public CheckBoxArray(System.Windows.Forms.Form host)
 {
     _hostForm = host;
 }
        public void CountPanelsSubType()
        {
            System.Windows.Forms.Form form = new System.Windows.Forms.Form();
            _TestSingleTon.Instance._SetupForLayoutPanelTests();

            //FAKE_LayoutPanel panel = new FAKE_LayoutPanel(CoreUtilities.Constants.BLANK, false);
            Assert.False(MasterOfLayouts.ExistsByGUID("testlayout"));


            _w.output("here");
            //-- do unit tests counting store 6 textboxes and know this (countbytype)
            //_setupforlayoutests ();

            _w.output("here");
            int count = 25;

            //	FakeLayoutDatabase layout = new FakeLayoutDatabase ("testguid");
            FAKE_LayoutPanel layoutPanel = new FAKE_LayoutPanel(CoreUtilities.Constants.BLANK, false);

            layoutPanel.NewLayout("testlayout", false, null);
            form.Controls.Add(layoutPanel);
            form.Show();



            NoteDataXML note = new NoteDataXML();

            for (int i = 0; i < count; i++)
            {
                note.Caption = "boo" + i.ToString();
                layoutPanel.AddNote(note);
                note.CreateParent(layoutPanel);
            }
            _w.output(String.Format("{0} Notes in Layout before save", layoutPanel.GetAllNotes().Count.ToString()));

            for (int i = 0; i < 6; i++)
            {
                note = new NoteDataXML_Panel();


                note.Caption = "Panel";
                layoutPanel.AddNote(note);
                note.CreateParent(layoutPanel);
                ((NoteDataXML_Panel)note).Add10TestNotes();
            }



            layoutPanel.SaveLayout();
            layoutPanel = new FAKE_LayoutPanel(CoreUtilities.Constants.BLANK, false);
            //_w.output(String.Format ("{0} Objects Saved", layoutPanel.ObjectsSaved().ToString()));
            layoutPanel.LoadLayout("testlayout", false, null);

//			layout = new FakeLayoutDatabase ("testguid");
//
//			layout.LoadFrom(layoutPanel);

            // now count RichText notes
            int count2       = 0;
            int subnotecount = 0;

            foreach (NoteDataInterface _note in layoutPanel.GetAllNotes())
            {
                if (_note.GetType() == typeof(NoteDataXML_Panel))
                {
                    count2++;
                    subnotecount = subnotecount + ((NoteDataXML_Panel)_note).GetChildNotes().Count;
                }
            }


            // total note count should be (once I get GetNotes working on Child Notes = 60 + 6 + 25 = 91

            _w.output(String.Format("{0} Objects Loaded", layoutPanel.GetAllNotes().Count));
            //NOT DONE YET
            Assert.AreEqual(6, count2);
            Assert.AreEqual(60, subnotecount);
            Assert.AreEqual(count2, layoutPanel.GetAvailableFolders().Count);

            // had to change because a linktable makes 91 become 92
            Assert.AreEqual(92, layoutPanel.GetAllNotes().Count);
        }
 protected override void AddControlToForm(IControlHabanero cntrl)
 {
     System.Windows.Forms.Form frm = new System.Windows.Forms.Form();
     frm.Controls.Add((System.Windows.Forms.Control)cntrl);
 }
예제 #34
0
        public override void Hook()
        {
            this.DebugMessage("Hook: Begin");
            // First we need to determine the function address for IDirect3DDevice9
            Device device;

            id3dDeviceFunctionAddresses = new List <IntPtr>();
            //id3dDeviceExFunctionAddresses = new List<IntPtr>();
            this.DebugMessage("Hook: Before device creation");
            using (Direct3D d3d = new Direct3D())
            {
                using (var renderForm = new System.Windows.Forms.Form())
                {
                    using (device = new Device(d3d, 0, DeviceType.NullReference, IntPtr.Zero, CreateFlags.HardwareVertexProcessing, new PresentParameters()
                    {
                        BackBufferWidth = 1, BackBufferHeight = 1, DeviceWindowHandle = renderForm.Handle
                    }))
                    {
                        this.DebugMessage("Hook: Device created");
                        id3dDeviceFunctionAddresses.AddRange(GetVTblAddresses(device.NativePointer, D3D9_DEVICE_METHOD_COUNT));
                    }
                }
            }

            try
            {
                using (Direct3DEx d3dEx = new Direct3DEx())
                {
                    this.DebugMessage("Hook: Direct3DEx...");
                    using (var renderForm = new System.Windows.Forms.Form())
                    {
                        using (var deviceEx = new DeviceEx(d3dEx, 0, DeviceType.NullReference, IntPtr.Zero, CreateFlags.HardwareVertexProcessing, new PresentParameters()
                        {
                            BackBufferWidth = 1, BackBufferHeight = 1, DeviceWindowHandle = renderForm.Handle
                        }, new DisplayModeEx()
                        {
                            Width = 800, Height = 600
                        }))
                        {
                            this.DebugMessage("Hook: DeviceEx created - PresentEx supported");
                            id3dDeviceFunctionAddresses.AddRange(GetVTblAddresses(deviceEx.NativePointer, D3D9_DEVICE_METHOD_COUNT, D3D9Ex_DEVICE_METHOD_COUNT));
                            _supportsDirect3D9Ex = true;
                        }
                    }
                }
            }
            catch (Exception)
            {
                _supportsDirect3D9Ex = false;
            }

            // We want to hook each method of the IDirect3DDevice9 interface that we are interested in

            // 42 - EndScene (we will retrieve the back buffer here)
            Direct3DDevice_EndSceneHook = LocalHook.Create(
                id3dDeviceFunctionAddresses[(int)Direct3DDevice9FunctionOrdinals.EndScene],
                // On Windows 7 64-bit w/ 32-bit app and d3d9 dll version 6.1.7600.16385, the address is equiv to:
                // (IntPtr)(GetModuleHandle("d3d9").ToInt32() + 0x1ce09),
                // A 64-bit app would use 0xff18
                // Note: GetD3D9DeviceFunctionAddress will output these addresses to a log file
                new Direct3D9Device_EndSceneDelegate(EndSceneHook),
                this);

            unsafe
            {
                // If Direct3D9Ex is available - hook the PresentEx
                if (_supportsDirect3D9Ex)
                {
                    Direct3DDeviceEx_PresentExHook = LocalHook.Create(
                        id3dDeviceFunctionAddresses[(int)Direct3DDevice9ExFunctionOrdinals.PresentEx],
                        new Direct3D9DeviceEx_PresentExDelegate(PresentExHook),
                        this);
                }

                // Always hook Present also (device will only call Present or PresentEx not both)
                Direct3DDevice_PresentHook = LocalHook.Create(
                    id3dDeviceFunctionAddresses[(int)Direct3DDevice9FunctionOrdinals.Present],
                    new Direct3D9Device_PresentDelegate(PresentHook),
                    this);
            }

            // 16 - Reset (called on resolution change or windowed/fullscreen change - we will reset some things as well)
            Direct3DDevice_ResetHook = LocalHook.Create(
                id3dDeviceFunctionAddresses[(int)Direct3DDevice9FunctionOrdinals.Reset],
                // On Windows 7 64-bit w/ 32-bit app and d3d9 dll version 6.1.7600.16385, the address is equiv to:
                //(IntPtr)(GetModuleHandle("d3d9").ToInt32() + 0x58dda),
                // A 64-bit app would use 0x3b3a0
                // Note: GetD3D9DeviceFunctionAddress will output these addresses to a log file
                new Direct3D9Device_ResetDelegate(ResetHook),
                this);

            /*
             * Don't forget that all hooks will start deactivated...
             * The following ensures that all threads are intercepted:
             * Note: you must do this for each hook.
             */
            Direct3DDevice_EndSceneHook.ThreadACL.SetExclusiveACL(new Int32[1]);
            Hooks.Add(Direct3DDevice_EndSceneHook);

            Direct3DDevice_PresentHook.ThreadACL.SetExclusiveACL(new Int32[1]);
            Hooks.Add(Direct3DDevice_PresentHook);

            if (_supportsDirect3D9Ex)
            {
                Direct3DDeviceEx_PresentExHook.ThreadACL.SetExclusiveACL(new Int32[1]);
                Hooks.Add(Direct3DDeviceEx_PresentExHook);
            }

            Direct3DDevice_ResetHook.ThreadACL.SetExclusiveACL(new Int32[1]);
            Hooks.Add(Direct3DDevice_ResetHook);

            this.DebugMessage("Hook: End");
        }
예제 #35
0
 /// <summary>
 /// Localize Windows form with tooltip
 /// </summary>
 public static void LocaliseForm(System.Windows.Forms.Form sourceForm, System.Windows.Forms.ToolTip toolTip)
 {
     sourceForm.Text = Localise.GetPhrase(sourceForm.Text);
     LocaliseControl(sourceForm.Controls, toolTip);
 }
예제 #36
0
 protected override IDecompilerUIService CreateUIService(System.Windows.Forms.Form dlg, System.Windows.Forms.OpenFileDialog ofd, System.Windows.Forms.SaveFileDialog sfd)
 {
     FakeUiService = new FakeUiService();
     return(FakeUiService);
 }
예제 #37
0
        public static void Run(string path)
        {
            // check shape, see http://www.aforgenet.com/articles/shape_checker/
            SimpleShapeChecker shapeChecker = new SimpleShapeChecker()
            {
            };

            float zoom     = 20;
            var   pinkPen  = new Pen(Color.HotPink, zoom * 0.4f);
            var   greenPen = new Pen(Color.GreenYellow, zoom * 0.7f);
            var   aquaPen  = new Pen(Color.Aqua, zoom * 0.7f);
            var   redPen   = new Pen(Color.Red, zoom * 0.4f);
            var   bluePen  = new Pen(Color.Blue, zoom * 0.4f);
            var   blackPen = new Pen(Color.Black, zoom * 0.7f);

            using (var converter = new PdfImageConverter(path))
                using (PdfDocument document = PdfDocument.Open(path))
                {
                    for (var i = 0; i < document.NumberOfPages; i++)
                    {
                        var page       = document.GetPage(i + 1);
                        var paths      = page.ExperimentalAccess.Paths;
                        var geometries = paths.Select(p => new PdfGeometry(p)).ToList();

                        var verticals = geometries.Where(g => g.IsVerticalLine()).ToList();

                        var horizontals = geometries.Where(g => g.IsHorizontalLine()).ToList();


                        using (var bitmap = converter.GetPage(i + 1, zoom))
                            using (var graphics = Graphics.FromImage(bitmap))
                            {
                                var imageHeight = bitmap.Height;

                                foreach (var letter in page.Letters)
                                {
                                    var rect = new Rectangle(
                                        (int)(letter.GlyphRectangle.Left * (decimal)zoom),
                                        imageHeight - (int)(letter.GlyphRectangle.Top * (decimal)zoom),
                                        (int)(letter.GlyphRectangle.Width * (decimal)zoom),
                                        (int)(letter.GlyphRectangle.Height * (decimal)zoom));
                                    graphics.DrawRectangle(pinkPen, rect);
                                }

                                foreach (var p in paths)
                                {
                                    if (p == null)
                                    {
                                        continue;
                                    }
                                    PdfGeometry geometry = new PdfGeometry(p);

                                    var isClosed    = geometry.IsClosed;
                                    var isClockwise = geometry.IsClockwise;

                                    var commands = p.Commands;
                                    var points   = ToOrderedPoints(commands);

                                    if (isClosed) //.SubGeometries.Count > 1)
                                    {
                                        //Scatterplot scatterplot = new Scatterplot();
                                        //scatterplot.Compute(
                                        //    points.Select(po => (double)po.X).Take(31).ToArray(),
                                        //    points.Select(po => (double)po.Y).Take(31).ToArray(),
                                        //    Enumerable.Range(0, points.Count).Take(31).ToArray());
                                        //ScatterplotBox.Show(scatterplot);


                                        ScatterplotView view = new ScatterplotView();
                                        view.Dock         = System.Windows.Forms.DockStyle.Fill;
                                        view.LinesVisible = true;
                                        view.Graph.GraphPane.Title.Text = isClockwise ? "CW" : "CCW";

                                        foreach (var command in commands)
                                        {
                                            if (command is PdfPath.Line line)
                                            {
                                                view.Graph.GraphPane.GraphObjList.Add(new ZedGraph.ArrowObj(
                                                                                          Color.Blue, 10.0f, (double)line.From.X, (double)line.From.Y,
                                                                                          (double)line.To.X, (double)line.To.Y));

                                                view.Graph.GraphPane.AddCurve("",
                                                                              new[] { (double)line.From.X, (double)line.To.X },
                                                                              new[] { (double)line.From.Y, (double)line.To.Y },
                                                                              Color.Red);
                                            }
                                            else if (command is BezierCurve curve)
                                            {
                                                foreach (var lineB in BezierCurveToPaths(curve))
                                                {
                                                    view.Graph.GraphPane.GraphObjList.Add(new ZedGraph.ArrowObj(
                                                                                              Color.Blue, 10.0f, (double)lineB.From.X, (double)lineB.From.Y,
                                                                                              (double)lineB.To.X, (double)lineB.To.Y));

                                                    view.Graph.GraphPane.AddCurve("",
                                                                                  new[] { (double)lineB.From.X, (double)lineB.To.X },
                                                                                  new[] { (double)lineB.From.Y, (double)lineB.To.Y },
                                                                                  Color.Red);
                                                }
                                            }
                                        }


                                        //view.Graph.GraphPane.AddCurve("curve",
                                        //    points.Select(po => (double)po.X).ToArray(),
                                        //    points.Select(po => (double)po.Y).ToArray(),
                                        //    Color.Blue,
                                        //    ZedGraph.SymbolType.Circle);
                                        view.Graph.GraphPane.AxisChange();
                                        var f1 = new System.Windows.Forms.Form();
                                        f1.Width  = 1000;
                                        f1.Height = 1000;
                                        f1.Controls.Add(view);
                                        f1.ShowDialog();
                                    }

                                    var shape   = shapeChecker.CheckShapeType(points);
                                    var subType = shapeChecker.CheckPolygonSubType(points);

                                    var bboxF = GetBoundingRectangle(commands);
                                    if (bboxF.HasValue)
                                    {
                                        var rect = new Rectangle(
                                            (int)(bboxF.Value.Left * (decimal)zoom),
                                            imageHeight - (int)(bboxF.Value.Top * (decimal)zoom),
                                            (int)(bboxF.Value.Width == 0 ? 1 : bboxF.Value.Width * (decimal)zoom),
                                            (int)(bboxF.Value.Height == 0 ? 1 : bboxF.Value.Height * (decimal)zoom));

                                        graphics.DrawRectangle(greenPen, rect);
                                    }

                                    /*foreach (var command in commands)
                                     * {
                                     *  if (command is PdfPath.Line line)
                                     *  {
                                     *      var bbox = line.GetBoundingRectangle();
                                     *      if (bbox.HasValue)
                                     *      {
                                     *          var rect = new Rectangle(
                                     *              (int)(bbox.Value.Left * (decimal)zoom),
                                     *              imageHeight - (int)(bbox.Value.Top * (decimal)zoom),
                                     *              (int)(bbox.Value.Width == 0 ? 1 : bbox.Value.Width * (decimal)zoom),
                                     *              (int)(bbox.Value.Height == 0 ? 1 : bbox.Value.Height * (decimal)zoom));
                                     *          graphics.DrawRectangle(bluePen, rect);
                                     *      }
                                     *  }
                                     *  else if (command is BezierCurve curve)
                                     *  {
                                     *      var bbox = curve.GetBoundingRectangle();
                                     *      if (bbox.HasValue)
                                     *      {
                                     *          var rect = new Rectangle(
                                     *              (int)(bbox.Value.Left * (decimal)zoom),
                                     *              imageHeight - (int)(bbox.Value.Top * (decimal)zoom),
                                     *              (int)(bbox.Value.Width == 0 ? 1 : bbox.Value.Width * (decimal)zoom),
                                     *              (int)(bbox.Value.Height == 0 ? 1 : bbox.Value.Height * (decimal)zoom));
                                     *          graphics.DrawRectangle(redPen, rect);
                                     *      }
                                     *  }
                                     *  else if (command is Close close)
                                     *  {
                                     *      var bbox = close.GetBoundingRectangle();
                                     *      if (bbox.HasValue)
                                     *      {
                                     *          var rect = new Rectangle(
                                     *              (int)(bbox.Value.Left * (decimal)zoom),
                                     *              imageHeight - (int)(bbox.Value.Top * (decimal)zoom),
                                     *              (int)(bbox.Value.Width == 0 ? 1 : bbox.Value.Width * (decimal)zoom),
                                     *              (int)(bbox.Value.Height == 0 ? 1 : bbox.Value.Height * (decimal)zoom));
                                     *          graphics.DrawRectangle(greenPen, rect);
                                     *      }
                                     *  }
                                     *  else if (command is Move move)
                                     *  {
                                     *      var bbox = move.GetBoundingRectangle();
                                     *      if (bbox.HasValue)
                                     *      {
                                     *          var rect = new Rectangle(
                                     *              (int)(bbox.Value.Left * (decimal)zoom),
                                     *              imageHeight - (int)(bbox.Value.Top * (decimal)zoom),
                                     *              (int)(bbox.Value.Width == 0 ? 1 : bbox.Value.Width * (decimal)zoom),
                                     *              (int)(bbox.Value.Height == 0 ? 1 : bbox.Value.Height * (decimal)zoom));
                                     *          graphics.DrawRectangle(greenPen, rect);
                                     *      }
                                     *  }
                                     *  else
                                     *  {
                                     *      throw new NotImplementedException(command.GetType().ToString());
                                     *  }
                                     * }*/
                                }

                                var rectsPaths = RecursiveXYCutPath.Instance.GetBlocks(paths, 0, 10, 10);
                                foreach (var rectPath in rectsPaths)
                                {
                                    var rect = new Rectangle(
                                        (int)(rectPath.Left * (decimal)zoom),
                                        imageHeight - (int)(rectPath.Top * (decimal)zoom),
                                        (int)(rectPath.Width * (decimal)zoom),
                                        (int)(rectPath.Height * (decimal)zoom));
                                    graphics.DrawRectangle(aquaPen, rect);
                                }

                                bitmap.Save(Path.ChangeExtension(path, (i + 1) + "_pathsTest.png"));
                            }
                    }
                }
        }
예제 #38
0
        public ActionCoreController(AudioQueue speech, AudioQueue wave, SpeechSynthesizer synt, System.Windows.Forms.Form frm)
        {
            audiospeech = speech;
            audiowave   = wave;
            synth       = synt;
            form        = frm;

            persistentglobalvariables = new ConditionVariables();
            globalvariables           = new ConditionVariables(persistentglobalvariables); // copy existing user ones into to shared buffer..
            programrunglobalvariables = new ConditionVariables();

            SetInternalGlobal("CurrentCulture", System.Threading.Thread.CurrentThread.CurrentCulture.Name);
            SetInternalGlobal("CurrentCultureInEnglish", System.Threading.Thread.CurrentThread.CurrentCulture.EnglishName);
            SetInternalGlobal("CurrentCultureISO", System.Threading.Thread.CurrentThread.CurrentCulture.ThreeLetterISOLanguageName);

            ActionBase.AddCommand("Break", typeof(ActionBreak), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Call", typeof(ActionCall), ActionBase.ActionType.Call);
            ActionBase.AddCommand("Dialog", typeof(ActionDialog), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("DialogControl", typeof(ActionDialogControl), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Do", typeof(ActionDo), ActionBase.ActionType.Do);
            ActionBase.AddCommand("DeleteVariable", typeof(ActionDeleteVariable), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Expr", typeof(ActionExpr), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Else", typeof(ActionElse), ActionBase.ActionType.Else);
            ActionBase.AddCommand("ElseIf", typeof(ActionElseIf), ActionBase.ActionType.ElseIf);
            ActionBase.AddCommand("End", typeof(ActionEnd), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("ErrorIf", typeof(ActionErrorIf), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("FileDialog", typeof(ActionFileDialog), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("GlobalLet", typeof(ActionGlobalLet), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Global", typeof(ActionGlobal), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("If", typeof(ActionIf), ActionBase.ActionType.If);
            ActionBase.AddCommand("InputBox", typeof(ActionInputBox), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("InfoBox", typeof(ActionInfoBox), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("MessageBox", typeof(ActionMessageBox), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("NonModalDialog", typeof(ActionNonModalDialog), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Return", typeof(ActionReturn), ActionBase.ActionType.Return);
            ActionBase.AddCommand("Pragma", typeof(ActionPragma), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Let", typeof(ActionLet), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Loop", typeof(ActionLoop), ActionBase.ActionType.Loop);
            ActionBase.AddCommand("Rem", typeof(ActionRem), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("PersistentGlobal", typeof(ActionPersistentGlobal), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Print", typeof(ActionPrint), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Say", typeof(ActionSay), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Set", typeof(ActionSet), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Static", typeof(ActionStatic), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Sleep", typeof(ActionSleep), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("While", typeof(ActionWhile), ActionBase.ActionType.While);
            ActionBase.AddCommand("//", typeof(ActionFullLineComment), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Else If", typeof(ActionElseIf), ActionBase.ActionType.ElseIf);
        }
예제 #39
0
        /// <summary>
        /// 設定Windows.Forms.Form 為 WPF 的子視窗
        /// </summary>
        /// <param name="form"></param>
        /// <param name="owner"></param>
        public static void SetOwner(System.Windows.Forms.Form form, System.Windows.Window owner)
        {
            WindowInteropHelper helper = new WindowInteropHelper(owner);

            SetWindowLong(new HandleRef(form, form.Handle), -8, helper.Handle.ToInt32());
        }
예제 #40
0
 public void SetMdiParent(System.Windows.Forms.Form mdiParent)
 {
     this.mdiParent = mdiParent;
 }
예제 #41
0
 private void m_Form_Closed(object sender, EventArgs e)
 {
     m_Form.Closed -= new EventHandler(m_Form_Closed);
     m_Form         = null;
 }
예제 #42
0
 public clsCotacoes(ref mdlTratamentoErro.clsTratamentoErro tratadorErro, ref mdlDataBaseAccess.clsDataBaseAccess ConnectionDB, string strEnderecoExecutavel, ref System.Windows.Forms.Form formParent, int nIdExportador, ref System.Windows.Forms.ImageList ilBandeiras)
 {
     m_cls_ter_tratadorErro  = tratadorErro;
     m_cls_dba_ConnectionDB  = ConnectionDB;
     m_strEnderecoExecutavel = strEnderecoExecutavel;
     m_formFMdiParent        = formParent;
     m_nIdExportador         = nIdExportador;
     m_ilBandeiras           = ilBandeiras;
     m_clsSorter             = new clsListViewItemComparer();
     m_clsDescendingSorter   = new clsListViewItemComparerDescending();
     carregaTypDatSet();
     mdlManipuladorArquivo.clsManipuladorArquivoIni obj = new mdlManipuladorArquivo.clsManipuladorArquivoIni(m_strEnderecoExecutavel + "sisco.ini");
     m_bMostrarBaloes = obj.retornaValor(mdlConstantes.clsConstantes.SHOW_BALLOONTIP_SESSAO, mdlConstantes.clsConstantes.SHOW_BALLOONTIP_VARIAVEL, true);
 }
예제 #43
0
        //Initialize
        protected override void Initialize()
        {
            System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.RealTime;

            //Set the windows forms, and directX graphics buffer to match the screen of the host computer
            int             maxHeight = 0; int maxWidth = 0; // vars to choose the max width and height
            GraphicsAdapter g = graphics.GraphicsDevice.Adapter;

            foreach (DisplayMode dm in g.SupportedDisplayModes)
            {
                if (maxHeight < dm.Height)
                {
                    maxHeight = dm.Height;
                }
                if (maxWidth < dm.Width)
                {
                    maxWidth = dm.Width;
                }
            }
            graphics.PreferredBackBufferHeight = maxHeight;
            graphics.PreferredBackBufferWidth  = maxWidth;

            //Configure DirectX graphics device
            graphics.GraphicsDevice.DepthStencilState = DepthStencilState.None;
            graphics.PreferMultiSampling = false;  //Set to true to have smooth texture edges
            GraphicsDevice.PresentationParameters.PresentationInterval = PresentInterval.One;
            graphics.ApplyChanges();

            //Merge directX drawing buffer with GDI+ drawing surface
            int[] margins = new int[] { 0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight };
            User32.DwmExtendFrameIntoClientArea(Window.Handle, ref margins);
            //xna game form
            form                   = System.Windows.Forms.Control.FromHandle(Window.Handle).FindForm();
            form.Visible           = true;
            form.AllowTransparency = true;
            //form.BackColor = System.Drawing.Color.Transparent;
            form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            form.TransparencyKey = form.BackColor;
            form.TopMost         = true;
            form.DesktopLocation = new System.Drawing.Point(0, 0);
            form.ClientSize      = new System.Drawing.Size(GraphicsDevice.DisplayMode.Width, GraphicsDevice.DisplayMode.Height);

            //Create a new directX spritebatch
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //Initialize SSVEP (Using DirectX)
            SSVEP_DirectX_Advanced_V2 ssvepDX = new SSVEP_DirectX_Advanced_V2(this);

            ssvepDX.Initialize(form, spriteBatch);
            Components.Add(ssvepDX);

            switch (selectedApp)
            {
            case 0:
                var appControl = new BCI_Logic.BCI2000_Control.AnyApp.AdvancedControl(this);
                Components.Add(appControl);
                break;

            case 1:
                var appControl1 = new BCI_Logic.BCI2000_Control.AnyApp.BasicControl(this);
                Components.Add(appControl1);
                break;

            case 2:
                var appControl2 = new WowControl(this, "World Of Warcraft");
                Components.Add(appControl2);
                break;

            case 3:
                var appControl3 = new SpecificAppControl(this, "Google Earth");
                Components.Add(appControl3);
                break;

            case 4:
                var appControl4 = new CursorControl(this);
                Components.Add(appControl4);
                break;

            case 5:
                var appControl5 = new BCI_Logic.BCI2000_Control.AnyApp.AdvancedControl(this);
                Components.Add(appControl5);
                break;
            }


            //Cursor practice
            // InitCursor();
            //mousePos.X=GraphicsDevice.Viewport.Width / 2;
            //mousePos.Y=GraphicsDevice.Viewport.Height / 2;
            //Mouse.SetPosition(mousePos.X,mousePos.Y);

            base.Initialize();
        }
예제 #44
0
 public void SetForm(System.Windows.Forms.Form form)
 {
 }
예제 #45
0
 public override void UpdateCursor(System.Windows.Forms.Form mainForm, IView view)
 {
     mainForm.Cursor = view.FingerCursor;
 }
예제 #46
0
        public bool CheckButtons(MKRevenge game, MouseState thismouse, MouseState lastmouse, Vector2 mouse, System.Windows.Forms.Form form)
        {
            KeyboardState keyboard = Keyboard.GetState();

            foreach (Button b in game.GetButtonlist())
            {
                if (keyboard.IsKeyDown(b.hotkey) && lastkeyboard.IsKeyUp(b.hotkey))
                {
                    b.waspressed = true;
                }
                else if (keyboard.IsKeyUp(b.hotkey) && lastkeyboard.IsKeyDown(b.hotkey))
                {
                    if (b.waspressed)
                    {
                        HandleButton(game, b);
                    }
                    b.waspressed = false;
                }
            }
            lastkeyboard = keyboard;

            foreach (Button b in game.GetButtonlist())
            {
                if (IsMouseOver(mouse, b, offsetvector))
                {
                    // First Click
                    if (thismouse.LeftButton == ButtonState.Pressed && lastmouse.LeftButton == ButtonState.Released)
                    {
                        if (b.attribute == "drag")
                        {
                            windowpos.X = game.Window.ClientBounds.Left;
                            windowpos.Y = game.Window.ClientBounds.Top;
                            mousesnap.X = System.Windows.Forms.Control.MousePosition.X;
                            mousesnap.Y = System.Windows.Forms.Control.MousePosition.Y;
                        }
                        b.waspressed = true;
                    }
                    // Dragging
                    if (b.attribute == "drag" && b.waspressed)
                    {
                        form.Location = new System.Drawing.Point((int)(windowpos.X + System.Windows.Forms.Control.MousePosition.X - mousesnap.X), (int)(windowpos.Y + System.Windows.Forms.Control.MousePosition.Y - mousesnap.Y));
                    }
                    //else if (thismouse.LeftButton == ButtonState.Pressed && lastmouse.LeftButton == ButtonState.Pressed)
                    //{

                    //}
                    // Released
                    if (thismouse.LeftButton == ButtonState.Released)
                    {
                        if (b.waspressed)
                        {
                            HandleButton(game, b);
                        }
                        b.waspressed = false;
                    }
                    return(true);
                }
            }
            return(false);
        }
예제 #47
0
	public void RemoveOwnedForm(System.Windows.Forms.Form ownedForm) {}
예제 #48
0
 public void SaveConnectionSettings(System.Windows.Forms.Form parentForm, System.ComponentModel.CancelEventArgs e)
 {
     settings.Save( );
 }
예제 #49
0
        /// <summary>
        /// Flash a specified number of times.
        /// </summary>
        /// <param name="form">"Me" from VB.NET, "this" from C#</param>
        /// <param name="count"># of times to flash.</param>
        /// <returns></returns>
        public static bool FlashWindow(System.Windows.Forms.Form form, uint count)
        {
            FLASHWINFO fi = Create_FLASHWINFO(form.Handle, FLASHW_ALL, count, 0);

            return(FlashWindowEx(ref fi));
        }
        public void CountSpecificSubType()
        {
            //-- do unit tests counting store 6 textboxes and know this (countbytype)

            System.Windows.Forms.Form form = new System.Windows.Forms.Form();
            _TestSingleTon.Instance._SetupForLayoutPanelTests();


            int count = 25;
            //	FakeLayoutDatabase layout = new FakeLayoutDatabase ("testguid");
            FAKE_LayoutPanel layoutPanel = new FAKE_LayoutPanel(CoreUtilities.Constants.BLANK, false);

            layoutPanel.NewLayout("testguid", true, null);

            // jan152013 - tweak to allow this to work with new system without rewriting all the tstings in LayoutDatabasetest
            LayoutDatabase layout = layoutPanel.GetLayoutDatabase();

            form.Controls.Add(layoutPanel);
            form.Show();

            NoteDataXML note = new NoteDataXML();

            for (int i = 0; i < count; i++)
            {
                note.Caption = "boo" + i.ToString();
                layout.Add(note);
                note.CreateParent(layoutPanel);
            }
            _w.output(String.Format("{0} Notes in Layout before save", layout.GetNotes().Count.ToString()));

            for (int i = 0; i < 6; i++)
            {
                note = new NoteDataXML_RichText();

                note.Caption = "richText";
                layout.Add(note);
                note.CreateParent(layoutPanel);
            }

            layout.SaveTo();

            //	_w.output(String.Format ("{0} Objects Saved", layout.ObjectsSaved().ToString()));
            layout = new FakeLayoutDatabase("testguid");

            layout.LoadFrom(layoutPanel);

            // now count RichText notes
            int count2 = 0;

            foreach (NoteDataInterface _note in layout.GetNotes())
            {
                if (_note.GetType() == typeof(NoteDataXML_RichText))
                {
                    count2++;
                }
            }

            _w.output(String.Format("{0} Objects Loaded", layout.GetNotes().Count));


            // added linktable
            Assert.AreEqual(7, count2);
        }
예제 #51
0
        private const uint FLASHW_TIMERNOFG = 12;    // Flash continuously until the window comes to the foreground.

        /// <summary>
        /// Flash until window receives focus.
        /// </summary>
        /// <param name="form">"Me" from VB.NET, "this" from C#</param>
        /// <returns></returns>
        public static bool FlashWindow(System.Windows.Forms.Form form)
        {
            FLASHWINFO fi = Create_FLASHWINFO(form.Handle, FLASHW_ALL | FLASHW_TIMERNOFG, uint.MaxValue, 0);

            return(FlashWindowEx(ref fi));
        }
예제 #52
0
 public static WebRTCCommons.CustomAwaiter <bool> ContextSwitchToMessagePumpAsync(this System.Windows.Forms.Form f)
 {
     WebRTCCommons.CustomAwaiter <bool> retVal = new WebRTCCommons.CustomAwaiter <bool>();
     retVal.forceWait();
     try
     {
         f.BeginInvoke((Action <WebRTCCommons.CustomAwaiter <bool> >)((a) =>
         {
             a.SetComplete(true);
         }), retVal);
     }
     catch
     {
     }
     return(retVal);
 }
예제 #53
0
 public void ShowDesktop()
 {
     desktopForm = DesktopManager.CreateDesktopForm(YMPCore.Browser.Browser, 0);
     DesktopManager.SetDesktopChildForm(desktopForm);
     cefBrowser.Visibility = Visibility.Hidden;
 }
예제 #54
0
	public void AddOwnedForm(System.Windows.Forms.Form ownedForm) {}
예제 #55
0
 public static bool IsForegroundWindow(this System.Windows.Forms.Form form)
 {
     return(GetForegroundWindow() == form.Handle);
 }
예제 #56
0
 public static void ForwardTo(System.Windows.Forms.Form from, System.Windows.Forms.Form to)
 {
     from.Hide();
     to.Show();
 }
예제 #57
0
 public BordereauDeclaratif(System.Windows.Forms.Form Owner)
     : this()
 {
     this.OwnerForm = Owner;
 }
예제 #58
0
        public override void Initialize(System.Windows.Forms.Control ownerControl, string videoFileName, EventHandler onVideoLoaded, EventHandler onVideoEnded)
        {
            _ownerControl = ownerControl;
            if (ownerControl != null)
            {
                _parentForm = ownerControl.FindForm();
            }
            string dllFile = GetVlcPath("libvlc.dll");

            if (File.Exists(dllFile))
            {
                Directory.SetCurrentDirectory(Path.GetDirectoryName(dllFile));
                _libVlcDLL = LoadLibrary(dllFile);
                LoadLibVlcDynamic();
            }
            else if (!Directory.Exists(videoFileName))
            {
                return;
            }

            OnVideoLoaded = onVideoLoaded;
            OnVideoEnded  = onVideoEnded;

            if (!string.IsNullOrEmpty(videoFileName))
            {
                string[] initParameters = new string[] { "--no-sub-autodetect-file" }; //, "--no-video-title-show" }; //TODO: Put in options/config file
                _libVlc = _libvlc_new(initParameters.Length, initParameters);
                IntPtr media = _libvlc_media_new_path(_libVlc, Encoding.UTF8.GetBytes(videoFileName + "\0"));
                _mediaPlayer = _libvlc_media_player_new_from_media(media);
                _libvlc_media_release(media);


                //  Linux: libvlc_media_player_set_xdrawable (_mediaPlayer, xdrawable);
                //  Mac: libvlc_media_player_set_nsobject (_mediaPlayer, view);

                if (ownerControl != null)
                {
                    _libvlc_media_player_set_hwnd(_mediaPlayer, ownerControl.Handle); // windows

                    //hack: sometimes vlc opens in it's own windows - this code seems to prevent this
                    for (int j = 0; j < 50; j++)
                    {
                        System.Threading.Thread.Sleep(10);
                        System.Windows.Forms.Application.DoEvents();
                    }
                    _libvlc_media_player_set_hwnd(_mediaPlayer, ownerControl.Handle); // windows
                }

                if (onVideoEnded != null)
                {
                    _videoEndTimer = new System.Windows.Forms.Timer {
                        Interval = 500
                    };
                    _videoEndTimer.Tick += VideoEndTimerTick;
                    _videoEndTimer.Start();
                }

                _libvlc_media_player_play(_mediaPlayer);
                _videoLoadedTimer = new System.Windows.Forms.Timer {
                    Interval = 500
                };
                _videoLoadedTimer.Tick += new EventHandler(VideoLoadedTimer_Tick);
                _videoLoadedTimer.Start();

                _mouseTimer = new System.Windows.Forms.Timer {
                    Interval = 25
                };
                _mouseTimer.Tick += MouseTimerTick;
                _mouseTimer.Start();
            }
        }
예제 #59
0
 public Navigator(System.Windows.Forms.Form container)
 {
     _container = container as FormMain;
 }
예제 #60
0
        ///<summary>
        /// Modal handler to click the cancel button.
        ///</summary>
        public void CancelFileHandler(string name, System.IntPtr hWnd, System.Windows.Forms.Form form)
        {
            OpenFileDialogTester dlg_tester = new OpenFileDialogTester(hWnd);

            dlg_tester.ClickCancel();
        }