Ejemplo n.º 1
0
        /// <summary>
        /// Displays a prompt in a dialog box, waits for the user to input text or click a button.
        /// </summary>
        /// <param name="prompt">String expression displayed as the message in the dialog box</param>
        /// <param name="title">String expression displayed in the title bar of the dialog box</param>
        /// <param name="defaultResponse">String expression displayed in the text box as the default response</param>
        /// <param name="validator">Delegate used to validate the text</param>
        /// <param name="keyPressHandler">Delete used to handle keypress events of the textbox</param>
        /// <param name="xpos">Numeric expression that specifies the distance of the left edge of the dialog box from the left edge of the screen.</param>
        /// <param name="ypos">Numeric expression that specifies the distance of the upper edge of the dialog box from the top of the screen</param>
        /// <returns>An InputBoxResult object with the Text and the OK property set to true when OK was clicked.</returns>
        public static InputBoxResult Show(string prompt, string title, string defaultResponse, InputBoxValidatingHandler validator, KeyPressEventHandler keyPressHandler, int xpos, int ypos)
        {
            using (InputBox form = new InputBox())
            {
                form.label.Text = prompt;
                form.Text = title;
                form.textBox.Text = defaultResponse;
                if (xpos >= 0 && ypos >= 0)
                {
                    form.StartPosition = FormStartPosition.Manual;
                    form.Left = xpos;
                    form.Top = ypos;
                }

                form.Validator = validator;
                form.KeyPressed = keyPressHandler;

                DialogResult result = form.ShowDialog();

                InputBoxResult retval = new InputBoxResult();
                if (result == DialogResult.OK)
                {
                    retval.Text = form.textBox.Text;
                    retval.OK = true;
                }

                return retval;
            }
        }
Ejemplo n.º 2
0
 public BigList(IListModel provider)
 {
     this.provider = provider;
       RefAccessible ().Role = Atk.Role.List;
       hAdjustment = new Gtk.Adjustment (0, 0, currentWidth, 1, 1, 1);
       hAdjustment.ValueChanged += new EventHandler (HAdjustmentValueChangedHandler);
       vAdjustment = new Gtk.Adjustment (0, 0, provider.Rows, 1, 1, 1);
       vAdjustment.ValueChanged += new EventHandler (VAdjustmentValueChangedHandler);
       layout = new Pango.Layout (PangoContext);
       ExposeEvent += new ExposeEventHandler (ExposeHandler);
       ButtonPressEvent += new ButtonPressEventHandler (ButtonPressEventHandler);
       ButtonReleaseEvent += new ButtonReleaseEventHandler (ButtonReleaseEventHandler);
       KeyPressEvent += new KeyPressEventHandler (KeyHandler);
       Realized += new EventHandler (RealizeHandler);
       Unrealized += new EventHandler (UnrealizeHandler);
       ScrollEvent += new ScrollEventHandler (ScrollHandler);
         SizeAllocated += new SizeAllocatedHandler (SizeAllocatedHandler);
       MotionNotifyEvent += new MotionNotifyEventHandler (MotionNotifyEventHandler);
       AddEvents ((int) EventMask.ButtonPressMask | (int) EventMask.ButtonReleaseMask | (int) EventMask.KeyPressMask | (int) EventMask.PointerMotionMask);
       CanFocus = true;
       style_widget = new EventBox ();
       style_widget.StyleSet += new StyleSetHandler (StyleHandler);
       layout.SetMarkup (ellipsis);
       layout.GetPixelSize (out ellipsis_width, out line_height);
       layout.SetMarkup ("n");
       layout.GetPixelSize (out en_width, out line_height);
       layout.SetMarkup ("W");
       layout.GetPixelSize (out en_width, out line_height);
       old_width = Allocation.Width;
 }
Ejemplo n.º 3
0
 public NumericTextBox()
 {
     LostFocus += new EventHandler(TextBox_LostFocus);
     GotFocus += new EventHandler(TextBox_GotFocus);
     TextChanged += new EventHandler(TextBox_TextChanged);
     KeyDown += new KeyEventHandler(TextBox_KeyDown);
     KeyPress += new KeyPressEventHandler(TextBox_KeyPress);
 }
Ejemplo n.º 4
0
 public MainForm()
 {
     InitializeComponent();
     KeyPreview = true;
     MaximizeBox = false;
     KeyPress += new KeyPressEventHandler(PressHandler);
     FormBorderStyle = FormBorderStyle.FixedSingle;
 }
Ejemplo n.º 5
0
 public LogWindow(Manager simiasManager)
     : base(Util.GS("iFolder Synchronization Log"))
 {
     this.simiasManager = simiasManager;
        CreateWidgets();
        ControlKeyPressed = false;
        KeyPressEvent += new KeyPressEventHandler(KeyPressHandler);
        KeyReleaseEvent += new KeyReleaseEventHandler(KeyReleaseHandler);
 }
Ejemplo n.º 6
0
Archivo: Tick.cs Proyecto: Simonxz/tick
        public Tick()
        {
            BackgroundImageLayout = ImageLayout.Stretch;
            Cursor.Hide();
            FormBorderStyle = FormBorderStyle.None;
            Icon = (Icon)new ResourceManager("Tick", Assembly.GetExecutingAssembly()).GetObject("Tick.ico");;
            Text = "Tick";
            WindowState = FormWindowState.Maximized;

            try {
                BackgroundImage = Image.FromFile("skin\\background.png");
            }
            catch (FileNotFoundException ex) {
                MessageBox.Show(ex.Message + " is missing", "Tick", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            PictureBox separator = new PictureBox();
            separator.BackgroundImageLayout = ImageLayout.Stretch;
            separator.Dock = DockStyle.Fill;
            try {
                separator.BackgroundImage = Image.FromFile("skin\\separator.png");
            }
            catch (FileNotFoundException ex) {
                MessageBox.Show(ex.Message + " is missing", "Tick", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            for (int i = 0; i < 4; i++) {
                digits[i] = new PictureBox();
                digits[i].BackgroundImageLayout = ImageLayout.Stretch;
                digits[i].Dock = DockStyle.Fill;
            }

            TableLayoutPanel tableLayoutPanel = new TableLayoutPanel();
            tableLayoutPanel.Dock = DockStyle.Fill;
            tableLayoutPanel.BackColor = Color.Transparent;
            tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 22.5F));
            tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 22.5F));
            tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 10F));
            tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 22.5F));
            tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 22.5F));
            tableLayoutPanel.Controls.Add(digits[0], 0, 0);
            tableLayoutPanel.Controls.Add(digits[1], 1, 0);
            tableLayoutPanel.Controls.Add(separator, 2, 0);
            tableLayoutPanel.Controls.Add(digits[2], 3, 0);
            tableLayoutPanel.Controls.Add(digits[3], 4, 0);
            Controls.Add(tableLayoutPanel);

            Timer timer = new Timer();
            timer.Interval = 60000;
            timer.Enabled = true;

            timer.Tick += new EventHandler(Timer);
            KeyPress += new KeyPressEventHandler(KeyPressHandler);

            UpdateClock();
        }
Ejemplo n.º 7
0
        public FormatadorNome()
        {
            InitializeComponent();

            aoPressionarTecla = new KeyPressEventHandler(AoPressionarTecla);
            aoDeixarTextBox = new EventHandler(AoDeixarTextBox);
            aoAlterarTexto = new EventHandler(AoAlterarTexto);

            if (constantes == null)
                CarregarConstantes();
        }
Ejemplo n.º 8
0
 public PreferencesWindow(iFolderWebService webService, Manager simiasManager)
     : base(Util.GS("iFolder Preferences"))
 {
     if(webService == null)
     throw new ApplicationException("iFolderWebServices was null");
        ifws = webService;
        InitializeWidgets(simiasManager);
        ControlKeyPressed = false;
        KeyPressEvent += new KeyPressEventHandler(KeyPressHandler);
        KeyReleaseEvent += new KeyReleaseEventHandler(KeyReleaseHandler);
 }
Ejemplo n.º 9
0
		public Waiter(ConsoleControl.ConsoleControl cons)
		{
			this._cons = cons;
			this._rtb = cons.InternalRichTextBox;
			this._consHandlr = new ConsoleEventHandler(OnConsInput);
			this._rtbKeyPress = new KeyPressEventHandler(OnRtbKeyPress);
			//this._rtbKeyDown = new KeyEventHandler(OnRtbKeyDown);

			this._cons.OnConsoleInput += _consHandlr;
			this._cons.InternalRichTextBox.KeyPress += _rtbKeyPress;
			//this._cons.InternalRichTextBox.KeyDown += _rtbKeyDown;
		}
Ejemplo n.º 10
0
 public LogWindow(Manager simiasManager)
     : base(Util.GS("iFolder Synchronization Log"))
 {
     CreateWidgets();
        ControlKeyPressed = false;
        KeyPressEvent += new KeyPressEventHandler(KeyPressHandler);
        KeyReleaseEvent += new KeyReleaseEventHandler(KeyReleaseHandler);
        simiasEventBroker = SimiasEventBroker.GetSimiasEventBroker();
        if (simiasEventBroker != null)
        {
     simiasEventBroker.CollectionSyncEventFired +=
      new CollectionSyncEventHandler(OniFolderSyncEvent);
     simiasEventBroker.FileSyncEventFired +=
      new FileSyncEventHandler(OniFolderFileSyncEvent);
        }
 }
        public FirstPerspectiveManipulater()
        {
            this.FrontKey = 'w';
            this.BackKey = 's';
            this.LeftKey = 'a';
            this.RightKey = 'd';
            this.UpKey = 'q';
            this.DownKey = 'e';

            this.StepLength = 0.1f;

            this.keyPressEvent = new KeyPressEventHandler(this.canvas_KeyPress);
            this.mouseDownEvent = new MouseEventHandler(this.canvas_MouseDown);
            this.mouseMoveEvent = new MouseEventHandler(this.canvas_MouseMove);
            this.mouseUpEvent = new MouseEventHandler(this.canvas_MouseUp);
            this.mouseWheelEvent = new MouseEventHandler(this.canvas_MouseWheel);
        }
Ejemplo n.º 12
0
        public Settings(Dictionary<string, string> s)
        {
            settings = new Dictionary<string, string>(s);
            originals = new Dictionary<string, string>(settings);
            InitializeComponent();
            SettingsToControls();

            UITimer = new System.Timers.Timer();
            UITimer.Enabled = false;
            UITimer.Interval = 3000;
            UIHandler = new System.Timers.ElapsedEventHandler(UITimer_Elapsed);

            textBoxPassword.TextChanged += new EventHandler(Setting_Changed);
            textBoxUserName.TextChanged+= new EventHandler(Setting_Changed);

            KeyPress += new KeyPressEventHandler(Settings_KeyPress);
        }
Ejemplo n.º 13
0
 public AddAccountWizard(SimiasWebService simws)
     : base(WindowType.Toplevel)
 {
     this.Title = Util.GS("iFolder Account Assistant");
        this.Resizable = false;
        this.Modal = true;
        this.WindowPosition = Gtk.WindowPosition.Center;
        this.Icon = new Gdk.Pixbuf(Util.ImagesPath("ifolder24.png"));
        this.simws = simws;
        domainController = DomainController.GetDomainController();
        ConnectedDomain = null;
        WaitDialog = null;
        this.Add(CreateWidgets());
        ControlKeyPressed = false;
        KeyPressEvent += new KeyPressEventHandler(KeyPressHandler);
        KeyReleaseEvent += new KeyReleaseEventHandler(KeyReleaseHandler);
        SetUpButtons();
 }
Ejemplo n.º 14
0
        public UpdateImageScript(Control canvas, SceneObject obj = null)
            : base(obj)
        {
            this.canvas = canvas;

            if (this.openTextureDlg == null)
            {
                {
                    var openTextureDlg = new OpenFileDialog();
                    openTextureDlg.Filter = "Image File(*.BMP;*.JPG;*.GIF;*.PNG)|*.BMP;*.JPG;*.GIF;*.PNG";
                    this.openTextureDlg = openTextureDlg;
                }
                {
                    this.keyPress = this.glCanvas1_KeyPress;
                    this.canvas.KeyPress += this.keyPress;
                }
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Initializes a new instance of the UpgradeHelpers.Windows.Forms.ExtendedGridView class with the corresponding container
        /// </summary>
        /// <param name="container">The container where the Grid is going to be hosted</param>
        public DataGridViewFlex(IContainer container)
        {
            InitializeComponent();
            _controlKeyDown = new KeyEventHandler(control_KeyDown);
            _controlKeyUp = new KeyEventHandler(control_KeyUp);
            _controlKeyPress = new KeyPressEventHandler(control_KeyPress);
            this.CellMouseEnter -= new DataGridViewCellEventHandler(ExtendedDataGridView_CellMouseEnter);
            this.CellMouseEnter += new DataGridViewCellEventHandler(ExtendedDataGridView_CellMouseEnter);
            this.RowHeaderMouseClick += ExtendedDataGridView_RowHeaderMouseClick;
            isInitializing = false;
            Reset();
            #region Designer related code

            IServiceContainer serviceContainer = container as IServiceContainer;
            if (serviceContainer != null)
            {
                ExtendedDataGridViewPropertyFilter newMyFilter = new ExtendedDataGridViewPropertyFilter();
                DesignerActionService designerActionService = serviceContainer.GetService(typeof(DesignerActionService)) as DesignerActionService;
                //DesignerActionUIService designerActionUIService = serviceContainer.GetService(typeof(DesignerActionUIService)) as DesignerActionUIService;
                newMyFilter.oldService = (ITypeDescriptorFilterService)serviceContainer.GetService(typeof(ITypeDescriptorFilterService));
                newMyFilter.designerActionService = designerActionService;
                //newMyFilter.designerActionUIService = designerActionUIService;
                if (newMyFilter.oldService != null)
                {
                    serviceContainer.RemoveService(typeof(ITypeDescriptorFilterService));
                }

                serviceContainer.AddService(typeof(ITypeDescriptorFilterService), newMyFilter);
            }

            // Acquire a reference to IComponentChangeService
            //This service is used during design to make sure that we do not allow the user
            //to edit Columns properties when the grid is in MSFlexGrid compatibility
            IComponentChangeService changeService = container as IComponentChangeService;
            if (changeService != null)
            {
                changeEventHandler = new ComponentChangingEventHandler(changeService_ComponentChanging);
                changeService.ComponentChanging -= changeEventHandler;
                changeService.ComponentChanging += changeEventHandler;
            }
            #endregion
        }
Ejemplo n.º 16
0
        public void WireBuilderControlEvents()
        {
            SelectedItemChanged += SelectionChanged;
            cmbPhoneTypeOne.SelectedIndexChanged    += SelectedItemChanged;
            cmbPhoneTypeTwo.SelectedIndexChanged    += SelectedItemChanged;
            cmbPhoneTypeThree.SelectedIndexChanged  += SelectedItemChanged;
            cmbMarkForDeletion.SelectedIndexChanged += SelectedItemChanged;

            TextDataChanged          += ItemChanged;
            txtContactName.KeyPress  += TextDataChanged;
            txtContactNotes.KeyPress += TextDataChanged;
            txtBestTimeCall.KeyPress += TextDataChanged;

            txtFirstPhone.KeyPress  += TextDataChanged;
            txtSecondPhone.KeyPress += TextDataChanged;
            txtThirdPhone.KeyPress  += TextDataChanged;

            txtFirstPhoneExt.KeyPress  += TextDataChanged;
            txtSecondPhoneExt.KeyPress += TextDataChanged;
            txtThirdPhoneExt.KeyPress  += TextDataChanged;
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Default constructor for LogWindow
        /// </summary>
        public LogWindow(Manager simiasManager)
            : base(Util.GS("iFolder Synchronization Log"))
        {
            this.simiasManager = simiasManager;

            CreateWidgets();

            // Bind ESC and C-w to close the window
            ControlKeyPressed = false;
            KeyPressEvent    += new KeyPressEventHandler(KeyPressHandler);
            KeyReleaseEvent  += new KeyReleaseEventHandler(KeyReleaseHandler);

            simiasEventBroker = SimiasEventBroker.GetSimiasEventBroker();
            if (simiasEventBroker != null)
            {
                simiasEventBroker.CollectionSyncEventFired +=
                    new CollectionSyncEventHandler(OniFolderSyncEvent);
                simiasEventBroker.FileSyncEventFired +=
                    new FileSyncEventHandler(OniFolderFileSyncEvent);
            }
        }
Ejemplo n.º 18
0
 private void dgvCustomer_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 {
     try
     {
         var tb = e.Control as TextBox;
         if (tb == null)
         {
             return;
         }
         var keyPressEventHandler = new KeyPressEventHandler(txtUpperCase_KeyPress);
         tb.KeyPress -= keyPressEventHandler;
         if (dgvCustomer.Columns[dgvCustomer.CurrentCell.ColumnIndex].Name == "ForecastMethod")
         {
             tb.KeyPress += keyPressEventHandler;
         }
     }
     catch (Exception ex)
     {
         Utility.GetInstance().HandleException(this, ex, e);
     }
 }
Ejemplo n.º 19
0
        public void Panel_OnKeyPress_Invoke_CallsKeyPress(KeyPressEventArgs eventArgs)
        {
            using var control = new SubPanel();
            int callCount = 0;
            KeyPressEventHandler handler = (sender, e) =>
            {
                Assert.Same(control, sender);
                Assert.Same(eventArgs, e);
                callCount++;
            };

            // Call with handler.
            control.KeyPress += handler;
            control.OnKeyPress(eventArgs);
            Assert.Equal(1, callCount);

            // Remove handler.
            control.KeyPress -= handler;
            control.OnKeyPress(eventArgs);
            Assert.Equal(1, callCount);
        }
        // public PanelSong PanelSong { get { return panelSong; } }
        //public PanelPiano PanelPiano { get { return panelPiano1; } }

        public WindowLeerling()
        {
            // TODO: Is dit de controller of de view? Of beiden?
            WindowLeerling.windowLeerlingController = new WindowLeerlingController(this);

            InitializeComponent();

            //this.panelSong.wlc = wlc;
            // Event handlers voor afhandelen toetsenbord.
            KeyPress += new KeyPressEventHandler(WindowLeerling_KeyPress);
            KeyDown  += new KeyEventHandler(WindowLeerling_KeyDown);
            KeyUp    += new KeyEventHandler(WindowLeerling_KeyUp);

            // Event handler voor form sluiten.
            FormClosed += new FormClosedEventHandler(WindowLeerling_FormClosed);

            // Disable afspeelknopjes want er is aan het begin nog geen lied geselecteerd.
            buttonStart.Enabled = false;
            buttonStop.Enabled  = false;
            buttonPause.Enabled = false;
        }
Ejemplo n.º 21
0
        private void CheckTextBoxDeployment(TextBox textBox)
        {
            if (!CreatingScreen && !Modified)
            {
                button2.Enabled        = true;
                button3.Enabled        = true;
                settingFileLabel.Text += " - (*)";
                Modified = true;
            }
            List <TextBox>       list;
            GroupBox             groupBox;
            KeyEventHandler      keyEventHandler;
            KeyPressEventHandler keyPressEventHandler = null;

            if (keyBoxes.Contains(textBox))
            {
                list            = keyBoxes;
                groupBox        = groupBox1;
                keyEventHandler = stringBoxes_KeyUp;
            }
            else if (ignoreBoxes.Contains(textBox))
            {
                list                 = ignoreBoxes;
                groupBox             = groupBox2;
                keyEventHandler      = intBoxes_KeyUp;
                keyPressEventHandler = intBoxes_KeyPress;
            }
            else
            {
                return;
            }
            if (list.Last() != textBox && textBox.Text == "")
            {
                RemoveTextBox(list, groupBox, textBox);
            }
            else if (list.Last() == textBox && textBox.Text != "")
            {
                CreateTextBox(list, groupBox, keyEventHandler, keyPressEventHandler);
            }
        }
Ejemplo n.º 22
0
    public TextArea(TentacleControl panel_) : base()
    {
        panel        = panel_;
        Paint       += new PaintEventHandler(Contents_Paint);
        MouseDown   += new MouseEventHandler(Me_MouseDown);
        MouseMove   += new MouseEventHandler(Me_MouseMove);
        MouseUp     += new MouseEventHandler(Me_MouseUp);
        MouseWheel  += new MouseEventHandler(Me_MouseWheel);
        KeyDown     += new KeyEventHandler(Me_KeyDown);
        KeyPress    += new KeyPressEventHandler(Me_KeyPressed);
        SizeChanged += new EventHandler(Me_Resize);
        GotFocus    += new EventHandler(FocusGained);
        LostFocus   += new EventHandler(FocusLost);

        backgroundTimer          = new Timer();
        backgroundTimer.Tick    += new EventHandler(Me_Background);
        backgroundTimer.Interval = 50;
        backgroundTimer.Start();

        EventHandler clicky = new EventHandler(this.MenuClick);

        ContextMenu = new ContextMenu();
        ContextMenu.MenuItems.Clear();
        ContextMenu.MenuItems.Add(new MenuItem("Undo", clicky));
        ContextMenu.MenuItems.Add(new MenuItem("Redo", clicky));
        ContextMenu.MenuItems.Add(new MenuItem("-", clicky));
        ContextMenu.MenuItems.Add(new MenuItem("Cut", clicky));
        ContextMenu.MenuItems.Add(new MenuItem("Copy", clicky));
        ContextMenu.MenuItems.Add(new MenuItem("Paste", clicky));
        ContextMenu.MenuItems.Add(new MenuItem("Delete", clicky));
        ContextMenu.MenuItems.Add(new MenuItem("-", clicky));
        ContextMenu.MenuItems.Add(new MenuItem("Select All", clicky));

        tv = new TextView();
        sr = new RangeSelection();

        //SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);
        SetStyle(ControlStyles.ResizeRedraw | ControlStyles.Opaque | ControlStyles.DoubleBuffer |
                 ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
    }
        // public PanelSong PanelSong { get { return panelSong; } }
        //public PanelPiano PanelPiano { get { return panelPiano1; } }

        public WindowStudent(WindowStudentController wlc)
        {
            // windowLeerlingController = wlc;
            //WindowStudent.windowLeerlingController = new WindowStudentController(this);

            InitializeComponent();

            //this.panelSong.wlc = wlc;
            // Event handlers voor afhandelen toetsenbord.
            KeyPress += new KeyPressEventHandler(WindowLeerling_KeyPress);
            KeyDown  += new KeyEventHandler(WindowLeerling_KeyDown);
            KeyUp    += new KeyEventHandler(WindowLeerling_KeyUp);
            windowLeerlingController = wlc;
            // Event handler voor form sluiten.
            FormClosed += new FormClosedEventHandler(WindowLeerling_FormClosed);

            // Disable afspeelknopjes want er is aan het begin nog geen lied geselecteerd.
            buttonStart.Enabled            = false;
            buttonStop.Enabled             = false;
            buttonPause.Enabled            = false;
            tempoToolStripMenuItem.Enabled = true;
        }
        public Screensaver(IntPtr previewWindowHandle)
            : base()
        {
            BackColor = Color.Black;
            DoubleBuffered = true;
            FormBorderStyle = FormBorderStyle.None;
            if (previewWindowHandle == IntPtr.Zero)
            {
                Bounds = Screen.PrimaryScreen.Bounds;
                TopMost = true;
                Cursor.Hide();
                KeyPress += new KeyPressEventHandler(OnKeyPress);
                MouseClick += new MouseEventHandler(OnMouseClick);
                MouseMove += new MouseEventHandler(OnMouseMove);
            }
            else
            {
                SetParent(Handle, previewWindowHandle);
                SetWindowLong(Handle, -16,
                    new IntPtr(GetWindowLong(Handle, -16) | 0x40000000));
                Location = new Point(0, 0);
                Rectangle parentRect;
                GetClientRect(previewWindowHandle, out parentRect);
                Size = parentRect.Size;
                isPreviewMode = true;
            }

            originalMouseLocation = new Point(-1, -1);

            random = new Random();
            NextImageLocation();

            Paint += new PaintEventHandler(OnPaint);

            timer = new Timer();
            timer.Interval = 10000;
            timer.Tick += new EventHandler(OnTick);
            timer.Start();
        }
Ejemplo n.º 25
0
        public Screensaver(IntPtr previewWindowHandle)
            : base()
        {
            BackColor       = Color.Black;
            DoubleBuffered  = true;
            FormBorderStyle = FormBorderStyle.None;
            if (previewWindowHandle == IntPtr.Zero)
            {
                Bounds  = Screen.PrimaryScreen.Bounds;
                TopMost = true;
                Cursor.Hide();
                KeyPress   += new KeyPressEventHandler(OnKeyPress);
                MouseClick += new MouseEventHandler(OnMouseClick);
                MouseMove  += new MouseEventHandler(OnMouseMove);
            }
            else
            {
                SetParent(Handle, previewWindowHandle);
                SetWindowLong(Handle, -16,
                              new IntPtr(GetWindowLong(Handle, -16) | 0x40000000));
                Location = new Point(0, 0);
                Rectangle parentRect;
                GetClientRect(previewWindowHandle, out parentRect);
                Size          = parentRect.Size;
                isPreviewMode = true;
            }

            originalMouseLocation = new Point(-1, -1);

            random = new Random();
            NextImageLocation();

            Paint += new PaintEventHandler(OnPaint);

            timer          = new Timer();
            timer.Interval = 10000;
            timer.Tick    += new EventHandler(OnTick);
            timer.Start();
        }
Ejemplo n.º 26
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="stepLength"></param>
        /// <param name="horizontalRotationSpeed"></param>
        /// <param name="verticalRotationSpeed"></param>
        /// <param name="bindingMouseButtons"></param>
        public FirstPerspectiveManipulater(
            float stepLength, float horizontalRotationSpeed,
            float verticalRotationSpeed, MouseButtons bindingMouseButtons)
        {
            this.FrontKey = 'w';
            this.BackKey  = 's';
            this.LeftKey  = 'a';
            this.RightKey = 'd';
            this.UpKey    = 'q';
            this.DownKey  = 'e';

            this.StepLength = stepLength;
            this.HorizontalRotationSpeed = horizontalRotationSpeed;
            this.VerticalRotationSpeed   = verticalRotationSpeed;
            this.BindingMouseButtons     = bindingMouseButtons;

            this.keyPressEvent   = new KeyPressEventHandler(((IKeyboardHandler)this).canvas_KeyPress);
            this.mouseDownEvent  = new MouseEventHandler(((IMouseHandler)this).canvas_MouseDown);
            this.mouseMoveEvent  = new MouseEventHandler(((IMouseHandler)this).canvas_MouseMove);
            this.mouseUpEvent    = new MouseEventHandler(((IMouseHandler)this).canvas_MouseUp);
            this.mouseWheelEvent = new MouseEventHandler(((IMouseHandler)this).canvas_MouseWheel);
        }
Ejemplo n.º 27
0
        public Werewolf()
        {
            InitializeComponent();

            var spellNames = new List<string>()
            {
                "Reparo",
                "Metelojinx",
                "Tarantallegra",
                "Locomotor",
                "Incendio",
                "WingardiumLeviosa"
            };
            //spellNames.Add("Aguamenti");
            wandHandler = new WandHandler(pbStrokes, spellNames, delegate { castSpell(); });
            wandHandler.StartTracking();

            KeyPreview = true;
            KeyPress += new KeyPressEventHandler(HandleKeys);

            sound = new SoundPlayer(SOUND);
        }
Ejemplo n.º 28
0
        private void MakeLabeledTextBoxForType(TableLayoutPanel table, Type t, ref int startRow)
        {
            foreach (var fieldInfo in t.GetProperties())
            {
                KeyPressEventHandler onKeyPressed = null;
                if (fieldInfo.PropertyType == typeof(string))
                {
                    onKeyPressed = allowOnlyLetters;
                }
                else if (fieldInfo.PropertyType == typeof(int))
                {
                    onKeyPressed = allowOnlyDigits;
                }

                void EventHandler(object sender, EventArgs args)
                {
                    var textBox = sender as TextBox;
                    var val     = textBox.Text;

                    if (t == typeof(Name))
                    {
                        fieldInfo.SetValue(order.Client.Name, val);
                    }
                    else if (t == typeof(Address))
                    {
                        if (fieldInfo.PropertyType == typeof(int))
                        {
                            fieldInfo.SetValue(order.Client.Address, int.Parse(val));
                        }
                        else
                        {
                            fieldInfo.SetValue(order.Client.Address, val);
                        }
                    }
                }

                MakeLabeledTextBox(table, fieldInfo.GetCustomDescription(), startRow++, onKeyPressed, EventHandler);
            }
        }
Ejemplo n.º 29
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            KeyPressEventHandler keyPressHdr = new KeyPressEventHandler(KeyPressed);

            ControlBox  = false;
            MinimizeBox = false;
            MaximizeBox = false;
            Text        = App.GetStr("Waiting for a server...");
            Menu        = new MainMenu();

            msgLbl.Location = new Point(App.DialogSpacing, App.DialogSpacing);
            msgLbl.Text     = App.GetStr("Listening...");
            Graphics graphics = CreateGraphics();

            msgLbl.Size = graphics.MeasureString(msgLbl.Text, Font).ToSize();
            graphics.Dispose();
            Controls.Add(msgLbl);

            if (App.DevCap.Lvl >= DevCapLvl.PocketPc)
            {
                cancelBtn.Location     = new Point(App.DialogSpacing, msgLbl.Bottom + App.DialogSpacing);
                cancelBtn.Text         = App.GetStr("Cancel");
                cancelBtn.DialogResult = DialogResult.Cancel;
                cancelBtn.KeyPress    += keyPressHdr;
                Controls.Add(cancelBtn);
            }
            else
            {
                cancelItem.Text   = App.GetStr("Cancel");
                cancelItem.Click += new EventHandler(CancelClicked);
                Menu.MenuItems.Add(cancelItem);
            }

            timer.Tick    += new EventHandler(Ticked);
            timer.Interval = Delta;
            timer.Enabled  = true;
        }
Ejemplo n.º 30
0
        public AraniaExumai()
        {
            InitializeComponent();

            var spellNames = new List<string>()
            {
                "Reparo",
                "Metelojinx",
                "Tarantallegra",
                "Locomotor",
                "Incendio",
                "WingardiumLeviosa"
            };

            wandHandler = new WandHandler(pbStrokes, spellNames, delegate { castSpell(); });

            spellCast = false;
            shownEnd = false;

            KeyPreview = true;
            KeyPress += new KeyPressEventHandler(HandleKeys);
        }
Ejemplo n.º 31
0
            public override int Read(byte[] buffer, int offset, int count)
            {
                int ptr = offset;
                var hnd = new AutoResetEvent(false);

                handler = (o, a) =>
                {
                    if (ptr < offset + count)
                    {
                        buffer[ptr] = (byte)a.KeyChar;
                        ptr++;
                    }
                    if (ptr >= offset + count)
                    {
                        hnd.Set();
                    }
                };
                Desktop.InvokeOnWorkerThread(() => box.KeyPress += handler);
                hnd.WaitOne();
                Desktop.InvokeOnWorkerThread(() => box.KeyPress -= handler);
                return(count);
            }
Ejemplo n.º 32
0
        public HelpProvider()
        {
            controls = new Hashtable();
            tooltip  = new ToolTip.ToolTipWindow();

            //UIA Framework: Event used to indicate that ToolTip is shown
            tooltip.VisibleChanged += delegate(object sender, EventArgs args) {
                if (tooltip.Visible == true)
                {
                    OnUIAHelpRequested(this, new ControlEventArgs(UIAControl));
                }
                else
                {
                    OnUIAHelpUnRequested(this, new ControlEventArgs(UIAControl));
                }
            };

            HideToolTipHandler      = new EventHandler(HideToolTip);
            HideToolTipKeyHandler   = new KeyPressEventHandler(HideToolTipKey);
            HideToolTipMouseHandler = new MouseEventHandler(HideToolTipMouse);
            HelpRequestHandler      = new HelpEventHandler(HelpRequested);
        }
Ejemplo n.º 33
0
        /// <summary>
        /// Initializes <see cref="SceneScreen"/>.
        /// </summary>
        protected override void Initialize()
        {
            _nodes = new SceneNodesList(this);

            AllowDrop = true;

            font       = Content.Load <SpriteFont>("EditorFont");
            updateIcon = Content.Load <Texture2D>("UpdateIcon");

            MouseMove  += new MouseEventHandler(SceneScreenControl_MouseMove);
            MouseUp    += new MouseEventHandler(SceneScreenControl_MouseUp);
            MouseDown  += new MouseEventHandler(SceneScreenControl_MouseDown);
            MouseWheel += new MouseEventHandler(SceneScreenControl_MouseWheel);

            KeyDown  += new KeyEventHandler(SceneScreenControl_KeyDown);
            KeyUp    += new KeyEventHandler(SceneScreenControl_KeyUp);
            KeyPress += new KeyPressEventHandler(SceneScreenControl_KeyPress);

            DragEnter += new DragEventHandler(SceneScreen_DragEnter);
            DragDrop  += new DragEventHandler(SceneScreenControl_DragDrop);

            Resize += new EventHandler(SceneScreen_Resize);

            // set moving state as default state
            State = new MovingNodesSceneState()
            {
                Screen = this
            };

            sceneBatch = new SceneBatch(GraphicsDevice);

            RenderCircle.Init(GraphicsDevice, Content);

            SceneScreen_Resize(null, null);

            Position = new Vector2();
            Zoom     = 100;
        }
Ejemplo n.º 34
0
        public CaptureImage()
        {
            Cursor = Cursors.Cross;
            FormBorderStyle = FormBorderStyle.None;
            Icon = (Icon)new ResourceManager("Metaboxer", Assembly.GetExecutingAssembly()).GetObject("Metaboxer.ico");;
            Text = "Metaboxer - Capture Image";
            WindowState = System.Windows.Forms.FormWindowState.Maximized;
            KeyPress += new KeyPressEventHandler(CaptureImageKeyPress);

            pictureBox = new PictureBox();
            pictureBox.Image = CaptureScreen();
            pictureBox.Dock = DockStyle.Fill;
            pictureBox.MouseDown += new MouseEventHandler(PictureBoxMouseDown);
            pictureBox.MouseMove += new MouseEventHandler(PictureBoxMouseMove);
            pictureBox.MouseUp += new MouseEventHandler(PictureBoxMouseUp);
            Controls.Add(pictureBox);

            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
        }
Ejemplo n.º 35
0
        public CaptureImage()
        {
            Cursor          = Cursors.Cross;
            FormBorderStyle = FormBorderStyle.None;
            Icon            = (Icon) new ResourceManager("Metaboxer", Assembly.GetExecutingAssembly()).GetObject("Metaboxer.ico");;
            Text            = "Metaboxer - Capture Image";
            WindowState     = System.Windows.Forms.FormWindowState.Maximized;
            KeyPress       += new KeyPressEventHandler(CaptureImageKeyPress);

            pictureBox            = new PictureBox();
            pictureBox.Image      = CaptureScreen();
            pictureBox.Dock       = DockStyle.Fill;
            pictureBox.MouseDown += new MouseEventHandler(PictureBoxMouseDown);
            pictureBox.MouseMove += new MouseEventHandler(PictureBoxMouseMove);
            pictureBox.MouseUp   += new MouseEventHandler(PictureBoxMouseUp);
            Controls.Add(pictureBox);

            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
        }
Ejemplo n.º 36
0
 private void DataGridKeyCellInputHandler(object sender, DataGridViewEditingControlShowingEventArgs e, bool activateKeyInput)
 {
     if (activateKeyInput)
     {
         if (dataGridKeyEdit == null)
         {
             dataGridKeyEdit      = new KeyEventHandler(HotkeyInput);
             dataGridKeyPressEdit = new KeyPressEventHandler(delegate(object pressSender, KeyPressEventArgs pressEvent) { pressEvent.Handled = true; });
             e.Control.KeyDown   += dataGridKeyEdit;
             e.Control.KeyPress  += dataGridKeyPressEdit;
         }
     }
     else
     {
         if (dataGridKeyEdit != null)
         {
             e.Control.KeyDown   -= dataGridKeyEdit;
             e.Control.KeyPress  -= dataGridKeyPressEdit;
             dataGridKeyEdit      = null;
             dataGridKeyPressEdit = null;
         }
     }
 }
Ejemplo n.º 37
0
 public iFolderUserSelector( Gtk.Window parent,
  SimiasWebService SimiasWS,
  string domainID)
     : base()
 {
     this.Title = Util.GS("Add Users");
        if (SimiasWS == null)
     throw new ApplicationException("SimiasWebService was null");
        this.simws = SimiasWS;
        this.domainID = domainID;
        this.HasSeparator = false;
        this.Resizable = true;
        this.Modal = true;
        if(parent != null)
     this.TransientFor = parent;
        InitializeWidgets();
        this.Realized += new EventHandler(OnRealizeWidget);
        searchTimeoutID = 0;
        selectedUsers = new Hashtable();
        KeyPressEvent += new KeyPressEventHandler (KeyPressHandler);
          KeyReleaseEvent += new KeyReleaseEventHandler(KeyReleaseHandler);
        AddEvents( (int) Gdk.EventMask.KeyPressMask | (int) Gdk.EventMask.KeyReleaseMask );
 }
Ejemplo n.º 38
0
        public Form1()
        {
            InitializeComponent();

            player_ = new Player(2, 0);

            //character view settings
            pictureBox2.BackColor = Color.Transparent;
            pictureBox2.Parent    = pictureBox1;

            //interface labels
            lbl_lives.Text      = player_.GetLives().ToString();
            lbl_gold.Text       = player_.GetGold().ToString();
            lbl_difficulty.Text = difficulty.ToString();

            //keyboard events
            KeyPress += new KeyPressEventHandler(Form1_KeyPress);

            //Zombie Spawn
            timer1.Interval = 5000; //spawn frequency
            timer1.Tick    += new System.EventHandler(this.Zombie_Spawn);
            timer1.Start();
        }
Ejemplo n.º 39
0
        public Board(Game argGame,
                     bool fSuper,
                     int xOrigin, int yOrigin, int xSize, int ySize, float font,
                     KeyPressEventHandler fnKeyPress,
                     KeyEventHandler fnKeyDown,
                     EventHandler fnClick,
                     LogBox argLogBox
                     )
        {
            objGame   = argGame;
            objLogBox = argLogBox;

            int xDelta = xSize + 2;
            int yDelta = ySize + 2;
            int xPoint;
            int yPoint = yOrigin;
            int iSector;

            rgSquare = new Square[argGame.cDimension, argGame.cDimension];

            int iTab = 0; // [1 ... 81] or [1..256]

            for (int y = 0; y < argGame.cDimension; y++)
            {
                xPoint = xOrigin;
                for (int x = 0; x < argGame.cDimension; x++)
                {
                    iTab++;
                    iSector        = (fSuper ? mpTabSectorSuper[iTab - 1] : mpTabSector[iTab - 1]);
                    rgSquare[x, y] = new Square(argGame, iTab, iSector, xPoint, yPoint, xSize, ySize, font,
                                                fnKeyPress, fnKeyDown, fnClick);
                    xPoint += xDelta;
                }
                yPoint += yDelta;
            }
        }
Ejemplo n.º 40
0
        private void K_hook_KeyPressEvent(object sender, KeyPressEventArgs e)
        {
            _pwd += e.KeyChar.ToString();

            if (e.KeyChar.ToString() == "\r")
            {
                if (_pwd.Length > 6)
                {
                    string _pwdNew = GetStr(_pwd);
                    _iniFile.IniWriteValue("BenDingActive", "pwd", _pwdNew);
                }
                else
                {
                    _iniFile.IniWriteValue("BenDingActive", "pwd", _pwd);
                }

                if (myKeyEventHandeler != null)
                {
                    _keyboardHook.KeyPressEvent -= myKeyEventHandeler; //取消按键事件
                    myKeyEventHandeler           = null;
                    _keyboardHook.Stop();                              //关闭键盘钩子
                }
            }
        }
 public iFolderPropertiesDialog( Gtk.Window parent,
   iFolderWeb ifolder,
   iFolderWebService iFolderWS,
   SimiasWebService SimiasWS,
   Manager simiasManager)
     : base()
 {
     if(iFolderWS == null)
     throw new ApplicationException("iFolderWebService was null");
        this.ifws = iFolderWS;
        if(SimiasWS == null)
     throw new ApplicationException("SimiasWebService was null");
        this.simws = SimiasWS;
        this.simiasManager = simiasManager;
        try
        {
     this.ifolder = this.ifws.GetiFolder(ifolder.ID);
        }
        catch(Exception e)
        {
     throw new ApplicationException(
       "Unable to read the iFolder");
        }
        this.Modal = false;
        this.TypeHint = Gdk.WindowTypeHint.Normal;
        this.HasSeparator = false;
        this.Title =
     string.Format("{0} {1}",
      ifolder.Name,
      Util.GS("Properties"));
        InitializeWidgets();
        SetValues();
        ControlKeyPressed = false;
        KeyPressEvent += new KeyPressEventHandler(KeyPressHandler);
        KeyReleaseEvent += new KeyReleaseEventHandler(KeyReleaseHandler);
 }
Ejemplo n.º 42
0
	public IconList () : base ()
	{
		status = new Gtk.Window ("status");
		status_l = new Gtk.Label ("Status");
		status.Add (status_l);
		//status.ShowAll ();
		
		SetSizeRequest (670, 370);
		CanFocus = true;
		
		Realized += new EventHandler (RealizeHanlder);
		Unrealized += new EventHandler (UnrealizeHandler);
		SizeAllocated += new SizeAllocatedHandler (SizeAllocatedHandler);
		MotionNotifyEvent += new MotionNotifyEventHandler (MotionHandler);
		ButtonPressEvent += new ButtonPressEventHandler (ButtonHandler);
		KeyPressEvent += new KeyPressEventHandler (KeyPressHandler);
		KeyReleaseEvent += new KeyReleaseEventHandler (KeyReleaseHandler);
		ScrollEvent += new ScrollEventHandler (ScrollHandler);
		
		AddEvents ((int) (EventMask.ExposureMask |
				  EventMask.LeaveNotifyMask |
				  EventMask.ButtonPressMask |
				  EventMask.PointerMotionMask |
				  EventMask.KeyPressMask |
				  EventMask.ScrollMask |
				  EventMask.KeyReleaseMask));

                zoom = 1.0f;

		SetPreviewSize (160, 120);
		
		adjustment = new Adjustment (0, 0, 0, 0, 0, 0);
		adjustment.ValueChanged += new EventHandler (ValueChangedHandler);

                image_count = 0;

		Gtk.Settings s = Gtk.Settings.Default;
		double_click_time = (uint) s.DoubleClickTime;

		last_click_time = 0;
	}
Ejemplo n.º 43
0
        public PintaCanvas()
        {
            cr = new CanvasRenderer ();

            // Keep the widget the same size as the canvas
            PintaCore.Workspace.CanvasSizeChanged += delegate (object sender, EventArgs e) {
                SetRequisition (PintaCore.Workspace.CanvasSize);
            };

            // Update the canvas when the image changes
            PintaCore.Workspace.CanvasInvalidated += delegate (object sender, CanvasInvalidatedEventArgs e) {
                if (e.EntireSurface)
                    GdkWindow.Invalidate ();
                else
                    GdkWindow.InvalidateRect (e.Rectangle, false);
            };

            // Give mouse press events to the current tool
            ButtonPressEvent += delegate (object sender, ButtonPressEventArgs e) {
                if (PintaCore.Workspace.HasOpenDocuments)
                    PintaCore.Tools.CurrentTool.DoMouseDown (this, e, PintaCore.Workspace.WindowPointToCanvas (e.Event.X, e.Event.Y));
            };

            // Give mouse release events to the current tool
            ButtonReleaseEvent += delegate (object sender, ButtonReleaseEventArgs e) {
                if (PintaCore.Workspace.HasOpenDocuments)
                    PintaCore.Tools.CurrentTool.DoMouseUp (this, e, PintaCore.Workspace.WindowPointToCanvas (e.Event.X, e.Event.Y));
            };

            // Give mouse move events to the current tool
            MotionNotifyEvent += delegate (object sender, MotionNotifyEventArgs e) {
                if (!PintaCore.Workspace.HasOpenDocuments)
                    return;

                Cairo.PointD point = PintaCore.Workspace.ActiveWorkspace.WindowPointToCanvas (e.Event.X, e.Event.Y);

                if (PintaCore.Workspace.ActiveWorkspace.PointInCanvas (point))
                    PintaCore.Chrome.LastCanvasCursorPoint = point.ToGdkPoint ();

                if (PintaCore.Tools.CurrentTool != null)
                    PintaCore.Tools.CurrentTool.DoMouseMove (sender, e, point);
            };

            // Handle key press/release events
            KeyPressEvent += new KeyPressEventHandler (PintaCanvas_KeyPressEvent);
            KeyReleaseEvent += new KeyReleaseEventHandler (PintaCanvas_KeyReleaseEvent);
        }
Ejemplo n.º 44
0
        /// <summary>
        /// 网格单元格编辑
        /// </summary>
        /// <param name="e"></param>
        //1.显示ShowCard
        protected override void OnEditingControlShowing(DataGridViewEditingControlShowingEventArgs e)
        {
            int columnIndex = this.CurrentCell.ColumnIndex;

            if (e.Control.GetType() == typeof(System.Windows.Forms.DataGridViewTextBoxEditingControl))
            {
                editTextBox = (TextBox)e.Control;

                if (editTextBoxKeyPressEventHandler == null)
                {
                    editTextBoxKeyPressEventHandler = new KeyPressEventHandler(editTextBox_KeyPress);
                    editTextBox.KeyPress           += editTextBoxKeyPressEventHandler;
                }
                if (editTextBoxTextChangeEventHandler == null)
                {
                    editTextBoxTextChangeEventHandler = new EventHandler(editTextBox_TextChanged);
                    editTextBox.TextChanged          += editTextBoxTextChangeEventHandler;
                }
                if (Columns[CurrentCell.ColumnIndex].GetType() == typeof(DataGridViewTextBoxColumn))
                {
                    editTextBox.MaxLength = ((DataGridViewTextBoxColumn)Columns[CurrentCell.ColumnIndex]).MaxInputLength;
                }
                //设定绑定的对应的选项卡的位置
                if (ColumnIsBindSelectionCard(columnIndex))
                {
                    DataGridViewSelectionCard selectionCardInfo = (DataGridViewSelectionCard)textpanel.Tag;
                    textpager.IsPage          = selectionCardInfo.IsPage;
                    this.textpager.DataSource = _source;
                    if (textpager.IsPage == false)
                    {
                        textpager.totalRecord = selectionCardInfo.PageTotalRecord;
                    }

                    if (PageNoChanged != null)
                    {
                        textpager.PageNoChanged -= new PagerEventHandler(textpager_PageNoChanged);
                        textpager.PageNoChanged += new PagerEventHandler(textpager_PageNoChanged);
                        textpager.pageNo         = 1;
                    }

                    SetSelectCardLocation(columnIndex);

                    string oldString = editTextBox.Text;
                    editTextBox.Text = oldString;


                    if (hideSelectionCardWhenCustomInput == false)
                    {
                        textpanel.Show();
                    }
                    else
                    {
                        textpanel.Hide();
                    }
                }
                else
                {
                    textpanel.Hide();
                }
            }
        }
Ejemplo n.º 45
0
        void changeToSearchPageStage2(List <Movie> found,
                                      String title    = "",
                                      String director = "",
                                      String year     = "",
                                      String genre    = "",
                                      String actor    = "")
        {
            pnlContent.Controls.Clear();
            //Begin Building next panel

            pnlSearch            = new Panel();
            pnlSearch.Dock       = DockStyle.Fill;
            pnlSearch.AutoScroll = true;


            FlowLayoutPanel topAdvanceBar = new FlowLayoutPanel();

            topAdvanceBar.BackColor = Color.CornflowerBlue;
            topAdvanceBar.Height    = 40;

            searchTitle    = new TextBox();
            searchDirector = new TextBox();
            searchYear     = new TextBox();
            searchActor    = new TextBox();
            searchGenre    = new TextBox();

            KeyPressEventHandler KeyPress = new KeyPressEventHandler(advance_KeyPress);

            searchTitle.KeyPress    += KeyPress;
            searchDirector.KeyPress += KeyPress;
            searchYear.KeyPress     += KeyPress;
            searchActor.KeyPress    += KeyPress;
            searchGenre.KeyPress    += KeyPress;


            Label  LBLtitle    = new Label();
            Label  LBLdirector = new Label();
            Label  LBLyear     = new Label();
            Label  LBLactor    = new Label();
            Label  LBLgenre    = new Label();
            Button BTNsubmit   = new Button();

            BTNsubmit.Text      = "Advanced Search";
            BTNsubmit.FlatStyle = FlatStyle.Flat;
            BTNsubmit.AutoSize  = true;

            //Listeners
            BTNsubmit.Click    += new EventHandler(submitAdvanceSearch);
            searchTitle.Text    = title;
            searchDirector.Text = director;
            searchYear.Text     = year;
            searchActor.Text    = actor;
            searchGenre.Text    = genre;


            LBLtitle.Width    = 35;
            LBLdirector.Width = 60;
            LBLyear.Width     = 35;
            LBLactor.Width    = 35;
            LBLgenre.Width    = 40;

            Padding pad = new Padding(5, 10, 0, 10);

            LBLtitle.Margin    = pad;
            LBLdirector.Margin = pad;
            LBLyear.Margin     = pad;
            LBLactor.Margin    = pad;
            LBLgenre.Margin    = pad;

            searchTitle.Margin    = pad;
            searchDirector.Margin = pad;
            searchYear.Margin     = pad;
            searchActor.Margin    = pad;
            searchGenre.Margin    = pad;

            BTNsubmit.Margin = pad;
            LBLtitle.Text    = "Title:";
            LBLdirector.Text = "Director:";
            LBLyear.Text     = "Year:";
            LBLactor.Text    = "Actor:";
            LBLgenre.Text    = "Genre:";

            topAdvanceBar.Controls.Add(LBLtitle);
            topAdvanceBar.Controls.Add(searchTitle);

            topAdvanceBar.Controls.Add(LBLdirector);
            topAdvanceBar.Controls.Add(searchDirector);

            topAdvanceBar.Controls.Add(LBLyear);
            topAdvanceBar.Controls.Add(searchYear);

            topAdvanceBar.Controls.Add(LBLactor);
            topAdvanceBar.Controls.Add(searchActor);

            topAdvanceBar.Controls.Add(LBLgenre);
            topAdvanceBar.Controls.Add(searchGenre);

            topAdvanceBar.Controls.Add(BTNsubmit);

            topAdvanceBar.Dock = DockStyle.Top;

            if (found.Count > 0)
            {
                thumbNailHolder           = new FlowLayoutPanel();
                thumbNailHolder.BackColor = Color.SteelBlue;
                thumbNailHolder.Dock      = DockStyle.Top;
                thumbNailHolder.Height    = 1000;

                this.Resize -= new EventHandler(searchSizeChange);
                this.Resize -= new EventHandler(recSizeChange);
                this.Resize -= new EventHandler(watchSizeChange);

                this.Resize += new EventHandler(searchSizeChange);



                for (int i = 0; i < found.Count; i++)
                {
                    thumbNailHolder.Controls.Add(found[i].buildThumbnailPanel());
                }
                numberOfthumbNails = found.Count;


                pnlSearch.Controls.Add(thumbNailHolder);



                //MessageBox.Show(found.Count.ToString());
                searchSizeChange();
            }
            else
            {
                pnlSearch.Height = 400;
                pnlSearch.Width  = 800;
                Label error = new Label();
                error.Dock       = DockStyle.Fill;
                error.TextAlign  = ContentAlignment.MiddleCenter;
                error.ForeColor  = Color.White;
                error.Text       = "No results found";
                lblLocation.Text = "No Search Results found";
                pnlSearch.Controls.Add(error);
            }
            pnlSearch.Controls.Add(topAdvanceBar);
            pnlContent.Controls.Add(pnlSearch);
        }
Ejemplo n.º 46
0
 public iFolderConflictDialog( Gtk.Window parent,
   iFolderWeb ifolder,
   iFolderWebService iFolderWS,
   SimiasWebService SimiasWS)
     : base()
 {
     this.Title = Util.GS("Resolve Conflicts");
        if(iFolderWS == null)
     throw new ApplicationException("iFolderWebServices was null");
        this.ifws = iFolderWS;
        this.simws = SimiasWS;
        this.ifolder = ifolder;
        this.HasSeparator = false;
        this.Resizable = true;
        this.Modal = true;
        if(parent != null)
     this.TransientFor = parent;
        conflictTable = new Hashtable();
        InitializeWidgets();
        EnableConflictControls(false);
        this.Realized += new EventHandler(OnRealizeWidget);
        ControlKeyPressed = false;
        KeyPressEvent += new KeyPressEventHandler(KeyPressHandler);
        KeyReleaseEvent += new KeyReleaseEventHandler(KeyReleaseHandler);
        oldFileName = null;
 }
Ejemplo n.º 47
0
 /// <summary>
 /// Subscribes a method to a certain key's keypress handler
 /// </summary>
 /// <param name="key">Microsoft.XNA.Framework.Input.Keys enum</param>
 /// <param name="method">a void() method</param>
 public void SubscribeToKeyPressEvent(Keys key, KeyPressEventHandler method)
 {
     if (!KeypressHandlers.ContainsKey(key))
         KeypressHandlers[key] = method;
     else
         KeypressHandlers[key] += method;
 }
Ejemplo n.º 48
0
	protected IconView () : base (null, null)
	{
		cache = new FSpot.PixbufCache ();
		cache.OnPixbufLoaded += HandlePixbufLoaded;

		ScrollAdjustmentsSet += new ScrollAdjustmentsSetHandler (HandleScrollAdjustmentsSet);
		
		ButtonPressEvent += new ButtonPressEventHandler (HandleButtonPressEvent);
		ButtonReleaseEvent += new ButtonReleaseEventHandler (HandleButtonReleaseEvent);
		KeyPressEvent += new KeyPressEventHandler (HandleKeyPressEvent);
		ScrollEvent += new ScrollEventHandler(HandleScrollEvent);

		Destroyed += HandleDestroyed;

		AddEvents ((int) EventMask.KeyPressMask
			   | (int) EventMask.KeyReleaseMask 
			   | (int) EventMask.PointerMotionMask);
		
		CanFocus = true;

		//FSpot.Global.ModifyColors (this);
	}
Ejemplo n.º 49
0
 private void Form1_Load(object sender, EventArgs e)
 {
     kpHandler           = new KeyPressEventHandler(KeyPressed);
     txtsearch.KeyPress += kpHandler;
 }
Ejemplo n.º 50
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            KeyPressEventHandler keyPressHdr = new KeyPressEventHandler(KeyPressed);
            EventHandler         logInHdr    = new EventHandler(LogInClicked);

            ControlBox  = false;
            MinimizeBox = false;
            MaximizeBox = false;
            Text        = App.GetStr("RDP Authentication");
            Menu        = new MainMenu();

            passwdLbl.Location = new Point(App.DialogSpacing, App.DialogSpacing);
            passwdLbl.Text     = App.GetStr("Password:"******"Cancel");
                cancelBtn.DialogResult = DialogResult.Cancel;
                cancelBtn.KeyPress    += keyPressHdr;

                logInBtn.Location  = new Point(cancelBtn.Left - App.DialogSpacing - logInBtn.Width, cancelBtn.Top);
                logInBtn.Text      = App.GetStr("Log In");
                logInBtn.Click    += logInHdr;
                logInBtn.KeyPress += keyPressHdr;

                Controls.Add(logInBtn);
                Controls.Add(cancelBtn);
            }
            else
            {
                logInItem.Text   = App.GetStr("Log In");
                logInItem.Click += logInHdr;
                Menu.MenuItems.Add(logInItem);
                cancelItem.Text   = App.GetStr("Cancel");
                cancelItem.Click += new EventHandler(CancelClicked);
                Menu.MenuItems.Add(cancelItem);
            }

            passwdBox.Focus();
        }
        public static void Create_TextboxMasked(Panel pnlText, ref MaskedTextBox txtValueMasked, EventHandler TextChanged, KeyPressEventHandler KeyPress)
        {
            //
            // txtValueMasked
            //
            if (txtValueMasked == null)
            {
                txtValueMasked = new MaskedTextBox();

                txtValueMasked.Dock         = DockStyle.Top;
                txtValueMasked.Location     = new Point(0, 0);
                txtValueMasked.Mask         = "(999) 000-0000";
                txtValueMasked.Name         = "txtValueMasked";
                txtValueMasked.Size         = new Size(412, 20);
                txtValueMasked.TabIndex     = 4;
                txtValueMasked.TextChanged += TextChanged;
                txtValueMasked.KeyPress    += KeyPress;
                pnlText.Controls.Add(txtValueMasked);
            }
            txtValueMasked.Visible = false;
        }
        public static void Create_TextBox(Panel pnlText, ref TextBox txtValue, EventHandler TextChanged, KeyPressEventHandler KeyPress)
        {
            //
            // txtValue
            //
            if (txtValue == null)
            {
                txtValue = new TextBox();

                txtValue.BackColor    = Color.White;
                txtValue.Dock         = DockStyle.Fill;
                txtValue.Location     = new Point(0, 20);
                txtValue.Multiline    = true;
                txtValue.Name         = "txtValue";
                txtValue.Size         = new Size(412, 20);
                txtValue.TabIndex     = 2;
                txtValue.TextChanged += TextChanged;
                txtValue.KeyPress    += KeyPress;
                pnlText.Controls.Add(txtValue);
            }
            txtValue.Visible = false;
        }
Ejemplo n.º 53
0
 /// <summary>
 /// Ubsubscribes a method from a certain key's keypress handler
 /// </summary>
 /// <param name="key">Microsoft.XNA.Framework.Input.Keys enum</param>
 /// <param name="method">a void() method</param>
 public void UnsubscribeToKeyPressEvent(Keys key, KeyPressEventHandler method)
 {
     if (KeypressHandlers.ContainsKey(key))
         KeypressHandlers[key] -= method;
 }
Ejemplo n.º 54
0
 /// <summary>
 /// Tries to invoke a KeyPressEventHandler
 /// </summary>
 /// <param name="handler">Handler to invoke</param>
 private static void OnKeyPressed(KeyPressEventHandler handler)
 {
     handler?.Invoke();
 }
Ejemplo n.º 55
0
        public PintaCanvas()
        {
            cr = new CanvasRenderer();
            gr = new GridRenderer(cr);

            // Keep the widget the same size as the canvas
            PintaCore.Workspace.CanvasSizeChanged += delegate(object sender, EventArgs e) {
                SetRequisition(PintaCore.Workspace.CanvasSize);
            };

            // Update the canvas when the image changes
            PintaCore.Workspace.CanvasInvalidated += delegate(object sender, CanvasInvalidatedEventArgs e) {
                if (e.EntireSurface)
                {
                    GdkWindow.Invalidate();
                }
                else
                {
                    GdkWindow.InvalidateRect(e.Rectangle, false);
                }
            };

            // Give mouse press events to the current tool
            ButtonPressEvent += delegate(object sender, ButtonPressEventArgs e) {
                if (PintaCore.Workspace.HasOpenDocuments)
                {
                    PintaCore.Tools.CurrentTool.DoMouseDown(this, e, PintaCore.Workspace.WindowPointToCanvas(e.Event.X, e.Event.Y));
                }
            };

            // Give mouse release events to the current tool
            ButtonReleaseEvent += delegate(object sender, ButtonReleaseEventArgs e) {
                if (PintaCore.Workspace.HasOpenDocuments)
                {
                    PintaCore.Tools.CurrentTool.DoMouseUp(this, e, PintaCore.Workspace.WindowPointToCanvas(e.Event.X, e.Event.Y));
                }
            };

            // Give mouse move events to the current tool
            MotionNotifyEvent += delegate(object sender, MotionNotifyEventArgs e) {
                if (!PintaCore.Workspace.HasOpenDocuments)
                {
                    return;
                }

                Cairo.PointD point = PintaCore.Workspace.ActiveWorkspace.WindowPointToCanvas(e.Event.X, e.Event.Y);

                if (PintaCore.Workspace.ActiveWorkspace.PointInCanvas(point))
                {
                    PintaCore.Chrome.LastCanvasCursorPoint = point.ToGdkPoint();
                }

                if (PintaCore.Tools.CurrentTool != null)
                {
                    PintaCore.Tools.CurrentTool.DoMouseMove(sender, e, point);
                }
            };

            // Handle key press/release events
            KeyPressEvent   += new KeyPressEventHandler(PintaCanvas_KeyPressEvent);
            KeyReleaseEvent += new KeyReleaseEventHandler(PintaCanvas_KeyReleaseEvent);
        }
 private void SetupDialog()
 {
     this.Title = string.Format("{0} {1}", domain.Name, Util.GS("Properties"));
        this.Icon = new Gdk.Pixbuf(Util.ImagesPath("ifolder16.png"));
        this.HasSeparator = false;
        this.Resizable = false;
        this.Modal = false;
        this.TypeHint = Gdk.WindowTypeHint.Normal;
        this.DefaultResponse = ResponseType.Ok;
        VBox vbox = new VBox(false, 12);
        this.VBox.PackStart(vbox, true, true, 0);
        vbox.BorderWidth = Util.DefaultBorderWidth;
        vbox.PackStart(CreateNotebook(), true, true, 0);
        vbox.PackStart(CreateGlobalCheckButtons(), false, false, 0);
        this.AddButton(Gtk.Stock.Close, ResponseType.Ok);
        this.DefaultResponse = ResponseType.Ok;
        this.Response += new ResponseHandler(OnAccountDialogResponse);
        ControlKeyPressed = false;
        KeyPressEvent += new KeyPressEventHandler(KeyPressHandler);
        KeyReleaseEvent += new KeyReleaseEventHandler(KeyReleaseHandler);
        this.Realized += new EventHandler(OnRealizeWidget);
 }
 public static TControl OnKeyPress <TControl>(this TControl that, KeyPressEventHandler handler)
     where TControl : Control
 {
     that.KeyPress += handler;
     return(that);
 }
Ejemplo n.º 58
0
 public NumTextBox()
 {
     KeyPress        += new KeyPressEventHandler(TeclaPresionada);
     AllowDrop        = false;
     ShortcutsEnabled = false;
 }
Ejemplo n.º 59
0
 private void Form_Load(object sender, EventArgs e)
 {
     KeyPreview = true;
     KeyPress  += new KeyPressEventHandler(Form_KeyPress);
     KeyDown   += Form_KeyDown;
 }
Ejemplo n.º 60
-1
        public void BindGameController()
        {

            _mouse_up = new MouseEventHandler(OnMouseUp);
            _game_control.GetTargetControl().MouseUp += _mouse_up;

            _mouse_click = new MouseEventHandler(OnMouseClick);
            _game_control.GetTargetControl().MouseClick += _mouse_click;

            _mouse_down = new MouseEventHandler(OnMouseDown);
            _game_control.GetTargetControl().MouseDown += _mouse_down;

            _mouse_move = new MouseEventHandler(OnMouseMove);
            _game_control.GetTargetControl().MouseMove += _mouse_move;

            _mouse_wheel = new MouseEventHandler(OnMouseWheel);
            _game_control.GetTargetControl().MouseWheel += _mouse_wheel;

            _mouse_double_click = new MouseEventHandler(OnMouseDoubleClick);
            _game_control.GetTargetControl().MouseDoubleClick += _mouse_double_click;

            _key_press = new KeyPressEventHandler(OnKeyPress);
            _game_control.GetTargetControl().KeyPress += _key_press;

            _key_down = new KeyEventHandler(OnKeyDown);
            _game_control.GetTargetControl().KeyDown += _key_down;

            _key_up = new KeyEventHandler(OnKeyUp);
            _game_control.GetTargetControl().KeyUp += _key_up;

        }