本文整理汇总了C#中System.Windows.Forms类的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Forms类的具体用法?C# System.Windows.Forms怎么用?C# System.Windows.Forms使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Windows.Forms类属于命名空间,在下文中一共展示了System.Windows.Forms类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDragDropEffect
public WinForms.DragDropEffects GetDragDropEffect(WinForms.IDataObject dragData)
{
if (this.IsValidDropTarget(dragData))
return System.Windows.Forms.DragDropEffects.Move;
else
return Tree.TreeView.NoneDragDropEffects;
}
示例2: ExitButton
public ExitButton(Vec2 loc, Vec2 size, Image parent, Forms.Form parf)
{
if (size.X == 0 || size.Y == 0)
{
throw new Exception("No dimention of size can be zero!");
}
this.X = loc.X;
this.Y = loc.Y;
this.Size = size;
this.iSize = new Vec2(size.X - 1, size.Y - 1);
this.parent = parent;
this.parForm = parf;
this.bounds = new BoundingBox(this.X, this.X + Size.X, this.Y + Size.Y, this.Y);
Click = new ObjectClick(this.ExitButtonClicked);
MouseEnter = new ObjectClick(this.ExitButtonEnter);
MouseLeave = new ObjectClick(this.ExitButtonLeave);
MouseDown = new ObjectClick(this.ExitButtonMouseDown);
MouseUp = new ObjectClick(this.ExitButtonMouseUp);
evnts = new ObjectEvents(
new ObjectClick(Click),
new ObjectClick(MouseEnter),
new ObjectClick(MouseLeave),
new ObjectClick(MouseDown),
new ObjectClick(MouseUp),
new DrawMethod(Draw),
bounds);
i = new Image(size);
this.DrawDefault();
}
示例3: GetDragDropEffect
public WinForms::DragDropEffects GetDragDropEffect(WinForms::IDataObject dragData)
{
if (IsValidDropTarget(dragData))
return WinForms::DragDropEffects.Move;
else
return TreeView.NoneDragDropEffects;
}
示例4: GetDragDropEffect
public override WinForms.DragDropEffects GetDragDropEffect(WinForms.IDataObject dragData)
{
if (this.IsValidDropTarget(dragData))
return WinForms.DragDropEffects.Copy;
else
return TreeView.NoneDragDropEffects;
}
示例5: GetButtons
/// <summary>
/// Converts a System.Windows.Forms.MouseButtons to OForms.MouseButtons
/// </summary>
/// <param name="b">Object to convert.</param>
/// <returns>Converted buttons.</returns>
public static OForms.MouseButtons GetButtons(Forms.MouseButtons b)
{
OForms.MouseButtons buttons = OForms.MouseButtons.None;
if (b.HasFlag(Forms.MouseButtons.Left))
{
buttons |= OForms.MouseButtons.Left;
}
else if (b.HasFlag(Forms.MouseButtons.Middle))
{
buttons |= OForms.MouseButtons.Middle;
}
else if (b.HasFlag(Forms.MouseButtons.Right))
{
buttons |= OForms.MouseButtons.Right;
}
else if (b.HasFlag(Forms.MouseButtons.XButton1))
{
buttons |= OForms.MouseButtons.XButton1;
}
else if (b.HasFlag(Forms.MouseButtons.XButton2))
{
buttons |= OForms.MouseButtons.XButton2;
}
return buttons;
}
示例6: HandleDrop
public void HandleDrop(WinForms::IDataObject dragData)
{
if (!this.IsValidDropTarget(dragData))
return;
IEnumerable<TreeNode> draggedNodes = TreeView.GetTreeNodesFromDragData(dragData);
if (draggedNodes == null)
return;
List<SelectionSetWrapper> selSets = new List<SelectionSetWrapper>();
foreach (TreeNode tn in draggedNodes)
{
if (tn.Parent == null)
continue;
SelectionSetWrapper selSet = TreeMode.GetMaxNode(tn.Parent) as SelectionSetWrapper;
if (selSet != null && !selSets.Contains(selSet))
selSets.Add(selSet);
}
IEnumerable<IMaxNode> draggedMaxNodes = TreeMode.GetMaxNodes(draggedNodes);
foreach (SelectionSetWrapper selSet in selSets)
{
IEnumerable<IMaxNode> newNodes = selSet.ChildNodes.Except(draggedMaxNodes);
ModifySelectionSetCommand cmd = new ModifySelectionSetCommand(selSet, newNodes);
cmd.Execute();
}
}
示例7: HandleDrop
public override void HandleDrop(WinForms::IDataObject dragData)
{
if (!this.IsValidDropTarget(dragData))
return;
IEnumerable<TreeNode> draggedNodes = TreeView.GetTreeNodesFromDragData(dragData);
if (draggedNodes == null)
return;
IEnumerable<IMaxNode> draggedMaxNodes = TreeMode.GetMaxNodes(draggedNodes);
SelectionSetWrapper targetSelSet = (SelectionSetWrapper)this.MaxNode;
IEnumerable<IMaxNode> combinedNodes = targetSelSet.ChildNodes.Union(draggedMaxNodes);
ModifySelectionSetCommand cmd = new ModifySelectionSetCommand(targetSelSet, combinedNodes);
cmd.Execute();
if (!ControlHelpers.ShiftPressed)
{
IEnumerable<SelectionSetWrapper> selSets = draggedNodes.Select(tn => TreeMode.GetMaxNode(tn.Parent))
.OfType<SelectionSetWrapper>()
.Where(n => !n.Equals(targetSelSet))
.Distinct();
foreach (SelectionSetWrapper selSet in selSets)
{
IEnumerable<IMaxNode> newNodes = selSet.ChildNodes.Except(draggedMaxNodes);
ModifySelectionSetCommand moveCmd = new ModifySelectionSetCommand(selSet, newNodes);
moveCmd.Execute();
}
}
}
示例8: Notify_Click
private void Notify_Click(object sender, WinForms.MouseEventArgs e)
{
if (e.Button != WinForms.MouseButtons.Left)
return;
mainWindow.ShowApp();
}
示例9: OnPaint
protected override void OnPaint(WinForms.PaintEventArgs pe)
{
base.OnPaint(pe);
Pen pen1 = new System.Drawing.Pen(Color.LightGray, 2f);
Pen pen2 = new System.Drawing.Pen(Color.LightGray, 2f);
Brush background = new SolidBrush(Color.DarkGray);
Brush brushFont = new SolidBrush(Color.White);
Font font = new Font("Arial", 14);
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Near;
format.LineAlignment = StringAlignment.Near;
Point p00 = new Point(0, 0);
Point p01 = new Point(0, this.Size.Height - 1);
Point p10 = new Point(this.Size.Width - 1, 0);
Point p11 = new Point(this.Size.Width - 1, this.Size.Height - 1);
Rectangle area = new Rectangle(Point.Empty, this.Size - new Size(1, 1));
pe.Graphics.FillRectangle(background, area);
pe.Graphics.DrawLine(pen1, p10, p11);
pe.Graphics.DrawLine(pen1, p11, p01);
pe.Graphics.DrawLine(pen2, p00, p10);
pe.Graphics.DrawLine(pen2, p01, p00);
pe.Graphics.DrawString(Text, font, brushFont, area, format);
}
示例10: SharpDXInputSystem
/// <summary>Creates a new SharpDXInputSystem.</summary>
/// <param name="control">The control to associate with DirectInput.</param>
public SharpDXInputSystem(WF.Control control)
{
_directInput = new DI.DirectInput();
InitialiseKeyboard(control);
InitialiseJoystick();
}
示例11: ParteHandler
public ParteHandler(Element.ComboBox cboTipoDoc, Element.MaskedTextBox txtNroDni, Element.ComboBox cboSexo,
Element.TextBox txtNombre, Element.TextBox txtApellido, Element.MaskedTextBox txtCuit,
Element.DateTimePicker dpFecNac, Element.ComboBox cboECivil, Element.TextBox txtDomicilio,
Element.ComboBox cboCiudad, Element.ComboBox cboDepartamento, Element.ComboBox cboProvincia,
Element.ComboBox cboNacionalidad)
{
this.cboTipoDoc = cboTipoDoc;
this.txtNroDni = txtNroDni;
this.cboSexo = cboSexo;
this.txtNombre = txtNombre;
this.txtApellido = txtApellido;
this.txtCuit = txtCuit;
this.dpFecNac = dpFecNac;
this.cboECivil = cboECivil;
this.txtDomicilio = txtDomicilio;
this.cboCiudad = cboCiudad;
this.cboDepartamento = cboDepartamento;
this.cboProvincia = cboProvincia;
this.cboNacionalidad = cboNacionalidad;
formatoPartes();
con.Connect();
ds1 = con.fillDs("SELECT * FROM DOCUMENTOS;", "PARTES");
ds2 = con.fillDs("SELECT * FROM SEXOS;", "SEXOS");
ds3 = con.fillDs("SELECT * FROM ESTADOS_CIVILES;", "ESTADOS");
ds7 = con.fillDs("SELECT * FROM NACIONALIDADES;", "NACIONALIDADES");
cboTipoDoc.DataSource = ds1.Tables[0];
cboSexo.DataSource = ds2.Tables[0];
cboECivil.DataSource = ds3.Tables[0];
cboNacionalidad.DataSource = ds7.Tables[0];
}
示例12: TextBoxTester
public void Test01_10までのFizzBuzz結果の確認()
{
var target = new FizzBuzzForm();
target.Show();
new TextBoxTester("maxNumberTextBox", target).Enter("10");
new ButtonTester("fizzBuzzButton", target).Click();
var dataGrid = new Finder<DataGridView>("fizzBuzzDataGridView", target).Find();
var expectedList = new[] {
new { Number = 1, Text = "1" },
new { Number = 2, Text = "2" },
new { Number = 3, Text = "Fizz" },
new { Number = 4, Text = "4" },
new { Number = 5, Text = "Buzz" },
new { Number = 6, Text = "Fizz" },
new { Number = 7, Text = "7" },
new { Number = 8, Text = "8" },
new { Number = 9, Text = "Fizz" },
new { Number = 10, Text = "Buzz" },
};
foreach (var expected in expectedList)
AssertForOneRow(dataGrid, expected.Number, expected.Text);
}
示例13: OnItemChecked
private void OnItemChecked (object sender, SWF.ItemCheckEventArgs args)
{
if (args.Index == ((ListItemProvider) Provider).Index) {
newValue = args.NewValue;
RaiseAutomationPropertyChangedEvent ();
}
}
示例14: AddAgilent
partial void AddAgilent()
{
PSetReferences[] pset_references = new[] { new PSetReferences() };
PSetFileLocations pset_file_locations = new PSetFileLocations();
pset_file_locations.SelectedFiles = new CoreList<string>();
pset_references[0].OriginalPSet = pset_file_locations;
pset_references[0].CurrentPSet = pset_file_locations.Clone();
QualFileDialogOptionsControl options = new QualFileDialogOptionsControl();
options.Initialize(LABEL, '*' + EXTENSION, CoreUtilities.GetDADefaultDataPath(), new[] { string.Empty });
options.ParameterSets = pset_references;
AgtDialog afsd = new AgtDialog();
afsd.AllowMultiSelect = true;
afsd.AppPlugIn = options;
afsd.Initialize(DialogMode.Open);
if(afsd.ShowDialog() == DialogResult.OK)
{
foreach(string data_filepath in afsd.SelectedFilePaths)
{
if(!lstData.Items.Contains(data_filepath))
{
lstData.Items.Add(data_filepath);
tspbProgress.Value = tspbProgress.Minimum;
}
}
}
}
示例15: OnCellValueChanged
private void OnCellValueChanged (object sender, SWF.DataGridViewCellEventArgs args)
{
if (args.ColumnIndex == provider.ComboboxProvider.ComboBoxCell.ColumnIndex
&& args.RowIndex == provider.ComboboxProvider.ComboBoxCell.RowIndex
&& provider.IsItemSelected (itemProvider))
RaiseAutomationPropertyChangedEvent ();
}