本文整理汇总了C#中System.Windows.Forms.Form.CreateControl方法的典型用法代码示例。如果您正苦于以下问题:C# Form.CreateControl方法的具体用法?C# Form.CreateControl怎么用?C# Form.CreateControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Form
的用法示例。
在下文中一共展示了Form.CreateControl方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUpFixture
public void SetUpFixture()
{
Form parentForm = new Form();
parentForm.CreateControl();
XmlSchemaCompletionData schema = new XmlSchemaCompletionData(ResourceManager.GetXhtmlStrictSchema());
XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
schemas.Add(schema);
provider = new XmlCompletionDataProvider(schemas, schema, String.Empty);
TextEditorControl textEditor = new TextEditorControl();
completionDataItems = provider.GenerateCompletionData(@"C:\Test.xml", textEditor.ActiveTextAreaControl.TextArea, '<');
using (CodeCompletionWindow completionWindow = CodeCompletionWindow.ShowCompletionWindow(parentForm, textEditor, @"C:\Test.xml", provider, '<')) {
CodeCompletionListView listView = (CodeCompletionListView)completionWindow.Controls[0];
selectedCompletionData = listView.SelectedCompletionData;
completionWindow.Close();
}
}
示例2: ShowHelpTopic
//=====================================================================
/// <summary>
/// Show a help topic in the SHFB help file
/// </summary>
/// <param name="topic">The topic ID to display (will be formatted as "html/[Topic_ID].htm")</param>
/// <remarks>Since the standalone GUI already has a Help 1 file, we'll just display the topic
/// that it contains rather than integrating an MSHC help file into the VS 2010 collection.</remarks>
public static void ShowHelpTopic(string topic)
{
string path = null, anchor = String.Empty;
int pos;
if(String.IsNullOrEmpty(topic))
throw new ArgumentException("A topic must be specified", "topic");
try
{
path = Path.Combine(ComponentUtilities.ToolsFolder, @"Help\SandcastleBuilder.chm");
// It may not be there in development builds so look in the release folder. If still not found,
// just ignore it.
if(!File.Exists(path))
{
path = Path.Combine(Environment.GetFolderPath(Environment.Is64BitProcess ?
Environment.SpecialFolder.ProgramFilesX86 : Environment.SpecialFolder.ProgramFiles),
@"EWSoftware\Sandcastle Help File Builder\Help\SandcastleBuilder.chm");
if(!File.Exists(path))
return;
}
// If there's an anchor, split it off
pos = topic.IndexOf('#');
if(pos != -1)
{
anchor = topic.Substring(pos);
topic = topic.Substring(0, pos);
}
Form form = new Form();
form.CreateControl();
Help.ShowHelp(form, path, HelpNavigator.Topic, "html/" + topic + ".htm" + anchor);
}
catch(Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
示例3: GenerateSettingsAndHost
private static GameSettings GenerateSettingsAndHost()
{
if (hiddenHost == null)
{
hiddenHost = new Form();
hiddenHost.Width = 4;
hiddenHost.Height = 4;
hiddenHost.Visible = false;
hiddenHost.CreateControl();
DeviceHandle = hiddenHost.Handle;
}
var result = new GameSettings();
result.FullScreen = false;
result.ResolutionWidth = 4;
result.ResolutionHeight = 4;
return result;
}
示例4: btnHelp_Click
/// <summary>
/// View help for this form
/// </summary>
/// <param name="sender">The sender of the event</param>
/// <param name="e">The event arguments</param>
private void btnHelp_Click(object sender, EventArgs e)
{
string path = Path.GetDirectoryName(
Assembly.GetExecutingAssembly().Location);
try
{
#if DEBUG
path += @"\..\..\..\Doc\Help\SandcastleBuilder.chm";
#else
path += @"\SandcastleBuilder.chm";
#endif
Form form = new Form();
form.CreateControl();
Help.ShowHelp(form, path, HelpNavigator.Topic,
"html/7d28bf8f-923f-44c1-83e1-337a416947a1.htm#HelpAttributes");
}
catch(Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
MessageBox.Show(String.Format(CultureInfo.CurrentCulture,
"Unable to open help file '{0}'. Reason: {1}",
path, ex.Message), Constants.AppName,
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
示例5: TestSetup
public void TestSetup()
{
m_ctrlOwner = new Form();
m_scp = new DummyScrPassageControl(new ScrReference(01001001, ScrVers.English));
m_filteredScp = new DummyScrPassageControl(new ScrReference(01001001, ScrVers.English));
m_filteredScp.Initialize(m_filteredScp.ScReference, new [] {57, 59, 65});
m_ctrlOwner.Controls.Add(m_scp);
m_ctrlOwner.Controls.Add(m_filteredScp);
m_ctrlOwner.CreateControl();
if (m_scp.DropDownWindow != null)
m_scp.DropDownWindow.Close();
if (m_filteredScp.DropDownWindow != null)
m_filteredScp.DropDownWindow.Close();
}
示例6: GetHelpParentWindow
/// <summary>
/// Hack to get around the fact that Help.ShowHelp can make the help window
/// modal over the application window
/// </summary>
private Form GetHelpParentWindow()
{
if (_agsEditor.Preferences.KeepHelpOnTop)
{
return Form.ActiveForm;
}
if (_dummyHelpForm == null)
{
_dummyHelpForm = new Form();
_dummyHelpForm.CreateControl();
}
return _dummyHelpForm;
}
示例7: TestPublicMethods
public void TestPublicMethods ()
{
// Public Methods that force Handle creation:
// - CreateGraphics ()
// - GetChildAtPoint ()
// - Invoke, BeginInvoke throws InvalidOperationException if Handle has not been created
// - PointToClient ()
// - PointToScreen ()
// - RectangleToClient ()
// - RectangleToScreen ()
// - Select ()
// - Show (IWin32Window)
// Notes:
// - CreateControl does NOT force Handle creation!
Form c = new Form ();
c.BringToFront ();
Assert.IsFalse (c.IsHandleCreated, "A1");
c.Contains (new Form ());
Assert.IsFalse (c.IsHandleCreated, "A2");
c.CreateControl ();
Assert.IsFalse (c.IsHandleCreated, "A3");
c = new Form ();
Graphics g = c.CreateGraphics ();
g.Dispose ();
Assert.IsTrue (c.IsHandleCreated, "A4");
c.Dispose ();
c = new Form ();
c.Dispose ();
Assert.IsFalse (c.IsHandleCreated, "A5");
c = new Form ();
// This is weird, it causes a form to appear that won't go away until you move the mouse over it,
// but it doesn't create a handle??
//DragDropEffects d = c.DoDragDrop ("yo", DragDropEffects.None);
//Assert.IsFalse (c.IsHandleCreated, "A6");
//Assert.AreEqual (DragDropEffects.None, d, "A6b");
//Bitmap b = new Bitmap (100, 100);
//c.DrawToBitmap (b, new Rectangle (0, 0, 100, 100));
//Assert.IsFalse (c.IsHandleCreated, "A7");
//b.Dispose ();
c.FindForm ();
Assert.IsFalse (c.IsHandleCreated, "A8");
c.Focus ();
Assert.IsFalse (c.IsHandleCreated, "A9");
c.GetChildAtPoint (new Point (10, 10));
Assert.IsTrue (c.IsHandleCreated, "A10");
c.Dispose ();
c = new Form ();
c.GetContainerControl ();
Assert.IsFalse (c.IsHandleCreated, "A11");
c.Dispose ();
c = new Form ();
c.GetNextControl (new Control (), true);
Assert.IsFalse (c.IsHandleCreated, "A12");
c.GetPreferredSize (Size.Empty);
Assert.IsFalse (c.IsHandleCreated, "A13");
c.Hide ();
Assert.IsFalse (c.IsHandleCreated, "A14");
c.Invalidate ();
Assert.IsFalse (c.IsHandleCreated, "A15");
//c.Invoke (new InvokeDelegate (InvokeMethod));
//Assert.IsFalse (c.IsHandleCreated, "A16");
c.PerformLayout ();
Assert.IsFalse (c.IsHandleCreated, "A17");
c.PointToClient (new Point (100, 100));
Assert.IsTrue (c.IsHandleCreated, "A18");
c.Dispose ();
c = new Form ();
c.PointToScreen (new Point (100, 100));
Assert.IsTrue (c.IsHandleCreated, "A19");
c.Dispose ();
c = new Form ();
//c.PreProcessControlMessage ???
//c.PreProcessMessage ???
c.RectangleToClient (new Rectangle (0, 0, 100, 100));
Assert.IsTrue (c.IsHandleCreated, "A20");
c.Dispose ();
c = new Form ();
c.RectangleToScreen (new Rectangle (0, 0, 100, 100));
Assert.IsTrue (c.IsHandleCreated, "A21");
c.Dispose ();
c = new Form ();
c.Refresh ();
//.........这里部分代码省略.........
示例8: TestSetup
public void TestSetup()
{
m_versification = new TestScrVers();
m_ctrlOwner = new Form();
m_scp = new DummyScrPassageControl();
m_scp.Initialize(new BCVRef(01001001), m_versification);
m_filteredScp = new DummyScrPassageControl();
m_filteredScp.Initialize(new BCVRef(01001001), m_versification, new[] { 57, 59, 65 });
m_ctrlOwner.Controls.Add(m_scp);
m_ctrlOwner.Controls.Add(m_filteredScp);
m_ctrlOwner.CreateControl();
if (m_scp.DropDownWindow != null)
m_scp.DropDownWindow.Close();
if (m_filteredScp.DropDownWindow != null)
m_filteredScp.DropDownWindow.Close();
}
示例9: Framework
public Framework(string title, int width, int height, bool depth, bool stencil, bool _VSync)
{
// Create the display to display on
Window = new Form()
{
StartPosition = FormStartPosition.CenterScreen,
ClientSize = new Size(width, height),
Text = title,
TopMost = true,
};
Window.StartPosition = FormStartPosition.Manual;
Window.Location = new Point(1100, 80);
Window.FormBorderStyle = FormBorderStyle.Fixed3D;
Window.WindowState =FormWindowState.Normal;
Window.CreateControl();
VerticalSyncEnabled = _VSync;
CreateDevice();
// Create a description of the display mode
var modeDescription = new ModeDescription()
{
Format = Format.R8G8B8A8_UNorm,
RefreshRate = new Rational(60, 1),
Scaling = DisplayModeScaling.Unspecified,
ScanlineOrdering = DisplayModeScanlineOrder.Unspecified,
Width = width,
Height = height,
};
// Create a description of the sampling for multisampling or antialiasing
var sampleDescription = new SampleDescription()
{
Count = 1,
Quality = 0,
};
// Create a description of the swap chain or front and back buffers
var swapDescription = new SwapChainDescription()
{
ModeDescription = modeDescription,
SampleDescription = sampleDescription,
BufferCount = 1,
Flags = SwapChainFlags.None,
IsWindowed = true,
OutputHandle = Window.Handle,
SwapEffect = SwapEffect.Discard,
Usage = Usage.RenderTargetOutput,
};
// Create the DirectX 11 Device
SharpDX.Direct3D11.Device.CreateWithSwapChain(SharpDX.Direct3D.DriverType.Hardware, DeviceCreationFlags.BgraSupport|DeviceCreationFlags.Debug, swapDescription, out Device, out swapChain);
DContext = Device.ImmediateContext;
// Create the factory which manages general graphics resources
// Ignore all windows events
Factory = swapChain.GetParent<Factory>();
Factory.MakeWindowAssociation(Window.Handle, WindowAssociationFlags.IgnoreAll);
Factory.Dispose();
// New RenderTargetView from the backbuffer
var backBuffer = Texture2D.FromSwapChain<Texture2D>(swapChain, 0);
RenderTargetView = new RenderTargetView(Device, backBuffer);
RenderTargetView.DebugName = "std";
// Release pointer to the back buffer as we no longer need it.
backBuffer.Dispose();
frame_width=Window.ClientSize.Width;
frame_height=Window.ClientSize.Height;
#region Zdepth
if (depth || stencil)
{
_depth=true;
var textureDescription = new Texture2DDescription()
{
Width = frame_width,
Height = frame_height,
MipLevels = 1,
ArraySize = 1,
Format = (stencil) ? Format.D32_Float : Format.D24_UNorm_S8_UInt,
SampleDescription = sampleDescription,
Usage = ResourceUsage.Default,
BindFlags = BindFlags.DepthStencil,
CpuAccessFlags = CpuAccessFlags.None,
OptionFlags = ResourceOptionFlags.None,
};
var texture = new Texture2D(Device, textureDescription);
var depthStencilViewDescription = new DepthStencilViewDescription()
{
Format = textureDescription.Format,
Dimension = DepthStencilViewDimension.Texture2DMultisampled
};
DepthStencilView = new DepthStencilView(Device, texture, depthStencilViewDescription);
DContext.OutputMerger.SetTargets(DepthStencilView, RenderTargetView);
}
else
{
DContext.OutputMerger.SetTargets(RenderTargetView);
//.........这里部分代码省略.........
示例10: CreateOutlineForm
public static System.Windows.Forms.Form CreateOutlineForm()
{
System.Windows.Forms.Form form = new System.Windows.Forms.Form();
try
{
form.Size = new Size(0, 0);
}
catch
{
form = new System.Windows.Forms.Form();
}
form.BackColor = SystemColors.Highlight;
form.MinimizeBox = false;
form.MaximizeBox = false;
form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
if (NativeFunctions.AlphaBlendingSupported)
form.Opacity = .5;
else
form.BackColor = System.Windows.Forms.ControlPaint.LightLight(SystemColors.Highlight);
form.ShowInTaskbar = false;
form.Text = "";
form.CreateControl();
return form;
}
示例11: MessagePump
private void MessagePump(object arg)
{
try {
OnThreadStarted();
Type windowType = (Type)arg;
window = (Form)windowType.Assembly.CreateInstance(windowType.FullName);
MSG m;
// Create message queue
PeekMessage(out m, IntPtr.Zero, 0, 0, PM_NOREMOVE);
// Create window and obtain its handle
window.CreateControl();
IntPtr handle = window.Handle;
// Set created event
windowCreatedEvent.Set();
// Message pump
while (GetMessage(out m, IntPtr.Zero, 0, 0)) {
TranslateMessage(ref m);
DispatchMessage(ref m);
}
}
catch (Exception e) {
FatalExceptionDialog dlg = new FatalExceptionDialog();
dlg.Exception = e;
dlg.TryToContinueEnabled = false;
dlg.ShowDialog();
dlg.Dispose();
Environment.Exit(-1);
}
finally {
// Dispose closed window
if (window != null)
window.Dispose();
}
}
示例12: Init
public void Init()
{
m_inMemoryCache = ScrInMemoryFdoCache.Create(this);
m_inMemoryCache.InitializeLangProject();
m_inMemoryCache.InitializeScripture();
m_inMemoryCache.AddBookToMockedScripture(1, "Genesis");
m_inMemoryCache.AddBookToMockedScripture(2, "Exodus");
m_inMemoryCache.AddBookToMockedScripture(5, "Deuteronomy");
m_James = m_inMemoryCache.AddBookToMockedScripture(59, "James");
m_inMemoryCache.AddBookToMockedScripture(66, "Revelation");
m_fdoCache = m_inMemoryCache.Cache;
m_scr = (Scripture)m_fdoCache.LangProject.TranslatedScriptureOA;
m_ctrlOwner = new Form();
ILgWritingSystemFactory wsf = m_fdoCache.LanguageWritingSystemFactoryAccessor;
m_scp = new DummyScrPassageControl(null, m_scr, false);
m_dbScp = new DummyScrPassageControl(null, m_scr, true);
m_ctrlOwner.Controls.Add(m_scp);
m_ctrlOwner.Controls.Add(m_dbScp);
m_ctrlOwner.CreateControl();
if (m_scp.DropDownWindow != null)
m_scp.DropDownWindow.Close();
if (m_dbScp.DropDownWindow != null)
m_dbScp.DropDownWindow.Close();
// Forcing the reference to this should reset the ScrReference object for us
// which, we hope will cause some strange errors to occur when running in
// console mode. The tests seem to always work in gui mode but not console mode.
m_scp.ScReference = new ScrReference(01001001, m_scr.Versification);
m_dbScp.ScReference = new ScrReference(01001001, m_scr.Versification);
}
示例13: miHelp_Click
/// <summary>
/// View the help file
/// </summary>
/// <param name="sender">The sender of the event</param>
/// <param name="e">The event arguments</param>
private void miHelp_Click(object sender, EventArgs e)
{
string topic, path = Path.GetDirectoryName(
Assembly.GetExecutingAssembly().Location);
try
{
#if DEBUG
path += @"\..\..\..\Doc\Help\SandcastleBuilder.chm";
#else
path += @"\SandcastleBuilder.chm";
#endif
if(sender == miHelp || sender == tsbAbout)
topic = "html/bd1ddb51-1c4f-434f-bb1a-ce2135d3a909.htm";
else
topic = "html/1aea789d-b226-4b39-b534-4c97c256fac8.htm";
Form form = new Form();
form.CreateControl();
Help.ShowHelp(form, path, HelpNavigator.Topic, topic);
}
catch(Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
MessageBox.Show(String.Format(CultureInfo.CurrentCulture,
"Unable to open help file '{0}'. Reason: {1}",
path, ex.Message), Constants.AppName,
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}