Exemple #1
0
 void CheckFormChanges()
 {
     Meta.GetFormData(true);
     if (!Meta.WarnUnsaved())
     {
         MetaDataDetail.Focus();
     }
 }
Exemple #2
0
 internal override void SetFocus()
 {
     if (panel.CanFocus)
     {
         panel.Focus();
     }
 }
Exemple #3
0
 internal override void SetFocus()
 {
     if (_panel.IsHandleCreated && _panel.CanFocus)
     {
         _panel.Focus();
     }
 }
Exemple #4
0
        //Writer : Junsuk Park
        //Function : panel1_MouseDown
        //Print the angle to display (Actually, the angle in reading from the gimbal has weird value. (Not solved..)
        private void panel1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            // Update the mouse path with the mouse information
            Point mouseDownLocation = new Point(e.X, e.Y);

            angle = SerialProtocol.getAngle();

            switch (e.Button)
            {
            case MouseButtons.Left:
                if (angle[1] > 360)
                {
                    //angle[1] = angle[1] - 360;
                }
                this.label8.Text = "Pitch: " + angle[1].ToString();
                if (angle[2] > 360)
                {
                    // angle[2] = angle[2] - 360;
                }
                this.label7.Text = "Yaw: " + angle[2].ToString();
                break;

            default:
                break;
            }


            panel1.Focus();
            panel1.Invalidate();
        }
Exemple #5
0
        //-----------------------------------------------------------------------------------------------------------//

        private void PageActivate(System.Windows.Forms.Panel p_Panel)
        {
            pnPage01.Visible = false;
            pnPage02.Visible = false;
            p_Panel.Visible  = true;
            p_Panel.Focus();
        }
Exemple #6
0
        public void addNewTab(string path){
            bool hasTab = false;
            FileInfo fi = new FileInfo(path);
            foreach (TabPage tp in tabControlEditor.TabPages)
            {
                if (tp.Tag.ToString()==fi.FullName)
                {
                    hasTab = true;
                }
            }

            if (!hasTab)
            {
                tabControlEditor.TabPages.Add(fi.FullName, fi.Name, 0);
                WebKit.WebKitBrowser wb = new WebKit.WebKitBrowser();
                wb.Dock = DockStyle.Fill;
                Panel p = new Panel();
                p.Controls.Add(wb);
                p.Dock=DockStyle.Fill;
                tabControlEditor.TabPages[fi.FullName].Controls.Add(p);
                tabControlEditor.TabPages[fi.FullName].Tag = fi.FullName;
                string html = Properties.Resources.editor.ToString();
                html = html.Replace("{{code}}", File.ReadAllText(path));
                wb.DocumentText = html;
                p.Select();
                p.Focus();
                
  
            }
            tabControlEditor.SelectedTab = tabControlEditor.TabPages[fi.FullName];
            //tabControlEditor.Select();
            //tabControlEditor.Focus();
        }
 IntPtr RecreateSurface()
 {
     urhoSurface?.Dispose();
     urhoSurface = new Panel {
         Dock = DockStyle.Fill, BackColor = Color.Gray
     };
     WindowsFormsHost.Child = urhoSurface;
     WindowsFormsHost.Focus();
     urhoSurface.Focus();
     return(urhoSurface.Handle);
 }
Exemple #8
0
 public void SetGameControlMode()
 {
     if (!Game.GameControlMode)
     {
         //Game.RenderingFactory.FullScreen = true;
         RenderTarget.Focus();
         Cursor.Clip = RenderTarget.RectangleToScreen(RenderTarget.ClientRectangle);
         //Game.RenderingFactory.Mouse.ShowCursor(false);
         //Game.CurrentGameCommand = EnumSkill.None;
         Game.GameControlMode = true;
     }
 }
		async void samplesListbox_SelectedIndexChanged(object sender, EventArgs e)
		{
			currentApplication?.Engine.Exit();
			currentApplication = null;
			await semaphoreSlim.WaitAsync();
			var type = (Type) samplesListbox.SelectedItem;
			if (type == null) return;
			urhoSurfacePlaceholder.Controls.Clear(); //urho will destroy previous control so we have to create a new one
			var urhoSurface = new Panel { Dock = DockStyle.Fill };
			urhoSurfacePlaceholder.Controls.Add(urhoSurface);
			await Task.Delay(100);//give some time for GC to cleanup everything
			currentApplication = Application.CreateInstance(type, new ApplicationOptions("Data") { ExternalWindow = urhoSurface.Handle });
			urhoSurface.Focus();
			currentApplication.Run();
			semaphoreSlim.Release();
		}
Exemple #10
0
        private void panel1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            // Update the mouse path with the mouse information
            Point mouseDownLocation = new Point(e.X, e.Y);

            string eventString = null;

            switch (e.Button)
            {
            case MouseButtons.Left:
                eventString = "L";
                break;

            case MouseButtons.Right:
                eventString = "R";
                break;

            case MouseButtons.Middle:
                eventString = "M";
                break;

            case MouseButtons.XButton1:
                eventString = "X1";
                break;

            case MouseButtons.XButton2:
                eventString = "X2";
                break;

            case MouseButtons.None:
            default:
                break;
            }

            if (eventString != null)
            {
                mousePath.AddString(eventString, FontFamily.GenericSerif, (int)FontStyle.Bold, fontSize, mouseDownLocation, StringFormat.GenericDefault);
            }
            else
            {
                mousePath.AddLine(mouseDownLocation, mouseDownLocation);
            }
            panel1.Focus();
            panel1.Invalidate();
            count++;
        }
Exemple #11
0
        public void ShowLogPanel()
        {
            // Controls.Add( logPanel );
            logItem.Checked = logPanel.Visible = true;
            this.Text       = Globals.GetVersionString();

            if (_currentAppliance != null)
            {
                Controls.Remove(_currentAppliance.GetUIGenerator());
            }

            setActionItemName();

            logPanel.BringToFront();
            logBox.SelectionStart = logBox.TextLength;
            logBox.ScrollToCaret();
            logPanel.Focus();
            logBox.Focus();
            this.BringToFront();
        }
		async void RunGame(TypeInfo value)
		{
			currentApplication?.Exit();
			if (value == null) return;
			await semaphoreSlim.WaitAsync();
			//urho will destroy our Panel on Exit so let's create it for each sample
			var urhoSurface = new Panel { Dock = DockStyle.Fill };
			//TODO: capture mouse inside the control
			WindowsFormsHost.Child = urhoSurface;
			WindowsFormsHost.Focus();
			urhoSurface.Focus();
			await Task.Yield();
			var appOptions = new ApplicationOptions(assetsFolder: "Data")
				{
					ExternalWindow = RunInSdlWindow.IsChecked.Value ? IntPtr.Zero : urhoSurface.Handle,
					LimitFps = false, //true means "limit to 200fps"
				};
			currentApplication = Urho.Application.CreateInstance(value.Type, appOptions);
			currentApplication.Run();
			semaphoreSlim.Release();
		}
        //-----------------------------------------------------------------------------------------------------------//

        private void PageActivate(System.Windows.Forms.Panel p_Panel)
        {
            // Visible
            pnPage01.Visible = false;
            pnPage02.Visible = false;
            pnPage03.Visible = false;
            p_Panel.Visible  = true;

            // Panel Focus
            p_Panel.Focus();

            // Text Focus
            if (p_Panel == pnPage01)
            {
                txtAdresInput.Focus();
            }
            else if (p_Panel == pnPage02)
            {
                txtBarkod.Focus();
            }
        }
        public cEditor(fMain fmain, Panel editor, PictureBox rule, PictureBox report, TabPage editorTab) {
            m_fmain = fmain;
            m_editor = editor;
            m_editor.AutoScroll = true;

            m_picRule = rule;
            m_picRule.SetBounds(cUtil.mp(1), cUtil.mp(1), cUtil.mp(50), cUtil.mp(297));
            m_picRule.BackColor = Color.PeachPuff;

            m_picReport = report;
            m_picReport.SetBounds(cUtil.mp(50) + cUtil.mp(1), cUtil.mp(1), cUtil.mp(210), cUtil.mp(297));
            m_picReport.BackColor = Color.Beige;

            m_picReport.Paint += new PaintEventHandler(m_picReport_Paint);
            m_picRule.Paint += new PaintEventHandler(m_picRule_Paint);

            // mouse events
            //
            m_picReport.MouseDown += new MouseEventHandler(m_picReport_MouseDown);
            m_picReport.MouseUp += new MouseEventHandler(m_picReport_MouseUp);
            m_picReport.MouseMove += new MouseEventHandler(m_picReport_MouseMove);

            // mouse well
            //
            // se me cae un lagrimon :(
            //
            m_picReport.Click += (s, e) => { editor.Focus(); };

            // tab
            //
            m_editorTab = editorTab;

            m_editorTab.Enter += (s, e) => { cMainEditor.setDocActive(this); };

            m_editorTab.Tag = this;
        }
 private void panel3_MouseWheel(object sender, MouseEventArgs e)
 {
     panel3.Focus();
 }
Exemple #16
0
        public void BindToInput(Form form, Panel panel)
        {
            // handle alt+enter ourselves
            panel.KeyDown += (o, e) =>
            {
                if (e.KeyCode == Keys.W)
                {
                    m_InputDesc.wPressed = true;
                }
                if (e.KeyCode == Keys.S)
                {
                    m_InputDesc.sPressed = true;
                }
                if (e.KeyCode == Keys.A)
                {
                    m_InputDesc.aPressed = true;
                }
                if (e.KeyCode == Keys.D)
                {
                    m_InputDesc.dPressed = true;
                }
            };

            panel.KeyUp += (o, e) =>
            {
                if (e.KeyCode == Keys.W)
                {
                    m_InputDesc.wPressed = false;
                }
                if (e.KeyCode == Keys.S)
                {
                    m_InputDesc.sPressed = false;
                }
                if (e.KeyCode == Keys.A)
                {
                    m_InputDesc.aPressed = false;
                }
                if (e.KeyCode == Keys.D)
                {
                    m_InputDesc.dPressed = false;
                }
            };

            panel.MouseMove += (o, e) =>
            {
                float deltaX = (float)e.X - m_InputDesc.prevX;
                float deltaY = (float)e.Y - m_InputDesc.prevY;

                m_InputDesc.prevX = (float)e.X;
                m_InputDesc.prevY = (float)e.Y;

                if (e.Button == MouseButtons.Left)
                {
                    m_RotationX += deltaX / 90.0f;
                    m_RotationY += deltaY / 90.0f;
                    m_RotationY = Math.Min(Math.Max(m_RotationY, -(float)Math.PI / 2.0f + 0.01f), (float)Math.PI / 2.0f - 0.01f);
                }
               
            };

            panel.MouseDown += (o, e) =>
            {
                Program.m_ClickedX = e.X;
                Program.m_ClickedY = e.Y;
                panel.Focus(); 
            };
        }
        /// <summary>
        /// Creates the waiting box.
        /// </summary>
        private void CreateWaitingBox()
        {
            if (!this._IsWaitingBoxCreated)
            {
                #region CreateWaitingBox

                this.waitingBox = new System.Windows.Forms.Panel();
                //ControlHelper.BindMouseMoveEvent(this.waitingBox);
                waitingBox.BackColor = Color.WhiteSmoke;

                if (!Control.Contains(waitingBox))
                {
                    _Loading = new ProgressPanel();
                    //_Loading.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple;
                    _Loading.Appearance.BackColor                  = System.Drawing.Color.FromArgb(60, Color.WhiteSmoke);
                    _Loading.Appearance.Font                       = new System.Drawing.Font("Tahoma", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    _Loading.Appearance.ForeColor                  = System.Drawing.Color.Black;
                    _Loading.Appearance.Options.UseBackColor       = true;
                    _Loading.Appearance.Options.UseFont            = true;
                    _Loading.Appearance.Options.UseForeColor       = true;
                    _Loading.AppearanceCaption.Font                = new System.Drawing.Font("Microsoft Sans Serif", 12F);
                    _Loading.AppearanceCaption.Options.UseFont     = true;
                    _Loading.AppearanceDescription.Font            = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
                    _Loading.AppearanceDescription.Options.UseFont = true;
                    _Loading.Size        = new System.Drawing.Size(223, 53);
                    _Loading.Caption     = _text;
                    _Loading.Description = "";
                    //_Loading.Dock = System.Windows.Forms.DockStyle.Fill;
                    _Loading.Margin  = new System.Windows.Forms.Padding(2, 2, 2, 2);
                    _Loading.Name    = "progressPanel1";
                    _Loading.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
                    //_Loading.Size = new System.Drawing.Size(223, 53);
                    //_Loading.Location = new Point((Control.Width - _Loading.Width) / 2,  (Control.Height - _Loading.Height) / 2);//居中
                    _Loading.Dock = DockStyle.Top;
                    _Loading.LookAndFeel.SkinName = "Visual Studio 2013 Light";
                    _Loading.LookAndFeel.UseDefaultLookAndFeel = false;

                    _Loading.TabIndex = 0;
                    _Loading.Text     = "progressPanel1";

                    pe             = new PanelEx();
                    pe.Size        = new System.Drawing.Size(223, 75);
                    pe.Location    = new Point((Control.Width - _Loading.Width) / 2, (Control.Height - _Loading.Height) / 2);//居中
                    pe.BorderColor = Color.LightGray;
                    pe.Controls.Add(_Loading);
                    waitingBox.Controls.Add(pe);
                    Control.Controls.Add(waitingBox);
                    //取消按钮
                    buttonControl = new Xr.Common.Controls.ButtonControl();

                    buttonControl.BackColor      = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(245)))), ((int)(((byte)(245)))));
                    buttonControl.Dock           = DockStyle.None;
                    buttonControl.ForeColor      = System.Drawing.Color.FromArgb(((int)(((byte)(42)))), ((int)(((byte)(131)))), ((int)(((byte)(113)))));
                    buttonControl.HoverBackColor = System.Drawing.Color.Empty;
                    buttonControl.Location       = new Point((pe.Width - buttonControl.Width) / 2 + 10, _Loading.Height);//居中
                    buttonControl.Margin         = new System.Windows.Forms.Padding(5, 0, 5, 0);
                    buttonControl.Size           = new System.Drawing.Size(50, 20);
                    buttonControl.Style          = Xr.Common.Controls.ButtonStyle.Return;
                    buttonControl.TabIndex       = 90;
                    buttonControl.TabStop        = false;
                    buttonControl.Text           = "取消";
                    buttonControl.Click         += new System.EventHandler(this.button_Click);
                    pe.Controls.Add(buttonControl);
                }

                waitingBox.Show();
                this._IsWaitingBoxCreated = true;
                #endregion
            }
            _Loading.Caption = _text;
            if (IsShowCancelBtn)
            {
                if (buttonControl != null)
                {
                    buttonControl.Visible = true;
                    pe.Size = new System.Drawing.Size(223, 75);
                }
            }
            else
            {
                if (buttonControl != null)
                {
                    buttonControl.Visible = false;
                    pe.Size = new System.Drawing.Size(223, 52);
                }
            }
            if (status == false)
            {
                Rectangle rect = Control.DisplayRectangle;
                if (rectDisplay == new Rectangle())
                {
                    rect = Control.DisplayRectangle;
                }

                else
                {
                    rect                   = rectDisplay;
                    pe.Location            = new Point((rect.Width - _Loading.Width) / 2, (rect.Height - _Loading.Height) / 2); //居中
                    buttonControl.Location = new Point((pe.Width - buttonControl.Width) / 2 + 10, _Loading.Height);             //居中
                }
                waitingBox.Width    = rect.Width;
                waitingBox.Height   = rect.Height;
                waitingBox.Location = new Point(rect.X, rect.Y);

                if (IsShowtransparencyBG)
                {
                    waitingBox.BackgroundImage = this.CreateBacgroundImage();
                    //waitingBox.BackgroundImage = Properties.Resources.logo_mini;
                    waitingBox.BackgroundImageLayout = ImageLayout.Stretch;
                }
                if (_alpha != 0f)
                {
                    waitingBox.BackgroundImage = this.CreateBacgroundImage();
                    //waitingBox.BackgroundImage = Properties.Resources.logo_mini;
                    waitingBox.BackgroundImageLayout = ImageLayout.Stretch;
                }
            }

            waitingBox.Visible = true;
            waitingBox.BringToFront();
            waitingBox.Focus();
            status = true;
        }
        private void m_panelCalendrier_MouseDown(object sender, MouseEventArgs e)
        {
            m_panelCalendrier.Focus();
            if ((ModifierKeys & Keys.Control) != Keys.Control)
            {
                // Vider la sélection
                m_lstSelectionDates.Clear();
            }
            if ((ModifierKeys & Keys.Shift) == Keys.Shift)
            {
                // Ajoute du dernier au nouveau
                DateTime dt = DateTime.Now;
                if (GetDateTimeFromPoint(m_panelCalendrier.PointToClient(Cursor.Position), ref dt))
                {
                    HideSelection();
                    m_lstSelectionDates.Add(dt);
                    if (dt != m_lastSelectedDate)
                    {
                        int sens = dt < m_lastSelectedDate ? -1 : 1;
                        for (DateTime date = m_lastSelectedDate; date != dt; date = date.AddDays(sens))
                        {
                            m_lstSelectionDates.Add(date);
                        }
                    }
                    ShowSelection();

                    if (OnSelectedDateChanged != null)
                    {
                        OnSelectedDateChanged(this, new EventArgs());
                    }
                }
            }
            else
            {
                DateTime dt = DateTime.Now;
                if (GetDateTimeFromPoint(m_panelCalendrier.PointToClient(Cursor.Position), ref dt))
                {
                    // Ajoute nouveau
                    if (!m_lstSelectionDates.Contains(dt))
                    {
                        HideSelection();
                        m_lstSelectionDates.Add(dt);
                        ShowSelection();
                        if (OnSelectedDateChanged != null)
                        {
                            OnSelectedDateChanged(this, new EventArgs());
                        }
                    }
                    // Supprime nouveau
                    else
                    {
                        HideSelection();
                        m_lstSelectionDates.Remove(dt);
                        ShowSelection();
                        if (OnSelectedDateChanged != null)
                        {
                            OnSelectedDateChanged(this, new EventArgs());
                        }
                    }
                }

                // Dernier = nouveau
                m_lastSelectedDate = dt;
            }
        }
        private void panel1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            // Update the mouse path with the mouse information
            Point mouseDownLocation = new Point(e.X, e.Y);

            string eventString = null;

            switch (e.Button)
            {
            case MouseButtons.Left:
                eventString  = "G";
                pointDirX    = e.X;
                pointDirY    = e.Y;
                label12.Text = "Point direction X : " + pointDirX;
                label13.Text = "Point direction Y : " + pointDirY;
                break;

            case MouseButtons.Right:
                eventString  = "D";
                pointDirX    = e.X;
                pointDirY    = e.Y;
                label12.Text = "Point direction X : " + pointDirX;
                label13.Text = "Point direction Y : " + pointDirY;
                break;

            case MouseButtons.Middle:
                eventString    = "M";
                pointOriX      = e.X;
                pointOriY      = e.Y;
                label10.Text   = "Point origine X : " + pointOriX;
                label11.Text   = "Point origine Y : " + pointOriY;
                timer2.Enabled = true;

                timer2.Tick += timer_Tick2;

                timer2.Interval = 200;
                timer2.Start();

                break;

            case MouseButtons.XButton1:
                eventString = "B1";
                boutonStop_Click(sender, e);
                timer2.Stop();
                break;

            case MouseButtons.XButton2:
                eventString = "B2";
                break;

            case MouseButtons.None:
            default:
                break;
            }

            if (eventString != null)
            {
                mousePath.AddString(eventString, FontFamily.GenericSerif, (int)FontStyle.Bold, fontSize, mouseDownLocation, StringFormat.GenericDefault);
            }
            else
            {
                mousePath.AddLine(mouseDownLocation, mouseDownLocation);
            }
            panel1.Focus();
            panel1.Invalidate();
        }
Exemple #20
0
        public void attachTo(Panel mainGUI, bool userInput = false)
        {
            mainGUI.SuspendLayout();
            for (int i = 0; i < this.ColumnCount; ++i)
                this.Columns[i].Width = cellWidth;

            Point p = userInput ? new Point(0, offsetH) : SetFreeLocation();
            if (userInput)
                Location = p;

            titleLabel.Location = new Point(p.X, p.Y - 17);
            titleLabel.Width = Width;
            titleLabel.Height = 17;
            titleLabel.TextAlign = ContentAlignment.MiddleCenter;
            titleLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            titleLabel.FlatStyle = FlatStyle.System;

            titleLabel.BackColor = Color.LightBlue;
            titleLabel.Text = userInput ? "User X" : "X #" + objectCounter;

            mainGUI.Controls.Add(this);
            mainGUI.Controls.Add(titleLabel);
            mainGUI.ResumeLayout(false);
            mainGUI.Focus();
        }
Exemple #21
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            this.Focus();
            this.Leave += new EventHandler(p_Leave);
            img = ResClass.GetImgRes("login_inputbtn_down");
            if (Items != null)
            {
                p = new Panel();
                p.Left = 2;
                p.Top = 24;
                p.Width = this.Width - 5;
                p.Height = Items.Length * 20;
                p.AutoScroll = true;

                p.Focus();
                p.Leave+=new EventHandler(p_Leave);

                bool isScroll = false;

                int maxHeight = this.Parent.Height - this.Top - 24;
                int h = 20 * Items.Length + 5;
                if (h > maxHeight)
                {
                    isScroll = true;
                }
                else
                {
                    isScroll = false;
                }

                for (int i = 0; i < Items.Length; i++)
                {
                    QQComboBoxItem item = new QQComboBoxItem();
                    item.Name = "qqcomboBoxItem_" + i;
                    item.Texts = Items[i];
                    item.Left = 0;
                    item.Top = 20 * i;
                    if (isScroll)
                        item.Width = p.Width - 20;
                    else
                        item.Width = p.Width;
                    item.Height = 20;
                    item.MouseClick += new MouseEventHandler(item_MouseClick);
                    p.Controls.Add(item);
                }
                this.Controls.Add(p);
                if (this.Height == 26)
                {
                    if (isScroll)
                    {
                        this.Height += 20 * (maxHeight / 20) + 5;
                        p.Height = 20 * (maxHeight / 20);
                    }
                    else
                    {
                        this.Height += h;
                        p.Height = h - 5;
                    }
                    showed = true;
                }
                else
                {
                    this.Height = 26;
                    p.Height = 0;
                    showed = false;
                    p.Controls.Remove(p);
                    p.Dispose();
                }
                ControlCollection cce = this.Parent.Controls;
                for (int i = 0; i < cce.Count; i++)
                {
                    if (cce[i] is BasicComboBox && !cce[i].Name.Equals(this.Name))
                        (cce[i] as BasicComboBox).CloseListPanel();
                }
            }
            this.BringToFront();
            this.Invalidate();
        }