Exemple #1
0
        public override void OnMouseDoubleClick(MouseEventArgs e)
        {
            if (!Enabled)
            {
                return;
            }
            LastClickTime = 0;
            Buttons       = MouseButtons.None;

            if (ActiveControl != null && ActiveControl.IsMouseOver(e.Location) && ActiveControl != this)
            {
                if (ActiveControl == ClickedControl)
                {
                    ActiveControl.OnMouseDoubleClick(e);
                }
                else
                {
                    ActiveControl.OnMouseClick(e);
                }
            }
            else
            {
                if (ActiveControl == ClickedControl)
                {
                    base.OnMouseDoubleClick(e);
                }
                else
                {
                    base.OnMouseClick(e);
                }
            }
        }
Exemple #2
0
        protected override bool ProcessDialogKey(Keys keyData)
        {
            if (SelectedGridItem != null &&
                ActiveControl != null &&
                ActiveControl.GetType().ToString() == "System.Windows.Forms.PropertyGridInternal.PropertyGridView" &&
                keyData == Keys.Delete)
            {
                PropertyAdapterBase adapter = this.SelectedObject as PropertyAdapterBase;

                if (adapter.WixFiles != null)
                {
                    adapter.WixFiles.UndoManager.BeginNewCommandRange();
                }

                CustomXmlPropertyDescriptorBase descriptor = this.SelectedGridItem.PropertyDescriptor as CustomXmlPropertyDescriptorBase;
                if (descriptor != null && descriptor.XmlElement != null)
                {
                    this.SelectedObject = null;
                    adapter.RemoveProperty(descriptor.XmlElement);
                    this.SelectedObject = adapter;

                    return(true);
                }
            }

            return(base.ProcessDialogKey(keyData));
        }
Exemple #3
0
        // ESC TO CLOSE || KEYDOWN TO DOWNLIST || KEYUP TO UPLIST
        //------------------------------------------------------------------------------------------------------------
        private void frmUsuarioContaAcesso_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                e.Handled = true;
                btnClose_Click(sender, new EventArgs());
            }
            else if (e.KeyCode == Keys.Up && ActiveControl.GetType().BaseType.Name != "ComboBox")
            {
                e.Handled = true;

                if (lstItens.Items.Count > 0)
                {
                    if (lstItens.SelectedItems.Count > 0)
                    {
                        int i = lstItens.SelectedItems[0].Index;
                        lstItens.Items[i].Selected = false;

                        if (i == 0)
                        {
                            lstItens.Items[lstItens.Items.Count - 1].Selected = true;
                        }
                        else
                        {
                            lstItens.Items[i - 1].Selected = true;
                        }
                    }
                    else
                    {
                        lstItens.Items[0].Selected = true;
                    }

                    lstItens.EnsureVisible(lstItens.SelectedItems[0]);
                }
            }
            else if (e.KeyCode == Keys.Down && ActiveControl.GetType().BaseType.Name != "ComboBox")
            {
                e.Handled = true;

                if (lstItens.Items.Count > 0)
                {
                    if (lstItens.SelectedItems.Count > 0)
                    {
                        int i = lstItens.SelectedItems[0].Index;
                        lstItens.Items[i].Selected = false;
                        if (i == lstItens.Items.Count - 1)
                        {
                            i = -1;
                        }
                        lstItens.Items[i + 1].Selected = true;
                    }
                    else
                    {
                        lstItens.Items[0].Selected = true;
                    }

                    lstItens.EnsureVisible(lstItens.SelectedItems[0]);
                }
            }
        }
Exemple #4
0
        private void btnMnuPaste_Click(object sender, EventArgs e)
        {
            if (ActiveControl.GetType() != typeof(TextBox))
            {
                return;
            }
            var thisControl = (TextBox)ActiveControl;

            // Paste the clipboard to the textbox
            // Determine if there is any text in the Clipboard to paste into the text box.
            var dataObject = Clipboard.GetDataObject();

            if (dataObject == null || dataObject.GetDataPresent(DataFormats.Text) != true)
            {
                return;
            }
            // Determine if any text is selected in the text box.
            if (thisControl.SelectionLength > 0)
            {
                // Ask user if they want to paste over currently selected text.
                if (
                    MessageBox.Show(@"Do you want to paste over current selection?", @"Cut Example",
                                    MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    // Move selection to the point after the current selection and paste.
                    thisControl.SelectionStart = thisControl.SelectionStart + thisControl.SelectionLength;
                }
            }
            // Paste current text in Clipboard into text box.
            thisControl.Paste();
        }
Exemple #5
0
        public override void OnMouseClick(MouseEventArgs e)
        {
            if (!Enabled)
            {
                return;
            }
            if (Buttons == e.Button)
            {
                if (LastClickTime + SystemInformation.DoubleClickTime >= Main.Time)
                {
                    OnMouseDoubleClick(e);
                    return;
                }
            }
            else
            {
                LastClickTime = 0;
            }

            if (ActiveControl != null && ActiveControl.IsMouseOver(e.Location) && ActiveControl != this)
            {
                ActiveControl.OnMouseClick(e);
            }
            else
            {
                base.OnMouseClick(e);
            }

            ClickedControl = ActiveControl;

            LastClickTime = Main.Time;
            Buttons       = e.Button;
        }
Exemple #6
0
        public override void OnMouseClick(MouseEventArgs e)
        {
            if (!Enabled)
            {
                return;
            }
            if (_buttons == e.Button)
            {
                if (_lastClickTime + SystemInformation.DoubleClickTime >= CMain.Time)
                {
                    OnMouseDoubleClick(e);
                    return;
                }
            }
            else
            {
                _lastClickTime = 0;
            }

            if (ActiveControl != null && ActiveControl.IsMouseOver(CMain.MPoint) && ActiveControl != this)
            {
                ActiveControl.OnMouseClick(e);
            }
            else
            {
                base.OnMouseClick(e);
            }

            _clickedControl = ActiveControl;

            _lastClickTime = CMain.Time;
            _buttons       = e.Button;
        }
Exemple #7
0
 private void Form1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Control && e.KeyCode.Equals(Keys.Enter))
     {
         // 終了
         Application.Exit();
     }
     else if (e.KeyCode.Equals(Keys.Enter))
     {
         // 非表示
         if (lbString.SelectedIndex >= 0)
         {
             Clipboard.SetText(lbString.SelectedItem.ToString());
         }
         this.Visible = false;
     }
     if (e.KeyCode.Equals(Keys.Down))
     {
         if (ActiveControl.Equals(lbString) && !lbString.SelectedIndex.Equals(lbString.Items.Count - 1))
         {
             return;
         }
         // フォーカス移動
         SelectNextControl(ActiveControl, true, true, true, true);
     }
     else if (e.KeyCode.Equals(Keys.Up))
     {
         if (ActiveControl.Equals(lbString) && !lbString.SelectedIndex.Equals(0))
         {
             return;
         }
         // フォーカス移動
         SelectNextControl(ActiveControl, false, true, true, true);
     }
 }
Exemple #8
0
        protected override void WndProc(ref Message m)
        {
            if (!IsWindowsTen() && !FrameInvisible)
            {
                base.WndProc(ref m);
                return;
            }

            switch ((WindowsMessage)m.Msg)
            {
            case WindowsMessage.WM_NCPAINT:
                // Win10の時に非クライアント領域の描画を行わない
                if (IsWindowsTen())
                {
                    Refresh();
                    return;
                }
                break;

            case WindowsMessage.WM_NCACTIVATE:
                // モードレスダイアログがアクティブになる時はメッセージを処理する
                if (m.LParam != IntPtr.Zero)
                {
                    base.WndProc(ref m);
                    Refresh();
                    return;
                }

                if (m.WParam != IntPtr.Zero && m.LParam == IntPtr.Zero)
                {
                    OnActivated(new EventArgs());

                    return;
                }
                OnDeactivate(new EventArgs());

                // 書き込み入力欄のキャレットが他のウィンドウがアクティブになっても表示される問題を処理する
                if (ActiveControl != null && ActiveControl.ToString() == "PeerstPlayer.Controls.StatusBar.StatusBarControl")
                {
                    ActiveControl = null;
                }

                return;

            case WindowsMessage.WM_NCCALCSIZE:
                // 最大化の時は普通に処理する
                if (Win32API.IsZoomed(Handle))
                {
                    break;
                }
                // 非クライアント領域を無しにする
                return;

            case WindowsMessage.WM_WINDOWPOSCHANGED:
                DefWndProc(ref m);
                UpdateBounds();
                return;
            }
            base.WndProc(ref m);
        }
Exemple #9
0
        public override void OnMouseDoubleClick(MouseEventArgs e)
        {
            if (!Enabled)
            {
                return;
            }
            _lastClickTime = 0;
            _buttons       = MouseButtons.None;

            if (ActiveControl != null && ActiveControl.IsMouseOver(CMain.MPoint) && ActiveControl != this)
            {
                if (ActiveControl == _clickedControl)
                {
                    ActiveControl.OnMouseDoubleClick(e);
                }
                else
                {
                    ActiveControl.OnMouseClick(e);
                }
            }
            else
            {
                if (ActiveControl == _clickedControl)
                {
                    base.OnMouseDoubleClick(e);
                }
                else
                {
                    base.OnMouseClick(e);
                }
            }
        }
Exemple #10
0
 private void GetParts()
 {
     _activeControl        = ActiveControl.PasswordBox;
     _passwordBoxTextBox   = this.FindNameEx <TextBox>("NPasswordBoxViewedText");
     _passwordBoxWin       = this.FindNameEx <System.Windows.Controls.PasswordBox>("NPasswordBoxWin");
     _pasPasswordBoxButton = this.FindNameEx <CheckBox>("NPasswordBoxButton");
 }
Exemple #11
0
        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            if (Visibility == Visibility.Collapsed)
            {
                throw new Exception("Visibility is \"Collapsed\" the style not will be loaded");
            }

            _activeControl        = ActiveControl.PasswordBox;
            _passwordBoxTextBox   = this.FindChildByName <TextBox>("NPasswordBoxViewedText");
            _passwordBoxWin       = this.FindChildByName <System.Windows.Controls.PasswordBox>("NPasswordBoxWin");
            _pasPasswordBoxButton = this.FindChildByName <CheckBox>("NPasswordBoxButton");

            if (_passwordBoxTextBox == null)
            {
                throw new NullReferenceException("Could not find NPasswordBoxViewedText");
            }
            if (_passwordBoxWin == null)
            {
                throw new NullReferenceException("Could not find NPasswordBoxWin");
            }
            if (_pasPasswordBoxButton == null)
            {
                throw new NullReferenceException("Could not find NPasswordBoxButton");
            }

            _pasPasswordBoxButton.Click     += BtnOnClick;
            _passwordBoxTextBox.TextChanged += PasswordBoxTextBoxOnTextChanged;
            _passwordBoxWin.PasswordChanged += PasswordBoxWinOnPasswordChanged;
        }
Exemple #12
0
        private void FrmPurchaseIndent_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter && ActiveControl != Grid)
            {
                SendKeys.Send("{Tab}");
                ActiveControl.Select();
            }
            else if (e.KeyCode == Keys.Escape)
            {
                if (TxtGridParticular.Visible == true)
                {
                    _GridControlMode = false;
                    GridControlMode(false);
                    _GridControlMode = true;
                    Grid.Focus();
                }
                else if (BtnCancel.Enabled == true)
                {
                    _Tag         = "";
                    TxtDate.Text = "";
                    BtnCancel.PerformClick();
                }
                else if (BtnCancel.Enabled == false)
                {
                    BtnExit.PerformClick();
                }

                DialogResult = DialogResult.Cancel;
                return;
            }
        }
