本文整理汇总了C#中System.Windows.Forms.Control类的典型用法代码示例。如果您正苦于以下问题:C# Control类的具体用法?C# Control怎么用?C# Control使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Control类属于System.Windows.Forms命名空间,在下文中一共展示了Control类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EventHandler
public void EventHandler(Control ctrl)
{
ctrl.MouseMove += new MouseEventHandler(OnMouseMove);
ctrl.MouseDown += new MouseEventHandler(OnMouseDown);
ctrl.MouseUp +=new MouseEventHandler(OnMouseUp);
ctrl.MouseDoubleClick += new MouseEventHandler(OnMouseDoubleClick);
}
示例2: BuildDirPanel
protected TextBox BuildDirPanel(Control parent, String name)
{
Panel panel = new Panel();
panel.Dock = DockStyle.Top;
panel.Height = 60;
Label l = new Label();
l.Location = new Point(0, 0);
l.Dock = DockStyle.Left;
l.Text = name;
l.AutoSize = true;
panel.Controls.Add(l);
TextBox textBox = new TextBox();
textBox.Location = new Point(10, 20);
textBox.Width = ((ICustPanel)this).PreferredSize.Width - 40;
panel.Controls.Add(textBox);
// Don't have a reasonable directory browser and don't feel
// like doing the P/Invoke for the underlying one. Sigh.
/*****
Button b = new Button();
b.Location = new Point(120, 20);
b.Width = 20;
b.Text = "...";
b.Tag = textBox;
b.Click += new EventHandler(DirButtonClicked);
panel.Controls.Add(b);
*****/
parent.Controls.Add(panel);
return textBox;
}
示例3: ViewContext
/// <summary>
/// Initialize a new instance of the ViewContext class.
/// </summary>
/// <param name="manager">Reference to the view manager.</param>
/// <param name="control">Control associated with rendering.</param>
/// <param name="alignControl">Control used for aligning elements.</param>
/// <param name="renderer">Rendering provider.</param>
public ViewContext(ViewManager manager,
Control control,
Control alignControl,
IRenderer renderer)
: this(manager, control, alignControl, null, renderer)
{
}
示例4: BrowseForFile
protected void BrowseForFile(Control target, string filter, TextBoxEditMode textBoxEditMode)
{
if (target == null) {
throw new ArgumentNullException("target");
}
new BrowseButtonEvent(this, target, filter, textBoxEditMode).Event(null, null);
}
示例5: RtlTransform
public static Rectangle RtlTransform(Control control, Rectangle rectangle)
{
if (control.RightToLeft != RightToLeft.Yes)
return rectangle;
else
return new Rectangle(control.ClientRectangle.Right - rectangle.Right, rectangle.Y, rectangle.Width, rectangle.Height);
}
示例6: modello770TelematicoUCLoad
private void modello770TelematicoUCLoad(object sender, EventArgs e)
{
_listaRitenute = getRitenuteVersateService().GetLista(_condominio);
getRitenuteVersateService().SearchComplete += modello770TelematicoUCSearchComplete;
getRitenuteVersateService().SetAnno(DateTime.Today.Year - 1);
_listaRitenute.Dock = DockStyle.Fill;
splitContainer1.Panel1.Controls.Add(_listaRitenute);
_datiCertificazioneUC = new DatiCertificazioneUC {Dock = DockStyle.Fill};
splitContainer1.Panel2.Controls.Add(_datiCertificazioneUC);
sceltaFornitoreCombo1.LoadData();
dataDichiarazione.Value = DateTime.Today;
numeroIscrizioneCaf.Value = null;
validationSummarySceltaRitenute.Validators.Add(parametersValidator);
validationSummarySceltaRitenute.Validators.Add(ritenuteValidator);
validationSummaryCreazioneFile.Validators.Add(reqFile);
validationSummaryCreazioneFile.Validators.Add(reqDataDichiarazione);
validationSummaryCreazioneFile.Validators.Add(codiceFiscaleValidator);
validationSummaryCreazioneFile.Validators.Add(codiceFiscaleIntermediarioValidator);
Clear();
}
示例7: CreateInputDevices
protected void CreateInputDevices(Control target)
{
// create keyboard device.
keyboard = new Device(SystemGuid.Keyboard);
if (keyboard == null)
{
throw new Exception("No keyboard found.");
}
// create mouse device.
mouse = new Device(SystemGuid.Mouse);
if (mouse == null)
{
throw new Exception("No mouse found.");
}
// set cooperative level.
keyboard.SetCooperativeLevel(target, CooperativeLevelFlags.NonExclusive | CooperativeLevelFlags.Background);
mouse.SetCooperativeLevel(target, CooperativeLevelFlags.NonExclusive | CooperativeLevelFlags.Background);
// Acquire devices for capturing.
keyboard.Acquire();
mouse.Acquire();
}
示例8: HostControl
public void HostControl(Control c)
{
DocumentForm frm = new DocumentForm(c);
frm.ShowHint = DockState.Document;
frm.Show(m_dockPanel);
}
示例9: Vaildate
public string Vaildate()
{
string errortxt = string.Empty;
if (this.orderkey.Text.Length == 0)
{
focusControl = this.orderkey;
errortxt += "订单号必填";
}
if (this.checkuser.Text.Length == 0)
{
if (string.IsNullOrEmpty(errortxt))
focusControl = this.checkuser;
errortxt += "拣货员必填";
}
if (this.qty.Text.Length == 0)
{
if (string.IsNullOrEmpty(errortxt))
focusControl = this.qty;
errortxt += "分拣数必填";
}
return errortxt;
}
示例10: FindParentCardView
public static CardView FindParentCardView(Control control)
{
Control parent = control.Parent;
while(parent != control.FindForm() && !(parent is CardView))
parent = parent.Parent;
return parent as CardView;
}
示例11: FindParentPlayerView
public static PlayerView FindParentPlayerView(Control control)
{
Control parent = control.Parent;
while(parent != control.FindForm() && !(parent is PlayerView))
parent = parent.Parent;
return parent as PlayerView;
}
示例12: Capture
// Zero based device index and device params and output window
public Capture(int iDeviceNum, int iWidth, int iHeight, short iBPP, Control hControl)
{
DsDevice[] capDevices;
// Get the collection of video devices
capDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
if (iDeviceNum + 1 > capDevices.Length)
{
throw new Exception("No video capture devices found at that index!");
}
try
{
// Set up the capture graph
SetupGraph(capDevices[iDeviceNum], iWidth, iHeight, iBPP, hControl);
// tell the callback to ignore new images
m_PictureReady = new ManualResetEvent(false);
}
catch
{
Dispose();
throw;
}
}
示例13: ThrowIfNotInWorkspace
/// <summary>
/// Check if control is in parent control.
/// </summary>
/// <param name="parent"></param>
/// <param name="spcontrol"></param>
public static void ThrowIfNotInWorkspace(Control parent, Control spcontrol)
{
if (parent.Controls.Contains(spcontrol) == false)
{
throw new ArgumentException(Resources.SmartPartNotInManager);
}
}
示例14: IsContainer
static public bool IsContainer(Control control)
{
return
control is TabControl ||
control is TabPage ||
control is Panel;
}
示例15: GameContext
/// <summary>
/// Initializes a new instance of the <see cref="GameContext" /> class.
/// </summary>
/// <param name="control">The control.</param>
/// <param name="requestedWidth">Width of the requested.</param>
/// <param name="requestedHeight">Height of the requested.</param>
public GameContext(Control control, int requestedWidth = 0, int requestedHeight = 0)
{
Control = control ?? new RenderForm("SharpDX Game");
RequestedWidth = requestedWidth;
RequestedHeight = requestedHeight;
ContextType = GameContextType.Desktop;
}