本文整理汇总了C#中System.Windows.Forms.ToolStripControlHost类的典型用法代码示例。如果您正苦于以下问题:C# ToolStripControlHost类的具体用法?C# ToolStripControlHost怎么用?C# ToolStripControlHost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ToolStripControlHost类属于System.Windows.Forms命名空间,在下文中一共展示了ToolStripControlHost类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Popup
/// <summary>
/// Initializes a new instance of the <see cref="PopupControl.Popup" /> class.
/// </summary>
/// <param name="content">The content of the pop-up.</param>
/// <remarks>
/// Pop-up will be disposed immediately after disposion of the content control.
/// </remarks>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="content" /> is <code>null</code>.
/// </exception>
public Popup(Control content)
{
if (content == null)
{
throw new ArgumentNullException("content");
}
this.content = content;
fade = SystemInformation.IsMenuAnimationEnabled && SystemInformation.IsMenuFadeEnabled;
_resizable = true;
InitializeComponent();
AutoSize = false;
DoubleBuffered = true;
ResizeRedraw = true;
host = new ToolStripControlHost(content);
Padding = Margin = host.Padding = host.Margin = Padding.Empty;
MinimumSize = content.MinimumSize;
content.MinimumSize = content.Size;
MaximumSize = content.MaximumSize;
content.MaximumSize = content.Size;
Size = content.Size;
content.Location = Point.Empty;
Items.Add(host);
content.Disposed += delegate
{
content = null;
Dispose(true);
};
content.RegionChanged += delegate { UpdateRegion(); };
content.Paint += delegate(object sender, PaintEventArgs e) { PaintSizeGrip(e); };
UpdateRegion();
}
开发者ID:Slashmolder,项目名称:RNGReporter,代码行数:41,代码来源:Popup.cs
示例2: DropDownWindowPopup
public DropDownWindowPopup(ChartControl ownerChart)
{
Margin = Padding.Empty;
Padding = Padding.Empty;
AutoSize = false;
var window = new SummaryPositionDropWindow(ownerChart.Owner)
{
Parent = ownerChart
};
Width = window.Width;
Height = window.Height;
window.closeControl += Close;
Closing += (sender, args) =>
{
if (window.isPinup) args.Cancel = true;
};
var host = new ToolStripControlHost(window)
{
Margin = Padding.Empty,
Padding = Padding.Empty,
AutoSize = false
};
Items.Add(host);
}
开发者ID:johnmensen,项目名称:TradeSharp,代码行数:27,代码来源:DropDownWindowPopup.cs
示例3: ColorPickerDropDown
/// ------------------------------------------------------------------------------------
/// <summary>
/// Encapsulates a color picker drop-down almost just like Word 2003's.
/// </summary>
/// <param name="fShowUnspecified">if set to <c>true</c> control will include a button
/// for the "automatic" choice (i.e., not explicitly specified).</param>
/// <param name="selectedColor">Initial color to select.</param>
/// ------------------------------------------------------------------------------------
public ColorPickerDropDown(bool fShowUnspecified, Color selectedColor)
{
LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow;
if (fShowUnspecified)
{
// Add the "Automatic" button.
m_autoItem = new ToolStripButton(ColorPickerStrings.kstidUnspecifiedText);
m_autoItem.TextAlign = ContentAlignment.MiddleCenter;
m_autoItem.Click += new EventHandler(m_autoItem_Click);
m_autoItem.Margin = new Padding(1, m_autoItem.Margin.Top,
m_autoItem.Margin.Right, m_autoItem.Margin.Bottom);
Items.Add(m_autoItem);
}
// Add all the colored squares.
m_colorMatrix = new ColorPickerMatrix();
m_colorMatrix.ColorPicked += new EventHandler(m_colorMatrix_ColorPicked);
ToolStripControlHost host = new ToolStripControlHost(m_colorMatrix);
host.AutoSize = false;
host.Size = new Size(m_colorMatrix.Width + 6, m_colorMatrix.Height + 6);
host.Padding = new Padding(3);
Items.Add(host);
// Add the "More Colors..." button.
m_moreItem = new ToolStripMenuItem(ColorPickerStrings.kstidMoreColors);
m_moreItem.TextAlign = ContentAlignment.MiddleCenter;
m_moreItem.Click += new EventHandler(m_moreItem_Click);
Items.Add(m_moreItem);
CurrentColor = selectedColor;
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:41,代码来源:ColorPickerDropDown.cs
示例4: addFavToMenu
//dynamically add an item to the favourites drop down menu given a Favourite
public void addFavToMenu(Favourite f)
{
ContainerControl cc = new ContainerControl();
cc.BackColor = Color.WhiteSmoke;
ToolStripControlHost c = new ToolStripControlHost(cc);
Button b = new Button();
b.Parent = cc;
initRemoveFavButton(b);
b.Click += (s, e) => { favMenu.DropDownItems.Remove(c);favs.removeFavourite(f); };
TextBox temp = new TextBox();
temp.Text = f.name;
temp.Click += (s, e) => { initNewTab(f.url); };
temp.Parent = cc;
temp.Left = b.Size.Width;
temp.Left = (int)Math.Floor((float)temp.Left * 1.3f);
initFavBox(temp);
Button t = new Button();
t.Text = f.url;
t.Parent = cc;
initMenuButton(t);
t.Top = temp.Height>b.Height?temp.Height :b.Height;
t.Top = (int)Math.Floor((float)t.Top * 1.1f);
t.Left = temp.Left;
t.Enabled = false;
Button eb = new Button();
eb.Parent = cc;
eb.Left = temp.Left + temp.Size.Width;
eb.Click += (s, e) => editButtonClick(temp, eb, f);
initEditButton(eb);
favMenu.DropDownItems.Add(c);
}
开发者ID:Gokimster,项目名称:WebBrowser,代码行数:32,代码来源:GUI.cs
示例5: AddControl
public void AddControl( IComboBoxExtender child )
{
try {
childControl = child;
childControl.SetUserInterface ( );
treeViewHost = new ToolStripControlHost ( childControl as Control );
treeViewHost.Visible = false;
CloseComboBoxExtenderHandler closeCombo = new CloseComboBoxExtenderHandler ( CloseComboBox );
childControl.CloseComboBoxExtenderDelegate = closeCombo;
dropDown = new ToolStripDropDown ( );
dropDown.Items.Add ( treeViewHost );
dropDown.AutoClose = true;
this.DropDownStyle = ComboBoxStyle.DropDownList;
dropDown.Closed += new ToolStripDropDownClosedEventHandler ( DropDownClosed );
this.EnabledChanged += new EventHandler ( ExtenderCombo_EnabledChanged );
closeCombo ( );
} catch ( Exception ex ) {
MessageBox.Show ( ex.Message );
}
}
开发者ID:camalot,项目名称:droidexplorer,代码行数:25,代码来源:ComboBoxEx.cs
示例6: SuggestionDropdownController
/// <summary>
/// Constructor
/// </summary>
public SuggestionDropdownController(Control content)
{
if (content == null)
{
throw new ArgumentNullException("content");
}
Content = content;
Content.Location = Point.Empty;
m_host = new ToolStripControlHost(Content);
// NB: AutoClose must be set to false, because otherwise the ToolStripManager would steal keyboard events
AutoClose = false;
// we do ourselves the sizing
AutoSize = false;
DoubleBuffered = true;
ResizeRedraw = false;
Padding = Margin = m_host.Padding = m_host.Margin = Padding.Empty;
// we adjust the size according to the contents
MinimumSize = Content.MinimumSize;
content.MinimumSize = Content.Size;
MaximumSize = Content.MaximumSize;
content.MaximumSize = Content.Size;
Size = Content.Size;
TabStop = Content.TabStop = true;
// set up the content
Items.Add(m_host);
// we must listen to mouse events for "emulating" AutoClose
Application.AddMessageFilter(this);
}
开发者ID:nehezbegar,项目名称:Library_Enterprise_University_Project,代码行数:31,代码来源:SuggestionDropdownController.cs
示例7: SetDesignerActionPanel
public void SetDesignerActionPanel(DesignerActionPanel panel, Glyph relatedGlyph)
{
if ((this._panel == null) || (panel != ((DesignerActionPanel) this._panel.Control)))
{
this.relatedGlyph = relatedGlyph;
panel.SizeChanged += new EventHandler(this.PanelResized);
if (this._panel != null)
{
this.Items.Remove(this._panel);
this._panel.Dispose();
this._panel = null;
}
this._panel = new ToolStripControlHost(panel);
this._panel.Margin = Padding.Empty;
this._panel.Size = panel.Size;
base.SuspendLayout();
base.Size = panel.Size;
this.Items.Add(this._panel);
base.ResumeLayout();
if (base.Visible)
{
this.CheckFocusIsRight();
}
}
}
开发者ID:Reegenerator,项目名称:Sample-CustomizeDatasetCS,代码行数:25,代码来源:DesignerActionToolStripDropDown.cs
示例8: Init
void Init(object sender, EventArgs e)
{
try {
hexEditControl.Initializing = true;
if (loaded)
return;
loaded = true;
tbSizeToFit.Text = StringParser.Parse(tbSizeToFit.Text);
ToolStripControlHost bytesPerLine = new ToolStripControlHost(tSTBCharsPerLine);
this.toolStrip1.Items.Insert(1, bytesPerLine);
this.toolStrip1.Items.Insert(3, tCBViewMode);
hexEditControl.BytesPerLine = Settings.BytesPerLine;
tSTBCharsPerLine.Text = hexEditControl.BytesPerLine.ToString();
this.hexEditControl.ContextMenuStrip = MenuService.CreateContextMenu(this.hexEditControl, "/AddIns/HexEditor/Editor/ContextMenu");
tCBViewMode.SelectedIndex = 0;
tCBViewMode.SelectedItem = Settings.ViewMode.ToString();
hexEditControl.ViewMode = Settings.ViewMode;
tbSizeToFit.Checked = hexEditControl.FitToWindowWidth = Settings.FitToWidth;
tSTBCharsPerLine.Enabled = !Settings.FitToWidth;
hexEditControl.Invalidate();
} finally {
hexEditControl.Initializing = false;
}
}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:30,代码来源:HexEditContainer.cs
示例9: PoperContainer
public PoperContainer(Control popedControl)
{
InitializeComponent();
if (popedControl == null)
throw new ArgumentNullException("content");
this.m_popedContainer = popedControl;
this.m_fade = SystemInformation.IsMenuAnimationEnabled && SystemInformation.IsMenuFadeEnabled;
this.m_host = new ToolStripControlHost(popedControl);
m_host.AutoSize = false;//make it take the same room as the poped control
Padding = Margin = m_host.Padding = m_host.Margin = Padding.Empty;
popedControl.Location = Point.Empty;
this.Items.Add(m_host);
popedControl.Disposed += delegate(object sender, EventArgs e)
{
popedControl = null;
Dispose(true);// this popup container will be disposed immediately after disposion of the contained control
};
}
开发者ID:hhergeth,项目名称:RisenEditor,代码行数:26,代码来源:PoperContainer.cs
示例10: Constructor
public void Constructor ()
{
Control t = new Control ();
ToolStripControlHost tsi = new ToolStripControlHost (t);
Assert.AreEqual (SystemColors.Control, tsi.BackColor, "A1");
Assert.AreEqual (null, tsi.BackgroundImage, "A2");
Assert.AreEqual (ImageLayout.Tile, tsi.BackgroundImageLayout, "A3");
Assert.AreEqual (true, tsi.CanSelect, "A4");
Assert.AreEqual (true, tsi.CausesValidation, "A5");
Assert.AreSame (t, tsi.Control, "A6");
Assert.AreEqual (ContentAlignment.MiddleCenter, tsi.ControlAlign, "A7");
Assert.AreEqual (true, tsi.Enabled, "A8");
Assert.AreEqual (false, tsi.Focused, "A9");
Assert.AreEqual (t.Font, tsi.Font, "A10");
Assert.AreEqual (SystemColors.ControlText, tsi.ForeColor, "A11");
Assert.AreEqual (RightToLeft.No, tsi.RightToLeft, "A12");
Assert.AreEqual (false, tsi.Selected, "A13");
Assert.AreEqual (null, tsi.Site, "A14");
Assert.AreEqual (new Size (0, 0), tsi.Size, "A15");
Assert.AreEqual (string.Empty, tsi.Text, "A16");
tsi = new ToolStripControlHost (t, "Bob");
Assert.AreEqual ("Bob", tsi.Name, "A17");
Assert.AreSame (t, tsi.Control, "A18");
Assert.AreEqual (string.Empty, tsi.Control.Name, "A19");
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:27,代码来源:ToolStripControlHostTest.cs
示例11: HexEditContainer
public HexEditContainer()
{
InitializeComponent();
tbSizeToFit.Text = StringParser.Parse(tbSizeToFit.Text);
ToolStripControlHost bytesPerLine = new ToolStripControlHost(tSTBCharsPerLine);
this.toolStrip1.Items.Insert(1, bytesPerLine);
ToolStripControlHost viewMode = new ToolStripControlHost(tCBViewMode);
this.toolStrip1.Items.Insert(3, viewMode);
tSTBCharsPerLine.Text = hexEditControl.BytesPerLine.ToString();
this.hexEditControl.ContextMenuStrip = MenuService.CreateContextMenu(this.hexEditControl, "/AddIns/HexEditor/Editor/ContextMenu");
tCBViewMode.SelectedIndex = 0;
tSTBCharsPerLine.Value = Settings.BytesPerLine;
tCBViewMode.SelectedItem = Settings.ViewMode.ToString();
hexEditControl.ViewMode = Settings.ViewMode;
hexEditControl.BytesPerLine = Settings.BytesPerLine;
tbSizeToFit.Checked = hexEditControl.FitToWindowWidth = Settings.FitToWidth;
tSTBCharsPerLine.Enabled = !Settings.FitToWidth;
hexEditControl.Invalidate();
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:25,代码来源:HexEditContainer.cs
示例12: PopupEditorHost
public PopupEditorHost(Control control,
int left, int top, int width, int height,
Func<Control, object> getControlValue,
Action<object> onValueUpdated)
: this()
{
this.getControlValue = getControlValue;
this.onValueUpdated = onValueUpdated;
Content = control;
Margin = Padding.Empty;
Padding = Padding.Empty;
//AutoSize = true;
Width = width;
Height = height;
Left = left;
Top = top;
Content.Dock = DockStyle.Fill;
BindContentHandlers();
var host = new ToolStripControlHost(Content)
{
Margin = Padding.Empty,
Padding = Padding.Empty,
AutoSize = false,
Width = width,
Height = height
};
Items.Add(host);
Opened += (sender, e) => Content.Focus();
}
开发者ID:suspended,项目名称:TradeSharp,代码行数:32,代码来源:PopupEditorHost.cs
示例13: PopupWindow
public PopupWindow(ColorPopup content)
{
if (content == null)
{
throw new ArgumentNullException("content");
}
this.content = content;
this.AutoSize = false;
this.DoubleBuffered = true;
this.ResizeRedraw = true;
//create a host that will host the content
host = new ToolStripControlHost(content);
this.Padding = Margin = host.Padding = host.Margin = Padding.Empty;
this.MinimumSize = content.MinimumSize;
content.MinimumSize = content.Size;
MaximumSize = new Size(content.Size.Width + 1, content.Size.Height + 1);
content.MaximumSize = new Size(content.Size.Width + 1, content.Size.Height + 1);
Size = new Size(content.Size.Width + 1, content.Size.Height + 1);
content.Location = Point.Empty;
//add the host to the list
Items.Add(host);
}
开发者ID:anddudek,项目名称:anjlab.fx,代码行数:25,代码来源:ColorComboBox.cs
示例14: FormSagCarinaMission_Load
private void FormSagCarinaMission_Load(object sender, EventArgs e)
{
pickerStart = new DateTimePicker();
pickerStop = new DateTimePicker();
host1 = new ToolStripControlHost(pickerStart);
toolStrip1.Items.Add(host1);
host2 = new ToolStripControlHost(pickerStop);
toolStrip1.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);
AddImages();
WindowState = FormWindowState.Maximized;
toolStripComboBox1.Items.Clear();
foreach (FGEImage img in fgeimages)
{
toolStripComboBox1.Items.Add(img.FileName);
}
toolStripComboBox1.SelectedIndex = 0;
toolStripComboBoxTime.SelectedIndex = 0;
}
开发者ID:lukepfeiffer10,项目名称:EDDiscovery,代码行数:29,代码来源:FormSagCarinaMission.cs
示例15: Popup
/// <summary>
/// Initializes a new instance of the <see cref="PopupControl.Popup"/> class.
/// </summary>
/// <param name="content">The content of the pop-up.</param>
/// <remarks>
/// Pop-up will be disposed immediately after disposion of the content control.
/// </remarks>
/// <exception cref="T:System.ArgumentNullException"><paramref name="content" /> is <code>null</code>.</exception>
public Popup(Control content)
{
if (content == null)
throw new ArgumentNullException("content");
Content = content;
FocusOnOpen = true;
AcceptAlt = true;
ShowingAnimation = PopupAnimations.SystemDefault;
HidingAnimation = PopupAnimations.None;
AnimationDuration = 100;
InitializeComponent();
AutoSize = false;
DoubleBuffered = true;
ResizeRedraw = true;
_host = new ToolStripControlHost(content);
Padding = Margin = _host.Padding = _host.Margin = Padding.Empty;
if (NativeMethods.IsRunningOnMono) content.Margin = Padding.Empty;
MinimumSize = content.MinimumSize;
content.MinimumSize = content.Size;
MaximumSize = content.MaximumSize;
content.MaximumSize = content.Size;
Size = content.Size;
if (NativeMethods.IsRunningOnMono) _host.Size = content.Size;
TabStop = content.TabStop = true;
content.Location = Point.Empty;
Items.Add(_host);
content.Disposed += (sender, e) =>
{
content = null;
Dispose(true);
};
content.RegionChanged += (sender, e) => UpdateRegion();
content.Paint += (sender, e) => PaintSizeGrip(e);
UpdateRegion();
}
开发者ID:rmbzlib,项目名称:mcskin3d,代码行数:43,代码来源:Popup.cs
示例16: UndoButton
public UndoButton()
{
// Initialize the custom control
m_dropControl = new UndoDropDownControl()
{
MinimumSize = new Size(SetWidth, SetHeight) // <- important
};
m_dropControl.ItemChosen += m_dropControl_ItemChosen;
// ...hosted by a ToolStripControlHost
m_toolHost = new ToolStripControlHost(m_dropControl)
{
Size = new Size(SetWidth, SetHeight),
Margin = new Padding(0)
};
// ... and shown in a ToolStripDropDown.
m_toolDrop = new ToolStripDropDown()
{
Padding = new Padding(0)
};
m_toolDrop.Items.Add(m_toolHost);
this.DisplayStyle = ToolStripItemDisplayStyle.Image;
this.BackgroundImageLayout = ImageLayout.Stretch;
// There is no OnDropDownOpening to override, so I guess we have to do it this way.
this.DropDownOpening += UndoButton_DropDownOpening;
}
开发者ID:Jchuchla,项目名称:vixen,代码行数:29,代码来源:UndoButton.cs
示例17: OnControlChanged
private void OnControlChanged(EventArgs e)
{
if (this.host != null) {
this.host.Dispose();
this.host = null;
}
if (this.control != null) {
this.AutoSize = true;
//
this.host = new ToolStripControlHost(this.control);
this.SuspendLayout();
// host
// this.host.AutoSize = true;
this.host.Margin = new Padding(0);
this.host.Padding = new Padding(SystemInformation.Border3DSize.Width);
// DateTimePickerPopup
this.AutoSize = true;
// this.AutoClose = false;
base.Items.Add(this.host);
this.Padding = Padding.Empty;
this.TabStop = false;
// Force a rescale?! Removing these lines causes containing control doesnt scale well!
// (Is there any better way to do that?)
System.Drawing.Font font = this.Font;
this.Font = System.Drawing.SystemFonts.DefaultFont;
this.Font = font;
this.ResumeLayout(true);
}
}
开发者ID:bspkrs,项目名称:screenrecorder,代码行数:30,代码来源:ControlHostDropDown.cs
示例18: FwPopup
/// ------------------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="FwPopup"/> class.
/// </summary>
/// ------------------------------------------------------------------------------------
public FwPopup()
{
InitializeComponent();
base.DoubleBuffered = true;
if (DesignMode)
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;
m_owningDropDown = new ToolStripDropDown();
m_owningDropDown.Padding = Padding.Empty;
m_owningDropDown.AutoSize = false;
m_owningDropDown.LayoutStyle = ToolStripLayoutStyle.Table;
m_owningDropDown.Size = Size;
m_owningDropDown.Items.Add(m_host);
m_owningDropDown.VisibleChanged += m_owningDropDown_VisibleChanged;
m_owningDropDown.Opened += m_owningDropDown_Opened;
m_owningDropDown.Closed += m_owningDropDown_Closed;
m_owningDropDown.Opening += m_owningDropDown_Opening;
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:33,代码来源:FwPopup.cs
示例19: NewPopup
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;
}
开发者ID:Shaykh,项目名称:Loyc,代码行数:8,代码来源:MainForm.cs
示例20: TimeManagementToolStrip
/// <summary>
///
/// </summary>
public TimeManagementToolStrip()
{
InitializeComponent();
this.Enabled = false;
_host = new ToolStripControlHost(trackBarSpeed);
this.Items.Add(_host);
}
开发者ID:redrhino,项目名称:DotNetConnectTerminal,代码行数:12,代码来源:TimeManagementToolStrip.cs
注:本文中的System.Windows.Forms.ToolStripControlHost类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论