public int AddControl(Control control) { var host = new ToolStripControlHost(control); host.Padding = host.Margin = Padding.Empty; host.BackColor = Color.Transparent; return(this.Items.Add(host)); }
public ToolStripDropDownButton generateControl() { // control.AutoSize = true; ToolStripDropDownButton dropDown = base.generateControl <ToolStripDropDownButton>(); ToolStripControlHost panel = new ToolStripControlHost(control); //panel.Size = control.Size; // panel.AutoSize = false; // dropDown.DropDown.AutoSize = true; panel.BackColor = Color.WhiteSmoke; dropDown.DropDown.BackColor = UIManager.Instance.PaleFlairColor; panel.Padding = Padding.Empty; panel.Margin = Padding.Empty; panel.Dock = DockStyle.Fill; dropDown.DropDown.Items.Add(panel); dropDown.DropDownDirection = ToolStripDropDownDirection.BelowLeft; dropDown.DropDown.Size = control.Size; dropDown.DropDown.Padding = Padding.Empty; dropDown.DropDown.Margin = Padding.Empty; ((ToolStripDropDownMenu)dropDown.DropDown).ShowImageMargin = false; ((ToolStripDropDownMenu)dropDown.DropDown).ShowItemToolTips = false; //dropDown.DropDown.ShowImag control.ClosedControl += (s, accepted) => { dropDown.DropDown.Close(ToolStripDropDownCloseReason.CloseCalled); //updateScripts(accepted); }; //dropDown.DropDown.LostFocus += (s, a) => //{ // updateScripts(true); //}; dropDown.DropDownClosed += (s, a) => { //accepted = true; updateScripts(control.Accepted, control.getSelectedScripts()); }; return(dropDown); }
/// <summary> /// /// </summary> public TimeManagementToolStrip() { InitializeComponent(); this.Enabled = false; _host = new ToolStripControlHost(trackBarSpeed); this.Items.Add(_host); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public PopupControl() { MonitorMouseOver = true; InitializeComponent(); base.DoubleBuffered = true; if (DesignMode || GetService(typeof(IDesignerHost)) != null || LicenseManager.UsageMode == LicenseUsageMode.Designtime) { return; } base.Dock = DockStyle.Fill; m_host = new ToolStripControlHost(this); m_host.Padding = Padding.Empty; m_host.Margin = Padding.Empty; m_host.AutoSize = false; m_host.Size = Size; m_host.Dock = DockStyle.Fill; OwningDropDown = new ToolStripDropDown(); OwningDropDown.Padding = Padding.Empty; OwningDropDown.AutoSize = false; OwningDropDown.LayoutStyle = ToolStripLayoutStyle.Table; OwningDropDown.Size = Size; OwningDropDown.Items.Add(m_host); OwningDropDown.Closing += OnDropDownClosing; OwningDropDown.VisibleChanged += ((sender, e) => { if (OwningDropDown.Visible && MonitorMouseOver) { InitializeTimer(); } else if (!OwningDropDown.Visible && m_timer != null) { m_timer.Stop(); } }); OwningDropDown.Opened += ((sender, e) => { if (PopupOpened != null) { PopupOpened(this, e); } }); OwningDropDown.Closed += ((sender, e) => { if (PopupClosed != null) { PopupClosed(this, e); } }); }
public static ToolStripDropDown NewPopup(Control contents) { var strip = new ToolStripDropDown(); var host = new ToolStripControlHost(contents); strip.Items.Add(host); host.Margin = new Padding(0); return(strip); }
private void Form1_Load(object sender, EventArgs e) { this.Text = string.Format(WindowTitle, Songs.Count(o => ((ListViewItemData)o.Tag).State == ListViewItemData._State.Processed), Songs.Count, CurrentOffset); LabelOffset.Text = string.Format(labelText, CurrentOffset); isShown = true; CustomSongs = CustomSongsDialog.GetDirectoryInfo(); #region ToolStripInit JumpCheck = new CheckBox { Text = "Jump to Latest Download" }; ToolStripControlHost host = new ToolStripControlHost(JumpCheck); ToolStrip.Items.Add(host); ToolStripFileButton.DropDownItems.AddRange(new[] { ButtonCustomSongs = new ToolStripButton("CustomSongs", null, ButtonCustomSongs_Click, "ButtonCustomSongs") { DisplayStyle = ToolStripItemDisplayStyle.Text }, ButtonDownloads = new ToolStripButton("Downloads", null, ButtonDownloads_Click, "ButtonDownloads") { DisplayStyle = ToolStripItemDisplayStyle.Text } }); ToolStripFileButton.DropDownItems.Remove(HOLDER); HOLDER.Dispose(); if (!IsLatestVersion) { ToolStripAboutButton.DropDownItems.Add(ButtonUpdate = new ToolStripButton("Update", null, ButtonUpdate_Click, "ButtonUpdate") { DisplayStyle = ToolStripItemDisplayStyle.Text }); } ToolStripAboutButton.DropDownItems.AddRange(new[] { ButtonGithub = new ToolStripButton("Github", null, ButtonGithub_Click, "ButtonGithub") { DisplayStyle = ToolStripItemDisplayStyle.Text }, ButtonWiki = new ToolStripButton("Wiki", null, ButtonWiki_Click, "ButtonWiki") { DisplayStyle = ToolStripItemDisplayStyle.Text }, ButtonCredits = new ToolStripButton("Credits", null, ButtonCredits_Click, "ButtonCredits") { DisplayStyle = ToolStripItemDisplayStyle.Text } }); #endregion if (CustomSongs == null) { MessageBox.Show("You did not set a correct path for the CustomSongs directory."); Application.Exit(); } run = true; }
public FrmCourseSelection() { InitializeComponent(); dtpDate.Width = 120; dtpDate.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); ToolStripControlHost item = new ToolStripControlHost(dtpDate); toolStrip1.Items.Insert(3, item); }
public MyTreeViewCombo() { TreeView treeView = new TreeView(); treeView.BorderStyle = BorderStyle.None; treeViewHost = new ToolStripControlHost(treeView); dropDown = new ToolStripDropDown(); dropDown.Items.Add(treeViewHost); }
/// <summary> /// </summary> /// <param name="serverUri">ホストプロセスとの通信用URL</param> public FormBrowser(string serverUri) { InitializeComponent(); ServerUri = serverUri; StyleSheetApplied = false; _volumeManager = new VolumeManager((uint)Process.GetCurrentProcess().Id); ToolStripManager.Renderer = new CustomToolStripRenderer(new ToolStripBGColor()); // 音量設定用コントロールの追加 { var control = new NumericUpDown(); control.Name = "ToolMenu_Other_Volume_VolumeControl"; control.Maximum = 100; control.TextAlign = HorizontalAlignment.Right; control.Font = ToolMenu_Other_Volume.Font; control.ValueChanged += ToolMenu_Other_Volume_ValueChanged; control.Tag = false; var host = new ToolStripControlHost(control, "ToolMenu_Other_Volume_VolumeControlHost"); control.Size = new Size(host.Width - control.Margin.Horizontal, host.Height - control.Margin.Vertical); control.Location = new Point(control.Margin.Left, control.Margin.Top); ToolMenu_Other_Volume.DropDownItems.Add(host); } // スクリーンショットプレビューコントロールの追加 { double zoomrate = 0.5; var control = new PictureBox(); control.Name = "ToolMenu_Other_LastScreenShot_Image"; control.SizeMode = PictureBoxSizeMode.Zoom; control.Size = new Size((int)(KanColleSize.Width * zoomrate), (int)(KanColleSize.Height * zoomrate)); control.Margin = new Padding(); control.Image = new Bitmap((int)(KanColleSize.Width * zoomrate), (int)(KanColleSize.Height * zoomrate), PixelFormat.Format24bppRgb); using (var g = Graphics.FromImage(control.Image)) { g.Clear(SystemColors.Control); g.DrawString("スクリーンショットをまだ撮影していません。\r\n", Font, Brushes.Black, new Point(4, 4)); } var host = new ToolStripControlHost(control, "ToolMenu_Other_LastScreenShot_ImageHost"); host.Size = new Size(control.Width + control.Margin.Horizontal, control.Height + control.Margin.Vertical); host.AutoSize = false; control.Location = new Point(control.Margin.Left, control.Margin.Top); host.Click += ToolMenu_Other_LastScreenShot_ImageHost_Click; ToolMenu_Other_LastScreenShot.DropDownItems.Insert(0, host); } }
public static void BindKeyPress(this ToolStripControlHost control, Signal signal, params char[] keyChars) { control.KeyPress += (sender, e) => { if (keyChars.Contains(e.KeyChar)) { signal.Handler(control, e); } }; }
/// <summary> /// Initializes a new instance of the <see cref="ColorDropDown"/> class with default settings. /// </summary> public ColorDropDown() { Font = DrawUtils.DefaultFont; FColorSelector = new ColorSelector(); FColorSelector.ColorSelected += new EventHandler(FColorSelector_ColorSelected); FHost = new ToolStripControlHost(FColorSelector); Items.Add(FHost); Opening += new CancelEventHandler(ColorDropDown_Opening); //BackColor = Config.DesignerSettings.CustomRenderer.ControlColor; }
private void SetupToolStrips() { var k = bnavNav.Items.IndexOf(this.bnavNavPosItem); dateSelectorItem = InsertInToolStrip(bnavNav, cbDates, k); InsertInToolStrip(toolStrip1, cbPersons, 0); InsertInToolStrip(toolStrip1, cbAmati, 2); InsertInToolStrip(toolStrip1, cbSelectTab, 4); }
public Control GetHostedControl() { if (Items.Count > 0) { ToolStripControlHost host = Items[0] as ToolStripControlHost; if (host != null) return host.Control; } return null; }
internal static void SetDefaultProperties(ToolStripControlHost c) { c.ControlAlign = ContentAlignment.TopLeft; //prevents jumping TextBox up-down when resizing c.Margin = new Padding(0, 2, 0, 0); //The default heigth is too big. When high DPI, makes toolstrip higher. //Easiest is to change font, because the default Segoe UI 9 font has too many space above. //Another way - set AutoSize = false for c and c.Control, and then resize c when resizing its toolstrip. Difficult, because we receive the Resize event too late. Tried unsuccessfully. c.Font = _font; }
private void OnNeedSearch(ToolStripControlHost item, string searchText) { var tssb = item as ToolStripSearchBar; if (tssb == null) { return; } StartSearch(tssb.SearchBar, searchText); }
public ToolStripComboBoxTreeViewControl() { System.Windows.Forms.TreeView c = new System.Windows.Forms.TreeView(); c.AfterSelect += new TreeViewEventHandler(this.treeView_AfterSelect); c.BorderStyle = BorderStyle.None; this.toolStripControlHost_0 = new ToolStripControlHost(c); this.toolStripDropDown_0 = new ToolStripDropDown(); this.toolStripDropDown_0.Width = base.Width; this.toolStripDropDown_0.Items.Add(this.toolStripControlHost_0); }
public MainForm() { InitializeComponent(); guestViewer.Alpha = GlobalConfigs.Configurations.Speed / 100F; guestViewer.MaxCapacityInCircle = GlobalConfigs.Configurations.MaxCapacityInCircle; guestViewer.CircleCapacity = GlobalConfigs.Configurations.CircleCapacity; guestViewer.CircleVerInterval = GlobalConfigs.Configurations.CircleVerInterval; guestViewer.ViewModel = GlobalConfigs.Configurations.CircleModel; trackBarThreshold = new EgoDevil.Utilities.UI.TrackBarEx() { Height = 24, Value = (int)GlobalConfigs.Configurations.Threshold, }; trackBarSpeed = new EgoDevil.Utilities.UI.TrackBarEx() { Height = 24, Value = (int)GlobalConfigs.Configurations.Speed, }; trackBarThreshold.LostFocus += trackBarThreshold_LostFocus; trackBarSpeed.ValueChanged += trackBarSpeed_ValueChanged; var tsControlHost = new ToolStripControlHost(trackBarThreshold) { Width = 140, AutoSize = false }; var tsControlHost2 = new ToolStripControlHost(trackBarSpeed) { Width = 140, AutoSize = false }; this.tsmiSetThreshold.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { tsControlHost }); this.tsmiSetSpeed.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { tsControlHost2 }); this.BackColor = Color.Black; ResizeControlls(); InitPlayer(); guestViewer.Loading(); FixGuest(); RefreshGuests(); }
private void CustomToolStripItem_Load(object sender, EventArgs e) { DateTimePicker dt = new DateTimePicker(); dt.Value = DateTime.Now; dt.Format = DateTimePickerFormat.Short; dt.Width /= 2; dt.Font = new Font("Tahoma", dt.Font.Size); item = new ToolStripControlHost(dt); toolStrip1.Items.Insert(1, item); }
public IntelliSenseWindow() { _listBox = new IntelliSenseBox(this); ToolStripControlHost tch = new ToolStripControlHost(_listBox); this.Items.Add(tch); tch.Padding = Padding.Empty; this.Padding = Padding.Empty; this.ImeMode = ImeMode.Disable; _cancelDelegate = new CancelDelegateT(this.Cancel); }
public void ToolStripHostedControlAccessibleObject_GetPropertyValue_IsOffscreenPropertyId_ReturnExpected(Type type) { using var toolStrip = new ToolStrip(); toolStrip.CreateControl(); using ToolStripControlHost item = ReflectionHelper.InvokePublicConstructor <ToolStripControlHost>(type); item.Size = new Size(0, 0); toolStrip.Items.Add(item); Assert.True(GetIsOffscreenPropertyValue(item.AccessibilityObject)); Assert.True(GetIsOffscreenPropertyValue(item.Control.AccessibilityObject)); }
private void SetupTreeView(TreeView treeView) { treeView.BorderStyle = BorderStyle.None; treeView.Dock = DockStyle.Fill; treeViewHost = new ToolStripControlHost(treeView); treeViewHost.AutoSize = false; // create drop down and add it dropDown = new ToolStripDropDown(); dropDown.Items.Add(treeViewHost); }
public void ClearControl() { if (m_host == null) { return; } this.Items.Remove(m_host); m_host.Dispose(); m_host = null; }
public OrderEditControl() { InitializeComponent(); dtp = new DateTimePicker(); dtp.Format = DateTimePickerFormat.Custom; dtp.CustomFormat = "yyyy-M-dd"; dtp.ValueChanged += Dtp_ValueChanged; ToolStripControlHost dateItem = new ToolStripControlHost(dtp); toolStrip5.Items.Add(dateItem); }
public UndoRedoToolStripDropDown(UndoRedoTitlebarButton parent, Form parentForm, string cmdTypeText, Action <int> undoRedoCallback) { this.parentForm = parentForm; this.cmdTypeText = cmdTypeText; this.parent = parent; this.undoRedoCallback = undoRedoCallback; BackColor = Colors.Primary(); ForeColor = Colors.Font(); pnl = new Panel { Size = new Size(width, bottomHeight + lbHeight), Location = new Point(0, 0), BorderStyle = BorderStyle.FixedSingle, BackColor = Colors.Primary(), ForeColor = Colors.Font(), }; lblUndoRedoCount = new Label { Size = new Size(width, bottomHeight), Location = new Point(1, lbHeight - 2), TextAlign = ContentAlignment.MiddleCenter, Text = cmdTypeText + " 1 command(s)", ForeColor = Colors.Font(), }; lbCommands = new ListBox { Size = new Size(width, lbHeight), Location = new Point(0, 1), SelectionMode = SelectionMode.MultiSimple, ScrollAlwaysVisible = true, BorderStyle = BorderStyle.None, Font = new Font(pnl.Font.FontFamily, 9), BackColor = Colors.Primary(), ForeColor = Colors.Font(), }; lbCommands.Click += LbCommands_Click; lbCommands.MouseMove += LbCommands_MouseMove; ToolStripControlHost tsch = new ToolStripControlHost(pnl) { Size = new Size(width, pnl.Height), Margin = Padding.Empty, }; pnl.Controls.Add(lbCommands); pnl.Controls.Add(lblUndoRedoCount); base.Items.Add(tsch); }
private void OnControlChanged() { if (DropDownContainer != null) { DropDownContainer.Items.Clear(); ToolStripControlHost tsch = new ToolStripControlHost(Control); DropDownContainer = new ToolStripDropDown(); DropDownContainer.Items.Add(tsch); } }
private void VixenPreviewSetup_Load(object sender, EventArgs e) { //ToolStripLabel label = new ToolStripLabel("Background Intensity:") //label.Spring //statusStrip1.Items.Add(label); ToolStripControlHost host = new ToolStripControlHost(scrollBackgroundAlpha); statusStrip1.Items.Add(host); Setup(); }
private void Form2dLoad(object sender, EventArgs e) { initdone = false; pickerStart = new DateTimePicker(); pickerStop = new DateTimePicker(); host1 = new ToolStripControlHost(pickerStart); toolStrip.Items.Add(host1); host2 = new ToolStripControlHost(pickerStop); toolStrip.Items.Add(host2); pickerStart.Value = DateTime.Today.AddMonths(-1); this.pickerStart.ValueChanged += new System.EventHandler(this.dateTimePickerStart_ValueChanged); this.pickerStop.ValueChanged += new System.EventHandler(this.dateTimePickerStop_ValueChanged); startDate = new DateTime(2010, 1, 1); if (!AddImages()) { ExtendedControls.MessageBoxTheme.Show(this, "No maps available".Tx(this), "Warning".Tx(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Close(); return; } toolStripComboExpo.Items.Clear(); foreach (Map2d img in fgeimages) { toolStripComboExpo.Items.Add(img.FileName); } toolStripComboBoxTime.Items.AddRange(new string[] { "Distant Worlds Expedition", "FGE Expedition", "Last Week".Tx(this), "Last Month".Tx(this), "Last Year".Tx(this), "All".Tx(this), "Custom".Tx(this) }); toolStripComboExpo.SelectedIndex = 0; toolStripComboBoxTime.SelectedIndex = 0; initdone = true; ShowSelectedImage(); imageViewer.BackColor = Color.FromArgb(5, 5, 5); EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance; bool winborder = theme.ApplyToFormStandardFontSize(this); statusStripCustom.Visible = panel_close.Visible = panel_minimize.Visible = !winborder; BaseUtils.Translator.Instance.Translate(this); }
public EventWatcher(ToolStripControlHost tsi) { tsi.Enter += new EventHandler(delegate(Object obj, EventArgs e) { events += ("Enter;"); }); tsi.GotFocus += new EventHandler(delegate(Object obj, EventArgs e) { events += ("GotFocus;"); }); tsi.KeyDown += new KeyEventHandler(delegate(Object obj, KeyEventArgs e) { events += ("KeyDown;"); }); tsi.KeyPress += new KeyPressEventHandler(delegate(Object obj, KeyPressEventArgs e) { events += ("KeyPress;"); }); tsi.KeyUp += new KeyEventHandler(delegate(Object obj, KeyEventArgs e) { events += ("KeyUp;"); }); tsi.Leave += new EventHandler(delegate(Object obj, EventArgs e) { events += ("Leave;"); }); tsi.LostFocus += new EventHandler(delegate(Object obj, EventArgs e) { events += ("LostFocus;"); }); tsi.Validated += new EventHandler(delegate(Object obj, EventArgs e) { events += ("Validated;"); }); tsi.Validating += new CancelEventHandler(delegate(Object obj, CancelEventArgs e) { events += ("Validating;"); }); }
public MainForm() { InitializeComponent(); MainThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId; enableSnapBox = new CheckBox(); enableSnapBox.Checked = true; enableSnapBox.Text = "开启捕捉"; host = new ToolStripControlHost(enableSnapBox); toolStrip1.Items.Add(host); }
public ComboBoxTreeView() { TreeView treeView = new TreeView(); treeView.AfterSelect += new TreeViewEventHandler(treeView_AfterSelect); treeView.BorderStyle = BorderStyle.None; treeViewHost = new ToolStripControlHost(treeView); dropDown = new ToolStripDropDown(); dropDown.Width = this.Width; dropDown.Items.Add(treeViewHost); }