本文整理汇总了C#中System.Windows.Forms.Form.AddOwnedForm方法的典型用法代码示例。如果您正苦于以下问题:C# Form.AddOwnedForm方法的具体用法?C# Form.AddOwnedForm怎么用?C# Form.AddOwnedForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Form
的用法示例。
在下文中一共展示了Form.AddOwnedForm方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToolArgsDialog
public ToolArgsDialog(LogTabWindow logTabWin, Form parent)
{
this.logTabWin = logTabWin;
parent.AddOwnedForm(this);
this.TopMost = parent.TopMost;
InitializeComponent();
}
示例2: ShowForm
public static SupportingFilesForm ShowForm(Form parent, BlogPostEditingManager editingManager)
{
SupportingFilesForm supportingFilesForm = new SupportingFilesForm();
parent.AddOwnedForm(supportingFilesForm);
supportingFilesForm.Show();
Point location = parent.Location;
Size size = parent.Size;
supportingFilesForm.Location = new Point(location.X + size.Width + 2, location.Y);
supportingFilesForm.BlogPostEditingManager = editingManager;
return supportingFilesForm;
}
示例3: ShowDropDown
/// <summary>
/// Shows the specified Form as a popup window, keeping the
/// Owner's title bar active and preparing to cancel the popup
/// should the user click anywhere outside the popup window.
/// <para>Typical code to use this message is as follows:</para>
/// <code>
/// frmPopup popup = new frmPopup();
/// Point location = this.PointToScreen(new Point(button1.Left, button1.Bottom));
/// popupHelper.ShowPopup(this, popup, location);
/// </code>
/// <para>Put as much initialisation code as possible
/// into the popup form's constructor, rather than the <see cref="System.Windows.Forms.Load"/>
/// event as this will improve visual appearance.</para>
/// </summary>
/// <param name="Owner">Main form which owns the popup</param>
/// <param name="Popup">Window to show as a popup</param>
/// <param name="v">Location relative to the screen to show the popup at.</param>
public void ShowDropDown(Form Owner, Form DropDown, Point Location)
{
_owner = Owner;
_dropDown = DropDown;
Application.AddMessageFilter(_filter); // Start checking for the popup being cancelled
DropDown.StartPosition = FormStartPosition.Manual; // Set the location of the popup form:
DropDown.Location = Location;
Owner.AddOwnedForm(DropDown); // Make it owned by the window that's displaying it:
DropDownClosedHandler = new EventHandler(Popup_Closed); // Respond to the Closed event in case the popup is closed by its own internal means
DropDown.Closed += DropDownClosedHandler;
_dropDownShowing = true; // Show the popup:
DropDown.Show();
DropDown.Activate();
// A little bit of fun. We've shown the popup, but because we've kept the main window's
// title bar in focus the tab sequence isn't quite right. This can be fixed by sending a tab,
// but that on its own would shift focus to the second control in the form. So send a tab,
// followed by a reverse-tab.
UIApiCalls.keybd_event((byte) Keys.Tab, 0, 0, 0);
UIApiCalls.keybd_event((byte) Keys.Tab, 0, UIApiCalls.KEYEVENTF_KEYUP, 0);
UIApiCalls.keybd_event((byte) Keys.ShiftKey, 0, 0, 0);
UIApiCalls.keybd_event((byte) Keys.Tab, 0, 0, 0);
UIApiCalls.keybd_event((byte) Keys.Tab, 0, UIApiCalls.KEYEVENTF_KEYUP, 0);
UIApiCalls.keybd_event((byte) Keys.ShiftKey, 0, UIApiCalls.KEYEVENTF_KEYUP, 0);
_filter.DropDown = DropDown; // Start filtering for mouse clicks outside the popup
}
示例4: TestPublicMethods
//.........这里部分代码省略.........
c = new Form ();
c.Refresh ();
Assert.IsFalse (c.IsHandleCreated, "A22");
c.ResetBackColor ();
Assert.IsFalse (c.IsHandleCreated, "A23");
c.ResetBindings ();
Assert.IsFalse (c.IsHandleCreated, "A24");
c.ResetCursor ();
Assert.IsFalse (c.IsHandleCreated, "A25");
c.ResetFont ();
Assert.IsFalse (c.IsHandleCreated, "A26");
c.ResetForeColor ();
Assert.IsFalse (c.IsHandleCreated, "A27");
c.ResetImeMode ();
Assert.IsFalse (c.IsHandleCreated, "A28");
c.ResetRightToLeft ();
Assert.IsFalse (c.IsHandleCreated, "A29");
c.ResetText ();
Assert.IsFalse (c.IsHandleCreated, "A30");
c.SuspendLayout ();
Assert.IsFalse (c.IsHandleCreated, "A31");
c.ResumeLayout ();
Assert.IsFalse (c.IsHandleCreated, "A32");
c.Scale (new SizeF (1.5f, 1.5f));
Assert.IsFalse (c.IsHandleCreated, "A33");
c.Select ();
Assert.IsTrue (c.IsHandleCreated, "A34");
c.Dispose ();
c = new Form ();
c.SelectNextControl (new Control (), true, true, true, true);
Assert.IsFalse (c.IsHandleCreated, "A35");
c.SetBounds (0, 0, 100, 100);
Assert.IsFalse (c.IsHandleCreated, "A36");
c.Update ();
Assert.IsFalse (c.IsHandleCreated, "A37");
// Form
c.Activate ();
Assert.IsFalse (c.IsHandleCreated, "F1");
c.AddOwnedForm (new Form ());
Assert.IsFalse (c.IsHandleCreated, "F2");
c.Close ();
Assert.IsFalse (c.IsHandleCreated, "F3");
c.Hide ();
Assert.IsFalse (c.IsHandleCreated, "F4");
c.LayoutMdi (MdiLayout.Cascade);
Assert.IsFalse (c.IsHandleCreated, "F5");
#if !MONO
c.PerformAutoScale ();
Assert.IsFalse (c.IsHandleCreated, "F6");
#endif
c.PerformLayout ();
Assert.IsFalse (c.IsHandleCreated, "F7");
c.AddOwnedForm (new Form ());
c.RemoveOwnedForm (c.OwnedForms [c.OwnedForms.Length - 1]);
Assert.IsFalse (c.IsHandleCreated, "F8");
c.ScrollControlIntoView (null);
Assert.IsFalse (c.IsHandleCreated, "F9");
c.SetAutoScrollMargin (7, 13);
Assert.IsFalse (c.IsHandleCreated, "F10");
c.SetDesktopBounds (-1, -1, 144, 169);
Assert.IsFalse (c.IsHandleCreated, "F11");
c.SetDesktopLocation (7, 13);
Assert.IsFalse (c.IsHandleCreated, "F12");
c = new Form ();
c.Show (null);
Assert.IsTrue (c.IsHandleCreated, "F13");
c.Close ();
c = new Form ();
//c.ShowDialog ()
c.ToString ();
Assert.IsFalse (c.IsHandleCreated, "F14");
c.Validate ();
Assert.IsFalse (c.IsHandleCreated, "F15");
#if !MONO
c.ValidateChildren ();
Assert.IsFalse (c.IsHandleCreated, "F16");
#endif
c.Close ();
}
示例5: ShowPopup
/// <summary>
/// Shows the specified Form as a popup window, keeping the
/// Owner's title bar active and preparing to cancel the popup
/// should the user click anywhere outside the popup window.
/// <para>Typical code to use this message is as follows:</para>
/// <code>
/// frmPopup popup = new frmPopup();
/// Point location = this.PointToScreen(new Point(button1.Left, button1.Bottom));
/// popupHelper.ShowPopup(this, popup, location);
/// </code>
/// <para>Put as much initialisation code as possible
/// into the popup form's constructor, rather than the <see cref="System.Windows.Forms.Load"/>
/// event as this will improve visual appearance.</para>
/// </summary>
/// <param name="owner">Main form which owns the popup</param>
/// <param name="popup">Window to show as a popup</param>
/// <param name="location">Location relative to the screen to show the popup at.</param>
public void ShowPopup(Form owner, Form popup, Point location)
{
this.owner = owner;
this.popup = popup;
// Start checking for the popup being cancelled
Application.AddMessageFilter(filter);
// Set the location of the popup form:
popup.StartPosition = FormStartPosition.Manual;
popup.Location = location;
// Make it owned by the window that's displaying it:
owner.AddOwnedForm(popup);
// Respond to the Closed event in case the popup
// is closed by its own internal means
popClosedHandler = new EventHandler(popup_Closed);
popup.Closed += popClosedHandler;
// Show the popup:
this.popupShowing = true;
popup.Show();
popup.Activate();
// A little bit of fun. We've shown the popup,
// but because we've kept the main window's
// title bar in focus the tab sequence isn't quite
// right. This can be fixed by sending a tab,
// but that on its own would shift focus to the
// second control in the form. So send a tab,
// followed by a reverse-tab.
// Send a Tab command:
NativeMethods.keybd_event((byte)Keys.Tab, 0, 0, 0);
NativeMethods.keybd_event((byte)Keys.Tab, 0, NativeMethods.KEYEVENTF_KEYUP, 0);
// Send a reverse Tab command:
NativeMethods.keybd_event((byte)Keys.ShiftKey, 0, 0, 0);
NativeMethods.keybd_event((byte)Keys.Tab, 0, 0, 0);
NativeMethods.keybd_event((byte)Keys.Tab, 0, NativeMethods.KEYEVENTF_KEYUP, 0);
NativeMethods.keybd_event((byte)Keys.ShiftKey, 0, NativeMethods.KEYEVENTF_KEYUP, 0);
// Start filtering for mouse clicks outside the popup
filter.Popup = popup;
}
示例6: PreviewReport
/// <summary>
/// Called after the calculation of the report has been finished.
/// </summary>
/// <param name="Calculator"></param>
/// <param name="ACallerForm"></param>
/// <param name="AReportName"></param>
/// <param name="AWrapColumn"></param>
public static void PreviewReport(TRptCalculator Calculator, Form ACallerForm, String AReportName, bool AWrapColumn)
{
// Create a print window with all kinds of output options
TFrmPrintPreview printWindow = new TFrmPrintPreview(ACallerForm, AReportName, Calculator.GetDuration(),
Calculator.GetResults(), Calculator.GetParameters(), AWrapColumn, Calculator);
ACallerForm.AddOwnedForm(printWindow);
printWindow.Owner = ACallerForm;
// TODO printWindow.SetPrintChartProcedure(GenerateChart);
printWindow.ShowDialog();
}
示例7: StereoDualHeadDisplay
/// <summary>
///
/// </summary>
/// <param name="parameters"></param>
public StereoDualHeadDisplay( Game game, GraphicsDevice device, GraphicsParameters parameters ) : base( game, device, parameters )
{
try {
NvApi.Initialize();
NvApi.Stereo_Disable();
}
catch (NVException nvex) {
Log.Debug(nvex.Message);
}
var featureLevel = HardwareProfileChecker.GetFeatureLevel( parameters.GraphicsProfile );
Adapter adapter;
Output leftOut, rightOut;
GetDualHeadAdapter( featureLevel, out adapter, out leftOut, out rightOut );
window1 = CreateForm( parameters, leftOut );
window2 = CreateForm( parameters, rightOut );
window1.Tag = leftOut.Description;
window2.Tag = rightOut.Description;
window1.AddOwnedForm( window2 );
window2.Show();
window1.Show();
window1.Resize += window_Resize;
window2.Resize += window_Resize;
window1.Move += window_Move;
window2.Move += window_Move;
window1.Activated += window_Activated;
window2.Activated += window_Activated;
targetForm = window1;
var deviceFlags = DeviceCreationFlags.None;
deviceFlags |= parameters.UseDebugDevice ? DeviceCreationFlags.Debug : DeviceCreationFlags.None;
swapChainDesc1 = new SwapChainDescription () {
BufferCount = 1,
ModeDescription = new ModeDescription( parameters.Width, parameters.Height, new Rational(60, 1), Format.R8G8B8A8_UNorm ),
IsWindowed = true,
OutputHandle = window1.Handle,
SampleDescription = new SampleDescription(parameters.MsaaLevel, 0),
SwapEffect = SwapEffect.Discard,
Usage = Usage.RenderTargetOutput,
Flags = SwapChainFlags.None,
};
swapChainDesc2 = new SwapChainDescription () {
BufferCount = 1,
ModeDescription = new ModeDescription( parameters.Width, parameters.Height, new Rational(60, 1), Format.R8G8B8A8_UNorm ),
IsWindowed = true,
OutputHandle = window2.Handle,
SampleDescription = new SampleDescription(parameters.MsaaLevel, 0),
SwapEffect = SwapEffect.Discard,
Usage = Usage.RenderTargetOutput,
Flags = SwapChainFlags.None,
};
d3dDevice = new D3D.Device( adapter, deviceFlags, featureLevel );
using ( var factory = adapter.GetParent<Factory>() ) {
swapChain1 = new SwapChain( factory, d3dDevice, swapChainDesc1 );
swapChain2 = new SwapChain( factory, d3dDevice, swapChainDesc2 );
//factory.MakeWindowAssociation( new IntPtr(0), WindowAssociationFlags.None );
factory.MakeWindowAssociation( window1.Handle, WindowAssociationFlags.IgnoreAll | WindowAssociationFlags.IgnoreAltEnter );
factory.MakeWindowAssociation( window2.Handle, WindowAssociationFlags.IgnoreAll | WindowAssociationFlags.IgnoreAltEnter );
}
clientWidth = window1.ClientSize.Width;
clientHeight = window1.ClientSize.Height;
}
示例8: AddOwnedFormTest
public void AddOwnedFormTest ()
{
Form parent = new Form ();
parent.ShowInTaskbar = false;
parent.Text = "NewParent";
Form ownedForm = new Form ();
ownedForm.ShowInTaskbar = false;
ownedForm.Text = "Owned Form";
parent.AddOwnedForm (ownedForm);
ownedForm.Show ();
Assert.AreEqual ("NewParent", ownedForm.Owner.Text, "#41");
ownedForm.Dispose ();
parent.Dispose ();
}