• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Windows.Forms类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Forms的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Forms类的具体用法?C# System.Windows.Forms怎么用?C# System.Windows.Forms使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



System.Windows.Forms类属于命名空间,在下文中一共展示了System.Windows.Forms类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
 }
开发者ID:Sugz,项目名称:Outliner-3.0,代码行数:7,代码来源:FilterCombinatorDragDropHandler.cs


示例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();
 }
开发者ID:ChrisJamesSadler,项目名称:Cosmos,代码行数:29,代码来源:ExitButton.cs


示例3: GetDragDropEffect

 public WinForms::DragDropEffects GetDragDropEffect(WinForms::IDataObject dragData)
 {
    if (IsValidDropTarget(dragData))
       return WinForms::DragDropEffects.Move;
    else
       return TreeView.NoneDragDropEffects;
 }
开发者ID:Sugz,项目名称:Outliner-3.0,代码行数:7,代码来源:TreeViewDragDropHandler.cs


示例4: GetDragDropEffect

 public override WinForms.DragDropEffects GetDragDropEffect(WinForms.IDataObject dragData)
 {
    if (this.IsValidDropTarget(dragData))
       return WinForms.DragDropEffects.Copy;
    else
       return TreeView.NoneDragDropEffects;
 }
开发者ID:Sugz,项目名称:Outliner-3.0,代码行数:7,代码来源:MaterialDragDropHandler.cs


示例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;
        }
开发者ID:ChrisJamesSadler,项目名称:Cosmos,代码行数:32,代码来源:Utils.cs


示例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();
      }
   }
开发者ID:Sugz,项目名称:Outliner-3.0,代码行数:28,代码来源:TreeViewDragDropHandler.cs


示例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();
         }
      }
   }
开发者ID:Sugz,项目名称:Outliner-3.0,代码行数:30,代码来源:SelectionSetDragDropHandler.cs


示例8: Notify_Click

        private void Notify_Click(object sender, WinForms.MouseEventArgs e)
        {
            if (e.Button != WinForms.MouseButtons.Left)
                return;

            mainWindow.ShowApp();
        }
开发者ID:jaywick,项目名称:Vizr,代码行数:7,代码来源:SystemTrayIcon.cs


示例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);
        }
开发者ID:jessaantonio,项目名称:unityforms,代码行数:28,代码来源:TextArea.cs


示例10: Checked

      protected override bool Checked(WinForms::ToolStripMenuItem clickedItem, TreeView treeView, TreeNode clickedTn)
      {
         IEnumerable<IMaxNode> selNodes = TreeMode.GetMaxNodes(treeView.SelectedNodes);

         return selNodes.OfType<XRefSceneRecord>()
                        .Any(x => x.HasFlags(this.Flags));
      }
开发者ID:Sugz,项目名称:Outliner-3.0,代码行数:7,代码来源:SetXRefSceneFlagItemModel.cs


示例11: 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();
        }
开发者ID:retrozombie,项目名称:Hovertank3DdotNet,代码行数:10,代码来源:SharpDXInputSystem.cs


示例12: 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];
        }
开发者ID:nahueld,项目名称:CoffeeAndCake,代码行数:32,代码来源:ParteHandler.cs


示例13: 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);
        }
开发者ID:masakitk,项目名称:TDDSample,代码行数:25,代码来源:FizzBuzzFormTest.cs


示例14: OnItemChecked

		private void OnItemChecked (object sender, SWF.ItemCheckEventArgs args)
		{
			if (args.Index == ((ListItemProvider) Provider).Index) {
				newValue = args.NewValue;
				RaiseAutomationPropertyChangedEvent ();
			}
		}
开发者ID:mono,项目名称:uia2atk,代码行数:7,代码来源:ListItemTogglePatternToggleStateEvent.cs


示例15: 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;
                    }
                }
            }
        }
开发者ID:nfillmore,项目名称:morpheus_speedup,代码行数:29,代码来源:frmMain.Agilent.cs


示例16: 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 ();
		}
开发者ID:mono,项目名称:uia2atk,代码行数:7,代码来源:DataItemComboBoxListItemSelectionItemPatternIsSelectedEvent.cs


示例17: OnUIATextChanged

		private void OnUIATextChanged (object sender, SWF.LabelEditEventArgs args)
		{
			if (args.Item == editProvider.ItemProvider.ListView.Columns.IndexOf (editProvider.ColumnHeader)) {
				newText = (string) editProvider.GetPropertyValue (ValuePatternIdentifiers.ValueProperty.Id);
				RaiseAutomationPropertyChangedEvent ();
			}
		}
开发者ID:mono,项目名称:uia2atk,代码行数:7,代码来源:ListItemEditValuePatternValueEvent.cs


示例18: LibroHandler

 //Constructor
 public LibroHandler(Element.NumericUpDown updwLibro, Element.NumericUpDown updwRenglon, Element.MaskedTextBox txtNroFolio, Element.TextBox txtDescripcion)
 {
     this.updwLibro = updwLibro;
     this.updwRenglon = updwRenglon;
     this.txtNroFolio = txtNroFolio;
     this.txtDescripcion = txtDescripcion;
 }
开发者ID:nahueld,项目名称:CoffeeAndCake,代码行数:8,代码来源:LibroHandler.cs


示例19: OnUIAHelpRequested

		private static void OnUIAHelpRequested (object sender, SWF.ControlEventArgs args)
		{
			SWF.HelpProvider helpProvider = (SWF.HelpProvider) sender;
			HelpProvider provider 
				= (HelpProvider) ProviderFactory.GetProvider (helpProvider);
			provider.Show (args.Control);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:7,代码来源:HelpProviderListener.cs


示例20: OnAfterLabelEdit

		private void OnAfterLabelEdit (object sender, SWF.LabelEditEventArgs args)
		{
			if (viewItem.ListView.Items.IndexOf (viewItem) == args.Item) {
				newText = args.Label;
				RaiseAutomationPropertyChangedEvent ();
			}
		}
开发者ID:mono,项目名称:uia2atk,代码行数:7,代码来源:ListItemValuePatternValueEvent.cs



注:本文中的System.Windows.Forms类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.BindingSource类代码示例发布时间:2022-05-24
下一篇:
C# Controls.Image类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap