/// <summary> /// Selects the first control in the ledger list, if it exists. /// Once this control is focused the client can use the TAB key to select other items in the folder navigation panel. /// TODO: This functionality needs more thought when we get multi ledgers for real in production. (AlanP) /// because we do not get a marquee when the control gets the focus. We really need another way (colour) for showing the /// selected ledger. I do not have time for this now. /// </summary> public void SelectLedgerList() { Control[] ledgerPanels = this.sptNavigation.Panel1.Controls.Find("SelectLedger", true); foreach (Control c1 in ledgerPanels) { Control[] tasks = c1.Controls.Find("TTaskList", true); foreach (Control c2 in tasks) { TTaskList task = c2 as TTaskList; if ((task != null) && (task.Controls.Count > 0)) { Panel c3 = (Panel)task.Controls[0]; c3.Focus(); if (c3.Controls[0] as LinkLabel != null) { LinkLabel c4 = (LinkLabel)c3.Controls[0]; c4.Select(); c4.Focus(); } } } } }
void Start() { _appPath = appDirTextBox.Text; if (_appPath.Length == 0 || !Directory.Exists(_appPath)) { ShowError("Invalid Application Directory"); appDirTextBox.SelectAll(); appDirTextBox.Focus(); return; } _portString = portTextBox.Text; int portNumber = -1; try { portNumber = Int32.Parse(_portString); } catch { } if (portNumber <= 0) { ShowError("Invalid Port"); portTextBox.SelectAll(); portTextBox.Focus(); return; } _virtRoot = vrootTextBox.Text; if (_virtRoot.Length == 0 || !_virtRoot.StartsWith("/")) { ShowError("Invalid Virtual Root"); vrootTextBox.SelectAll(); vrootTextBox.Focus(); return; } _addressType = allowRemote.Checked ? "any" : "loopback"; try { _server = new Server(portNumber, _virtRoot, _appPath, _addressType); _server.Start(); } catch { ShowError( "Cassini Managed Web Server failed to start listening on port " + portNumber + ".\r\n" + "Possible conflict with another Web Server on the same port."); portTextBox.SelectAll(); portTextBox.Focus(); return; } startButton.Enabled = false; appDirTextBox.Enabled = false; portTextBox.Enabled = false; vrootTextBox.Enabled = false; browseLabel.Visible = true; browseLink.Text = GetLinkText(); browseLink.Visible = true; browseLink.Focus(); }
protected override void OnGotFocus(EventArgs e) { // forward focus to the inner control if (!WatermarkVisible) { _mainControl.Focus(); } else { // give focus to the watermark. Allows accessibility // tools to read the watermark text. _watermark.Focus(); } }
private void lvAppContainers_KeyDown(object sender, KeyEventArgs e) { if (e.Modifiers == Keys.Control && e.KeyCode == Keys.A) { bool handled = e.SuppressKeyPress = true; e.Handled = handled; actSelectAll(); } if (e.Alt && e.KeyCode == Keys.Space) { bool suppressKeyPress = e.Handled = true; e.SuppressKeyPress = suppressKeyPress; lnkLearn.Focus(); SendKeys.Send("% "); } }
void OnItemLinkClicked(object sender, LinkLabelLinkClickedEventArgs args) { if (args.Button != MouseButtons.Left) { return; } if (args.Link.LinkData == null) { return; } Item item = (Item)args.Link.LinkData; CreateAndShowDetails(item); LinkLabel label = (LinkLabel)sender; label.Focus(); }
private void OnUIElementClick(object sender, MouseEventArgs e) { if (descriptionTextBox.Focused) { if (sender.GetType() == typeof(Panel)) { Panel senderControl = (Panel)sender; senderControl.Focus(); } if (sender.GetType() == typeof(Label)) { Label senderControl = (Label)sender; senderControl.Focus(); } if (sender.GetType() == typeof(LinkLabel)) { LinkLabel senderControl = (LinkLabel)sender; senderControl.Focus(); } } }
/// <summary> /// クリックです。 /// </summary> /// <param name="linklabel">リンクラベル。</param> static void EmulateLinkClickInTarget(LinkLabel linklabel) { linklabel.Focus(); linklabel.GetType().GetMethod("OnLinkClicked", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(linklabel, new object[] { new LinkLabelLinkClickedEventArgs(new LinkLabel.Link()) }); }