Exemple #13
0
        /// <summary>
        /// Called by the authority to signal that this surface has been deleted.
        /// </summary>
        internal void Authority_Delete()
        {
            // If we are still attached to a surface, throw an error.
            if (ActiveSurface != null)
            {
                throw new Exception("Cannot delete display while still attached to surface.");
            }

            // Remove the web control.
            if (ActiveControl != null)
            {
                ActiveControl.Dispose();
                ActiveControl = null;
            }

            // Free up any other resources we may have created.
            this.DeleteResources();

            // And'were done - set the deleted flag.
            bDeleted = true;

            // Say we are deleted.
            if (OnDeleted != null)
            {
                OnDeleted(this);
            }
        }
Exemple #14
0
        /// <summary>
        /// Reload the display and its content.  Reloading will also delete any other resources we have.
        /// </summary>
        /// <param name="bHard">True if we want to remove and then re-create the webcontrol.  False if we just want to do a web-refresh.</param>
        /// <param name="bIgnoreCache">If this is just a web-refresh, do we want to ignore the cache.</param>
        public void Reload(bool bHard, bool bIgnoreCache = true)
        {
            // If it is active.
            if (ActiveControl == null)
            {
                return;
            }

            // If it is on a surface.
            if (ActiveSurface == null)
            {
                return;
            }

            // If it is a hard reset.
            if (bHard)
            {
                // Remove the control and re-add it.
                ActiveSurface.Display_SetVisual(null);
                ActiveControl.Dispose();
                ActiveControl = null;

                this.DeleteResources();
                ActiveControl = CreateRenderable();
                ActiveSurface.Display_SetVisual(ActiveControl);
            }
            else
            {
                this.DeleteResources();
                ActiveControl.Reload(bIgnoreCache);
            }
        }
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            frmPrincipal tela = new frmPrincipal();

            tela.Show();
            ActiveControl.Hide();
        }
Exemple #16
0
        /// <summary>
        /// Called by a surface to signal that this display should detach from it.
        /// </summary>
        /// <remarks>Here it could destroy the visual to be shown and remove it from the surface by calling: pSurface.Display_SetVisual(null).</remarks>
        /// <param name="pSurface"></param>
        public void Surface_UnbindFromSurface(Surface pSurface)
        {
            // Error checking.
            if (pSurface == null)
            {
                throw new ArgumentNullException("Cannot unbind from a null surface.");
            }

            // Check the surface is our active one.
            if (pSurface != ActiveSurface)
            {
                throw new Exception("Surface to deatch from and stored surface do not match.");
            }

            // Unbind from spatial update events.
            ActiveSurface.OnSurfacePropertiesUpdated -= Surface_OnSpatialPropertiesUpdated;

            // Remove the renderable from the surface.
            ActiveSurface.Display_SetVisual(null);
            ActiveSurface.Display_ResetVisualRenderSize();

            // Destroy the renderable.
            //  n.b. With a few small changes (i.e. not calling this) we could preserve the WebView while not attached to a surface.
            //       this would be good for moving displays without losing state.
            ActiveControl.Dispose();
            ActiveControl = null;

            // Remove any resources we have attached (i.e. spatial queries).
            this.DeleteResources();

            // Remove the reference to the active surface.
            ActiveSurface = null;
        }
Exemple #17
0
        private void toolStripMenuItem11_Click(object sender, EventArgs e)
        {
            var bnd = ActiveControl.Bounds;
            var bmp = new Bitmap(bnd.Width, bnd.Height);

            ActiveControl.DrawToBitmap(bmp, new Rectangle(new Point(), bnd.Size));
            Clipboard.SetImage(bmp);
        }
        // ESC TO CLOSE || KEYDOWN TO DOWNLIST || KEYUP TO UPLIST
        //------------------------------------------------------------------------------------------------------------
        private void frmCongregacaoReuniaoListagem_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                e.Handled = true;
                btnFechar_Click(sender, new EventArgs());
            }
            else if (e.KeyCode == Keys.Up && ActiveControl.GetType().BaseType.Name != "ComboBox")
            {
                e.Handled = true;

                if (dgvListagem.Rows.Count > 0)
                {
                    if (dgvListagem.SelectedRows.Count > 0)
                    {
                        int i = dgvListagem.SelectedRows[0].Index;
                        dgvListagem.Rows[i].Selected = false;
                        if (i == 0)
                        {
                            i = dgvListagem.Rows.Count;
                        }
                        dgvListagem.Rows[i - 1].Selected = true;
                    }
                    else
                    {
                        dgvListagem.Rows[0].Selected = true;
                    }

                    dgvListagem.FirstDisplayedScrollingRowIndex   = dgvListagem.SelectedRows[0].Index;
                    dgvListagem.SelectedRows[0].Cells[0].Selected = true;
                }
            }
            else if (e.KeyCode == Keys.Down && ActiveControl.GetType().BaseType.Name != "ComboBox")
            {
                e.Handled = true;

                if (dgvListagem.Rows.Count > 0)
                {
                    if (dgvListagem.SelectedRows.Count > 0)
                    {
                        int i = dgvListagem.SelectedRows[0].Index;
                        dgvListagem.Rows[i].Selected = false;
                        if (i == dgvListagem.Rows.Count - 1)
                        {
                            i = -1;
                        }
                        dgvListagem.Rows[i + 1].Selected = true;
                    }
                    else
                    {
                        dgvListagem.Rows[0].Selected = true;
                    }

                    dgvListagem.FirstDisplayedScrollingRowIndex   = dgvListagem.SelectedRows[0].Index;
                    dgvListagem.SelectedRows[0].Cells[0].Selected = true;
                }
            }
        }
        private void buttonNext_Click(object sender, EventArgs e)
        {
            Form2 form2 = new Form2();

            string formName = ActiveControl.FindForm().Name.ToString();

            TimeHandler.StartTime();
            form2.Show();
        }
 void openContextMenu(object sender, EventArgs e)
 {
     // dirty Ctrl+C override avoidance (1/2)
     if (ActiveControl.GetType().Name == "TextBox")
     {
         TextBox t = (TextBox)ActiveControl;
         t.DeselectAll();
     }
 }
Exemple #21
0
 private bool IsRibbonGroupSelected()
 {
     if (ActiveControl.GetType() != typeof(RibbonGroup))
     {
         MessageBox.Show("Nessun gruppo selezionato...", "ATTENZIONE!!!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return(false);
     }
     return(true);
 }
Exemple #22
0
 private void FormOptions_Leave(object sender, EventArgs e)
 {
     try
     {
         ActiveControl.SelectNextControl(ActiveControl, true, true, false, true);
         ActiveControl.SelectNextControl(ActiveControl, false, true, false, true);
     }
     catch { }
 }
        private void pasteRuleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //If a textbox is focused let that handle ctrl-c and ctrl-v
            if (CtrlPressed && (ActiveControl != null) && (ActiveControl.GetType() == typeof(TextBox)))
            {
                ((TextBox)ActiveControl).Paste();
                return;
            }

            PasteRuleFromClipboard(true);
        }
        private void copyRuleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //If a textbox is focused let that handle ctrl-c and ctrl-v
            if (CtrlPressed && (ActiveControl != null) && (ActiveControl.GetType() == typeof(TextBox)))
            {
                ((TextBox)ActiveControl).Copy();
                return;
            }

            CopyCurrentRuleToClipboard();
        }
Exemple #25
0
        /// <summary>
        /// Checks whether the given timeline object's attribute is editable for the current
        /// context and document</summary>
        /// <param name="item">Timeline object that changed</param>
        /// <param name="attribute">Attribute on the timeline object that changed</param>
        /// <returns>True iff this timeline object attribute is editable for the current
        /// ActiveControl, ActiveContext, and ActiveDocument properties</returns>
        public virtual bool IsEditable(ITimelineObject item, AttributeInfo attribute)
        {
            if (attribute == Schema.groupType.expandedAttribute)
            {
                return(true);
            }

            TimelinePath path = new TimelinePath(item);

            return(ActiveControl.IsEditable(path));
        }
Exemple #26
0
 protected void btn0_Click(object sender, EventArgs e)
 {
     //bubble the event up to the parent
     if (this.ButtonClick != null)
     {
         Button btn = (Button)sender;
         ActiveControl.Focus();
         SendKeys.Send(btn.Text);
         this.ButtonClick(sender, e);
     }
 }
Exemple #27
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     //removes last character from string and assigns it back
     if (this.ButtonClick != null)
     {
         Button btn = (Button)sender;
         ActiveControl.Focus();
         SendKeys.Send("{BS}");
         this.ButtonClick(sender, e);
     }
 }
Exemple #28
0
        private void btnMnuCopy_Click(object sender, EventArgs e)
        {
            if (ActiveControl.GetType() != typeof(TextBox))
            {
                return;
            }
            var thisControl = (TextBox)ActiveControl;

            // Copy the textbox to the clipboard
            thisControl.Copy();
        }
 private void radFindWorker_CheckedChanged(object sender, EventArgs e)
 {
     if (radFindWorker.Checked == true)
     {
         objFindPerson FindPerson = new objFindPerson();
         radAddWorker.Checked = false;
         objPanel.Controls.Clear();
         objPanel.Controls.Add(FindPerson);
         ActiveControl = FindPerson;
         ActiveControl.Focus();
     }
 }
Exemple #30
0
        /// <summary>
        /// Asynchronously invoke a Javascript method on this display.
        /// </summary>
        /// <param name="sFunction">The name of the global function to call in the JS.</param>
        /// <param name="tArguments">A list of parameters to pass.</param>
        public void AsyncCallGlobalFunction(String sFunction, params JSValue[] tArguments)
        {
            // If we do not have an active web control.
            if (ActiveControl == null)
            {
                Log.Write("Cannot call method on display (" + this.ToString() + ") which does not have a web visual.", Authority.AUTHORITY_LOG_SOURCE, Log.Type.AppError);
                return;
            }

            // FIXME ASAP
            // THIS IS VERY SLOW BECAUSE IT USES SYNC COMMUNICATION TO GET THE OBJECT TO CALL
            // BUT APPARENTLY THIS IS THE ONLY WAY TO DO IT
            // http://forums.awesomium.com/viewtopic.php?f=4&t=1167&p=1470&hilit=CallJavascriptFunction#p1470
            // THE WAY I AM GOING TO SOLVE THIS FOR NOW IS TO CONVERT ALL THE ARGS TO A JS STRING AND EXECUTE IT.

            // FIXME: Make me properly Async.
            // TODO: Test my little converter function.. its probably crap!
            StringBuilder pString = new StringBuilder();

            if (tArguments != null)
            {
                for (int i = 0, n = tArguments.Length; i < n; ++i)
                {
                    pString.Append(ToJSON(tArguments[i]));
                    if (i < (n - 1))
                    {
                        pString.Append(",");
                    }
                }
            }
            var s = pString.ToString();

            // Push it to the dispatcher (we need to be in the calling thread).
            ActiveControl.Dispatcher.BeginInvoke((Action) delegate()
            {
                try
                {
                    if (ActiveControl == null || !ActiveControl.IsProcessCreated)
                    {
                        return;
                    }

                    var sJavascript = @"if ('" + sFunction + @"' in window) {" + sFunction + @"(" + s + @"); }
else {  }"; // Authority.log('" + sFunction + @" function not found.');
                    //Console.WriteLine(sJavascript);
                    ActiveControl.ExecuteJavascript(sJavascript);
                }
                catch (Exception e)
                {
                    // Just drop exceptions.. icky..
                }
            });
        }