当前位置: 首页>>代码示例>>C#>>正文


C# Forms.Binding类代码示例

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


Binding类属于System.Windows.Forms命名空间,在下文中一共展示了Binding类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BarEditItemTextBinding

 public BarEditItemTextBinding(BarEditItem control, object dataSource, string dataMember)
 {
     _control = control;
     _binding = new Binding("EditValue", dataSource, dataMember);
     DataBindings.Add(_binding);
     _control.EditValueChanged += _control_EditValueChanged;
 }
开发者ID:qrunner,项目名称:Default,代码行数:7,代码来源:BarEditItemTextBinding.cs

示例2: ShredHostClientComponentControl

        /// <summary>
        /// Constructor
        /// </summary>
        public ShredHostClientComponentControl(ShredHostClientComponent component)
            :base(component)
        {
            InitializeComponent();  

            _component = component;

            // TODO add .NET databindings to _component

            // create a binding that will show specific text based on the boolean value
            // of whether the shred host is running
            Binding binding = new Binding("Text", _component, "IsShredHostRunning");
            binding.Parse += new ConvertEventHandler(IsShredHostRunningParse);
            binding.Format += new ConvertEventHandler(IsShredHostRunningFormat);
            _shredHostGroupBox.DataBindings.Add(binding);

            Binding binding2 = new Binding("Text", _component, "IsShredHostRunning");
            binding2.Parse += new ConvertEventHandler(IsShredHostToggleButtonParse);
            binding2.Format += new ConvertEventHandler(IsShredHostToggleButtonFormat);
            _toggleButton.DataBindings.Add(binding2);

            _shredCollectionTable.Table = _component.ShredCollection;
            _shredCollectionTable.SelectionChanged += new EventHandler(OnShredTableSelectionChanged);
            _shredCollectionTable.ToolStripItemDisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
            _shredCollectionTable.ToolbarModel = _component.ToolbarModel;
            _shredCollectionTable.MenuModel = _component.ContextMenuModel;

            _toggleButton.Click += delegate(object source, EventArgs args)
            {
                _component.Toggle();
            };
        }
开发者ID:nhannd,项目名称:Xian,代码行数:35,代码来源:ShredHostClientComponentControl.cs

示例3: AviExportAdvancedComponentControl

        public AviExportAdvancedComponentControl(AviExportAdvancedComponent component)
            :base(component)
        {
			_component = component;
            InitializeComponent();

			base.AcceptButton = _buttonOk;
			base.CancelButton = _buttonCancel;
			
			_checkUseDefaultQuality.DataBindings.Add("Checked", _component, "UseDefaultQuality", true, DataSourceUpdateMode.OnPropertyChanged);
			_checkUseDefaultQuality.DataBindings.Add("Enabled", _component, "UseDefaultQualityEnabled", true, DataSourceUpdateMode.OnPropertyChanged);

        	_comboCodec.DataSource = _component.CodecInfoList;
			_comboCodec.DisplayMember = "Description";
			_comboCodec.DataBindings.Add("Value", _component, "SelectedCodecInfo", true, DataSourceUpdateMode.OnPropertyChanged);

			_trackBarQuality.DataBindings.Add("Enabled", _component, "QualityEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
			_trackBarQuality.DataBindings.Add("Minimum", _component, "MinQuality", true, DataSourceUpdateMode.OnPropertyChanged);
			_trackBarQuality.DataBindings.Add("Maximum", _component, "MaxQuality", true, DataSourceUpdateMode.OnPropertyChanged);
			_trackBarQuality.DataBindings.Add("Value", _component, "Quality", true, DataSourceUpdateMode.OnPropertyChanged);

			_quality.DataBindings.Add("Enabled", _component, "QualityEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
			Binding binding = new Binding("Text", _component, "Quality", true, DataSourceUpdateMode.OnPropertyChanged);
			binding.Format += new ConvertEventHandler(OnFormatQuality);
			_quality.DataBindings.Add(binding);
        }
开发者ID:nhannd,项目名称:Xian,代码行数:26,代码来源:AviExportAdvancedComponentControl.cs

示例4: BindValueChanged

        // We need to force WriteValue() on CheckedChanged otherwise it will only call WriteValue()
        // on loss of focus.
        // http://stackoverflow.com/questions/1060080/databound-winforms-control-does-not-recognize-change-until-losing-focus
        /// <summary>
        /// Binds the specified NumericUpDown control
        /// </summary>
        /// <param name="num"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static Binding BindValueChanged(NumericUpDown num, Binding b)
        {
            num.DataBindings.Add(b);
            num.ValueChanged += (sender, e) => { b.WriteValue(); };

            return b;
        }
开发者ID:kanbang,项目名称:Colt,代码行数:16,代码来源:NumericBinder.cs

示例5: AddCore

		protected virtual void AddCore (Binding dataBinding) 
		{
			CollectionChangeEventArgs args = new CollectionChangeEventArgs (CollectionChangeAction.Add, dataBinding);
			OnCollectionChanging (args);
			base.List.Add(dataBinding);
			OnCollectionChanged (args);
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:7,代码来源:BindingsCollection.cs

示例6: BindToObject

 internal BindToObject(Binding owner, object dataSource, string dataMember)
 {
     this.owner = owner;
     this.dataSource = dataSource;
     this.dataMember = new System.Windows.Forms.BindingMemberInfo(dataMember);
     this.CheckBinding();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:BindToObject.cs

示例7: BindSelectedIndexChanged

        // We need to force WriteValue() on SelectedIndexChanged otherwise it will only call WriteValue()
        // on loss of focus.
        // http://stackoverflow.com/questions/1060080/databound-winforms-control-does-not-recognize-change-until-losing-focus
        /// <summary>
        /// Binds the specified combobox
        /// </summary>
        /// <param name="cmb"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static Binding BindSelectedIndexChanged(ComboBox cmb, Binding b)
        {
            cmb.DataBindings.Add(b);
            cmb.SelectedIndexChanged += (sender, e) => { b.WriteValue(); };

            return b;
        }
开发者ID:kanbang,项目名称:Colt,代码行数:16,代码来源:ComboBoxBinder.cs

示例8: Options

        public Options()
        {
            InitializeComponent();

            var bind = new Binding("Value", Properties.Settings.Default, "Opacity");
            bind.Format += (sender, e) => { e.Value = (int)Math.Round((double)e.Value * 100); };
            opacityTrackBar.DataBindings.Add(bind);
            opacityTrackBar.ValueChanged += delegate
            {
                Properties.Settings.Default.Opacity = opacityTrackBar.Value / 100.0;
            };

            //controlCheckBox.CheckedChanged += delegate
            //{
            //    Properties.Settings.Default.Control = controlCheckBox.Checked;
            //};
            //shiftCheckBox.CheckedChanged += delegate
            //{
            //    Properties.Settings.Default.Shift = shiftCheckBox.Checked;
            //};
            //altCheckBox.CheckedChanged += delegate
            //{
            //    Properties.Settings.Default.Alt = altCheckBox.Checked;
            //};
            //keyComboBox.TextChanged += delegate
            //{
            //    Properties.Settings.Default.Key = keyComboBox.Text;
            //};
        }
开发者ID:Answeror,项目名称:focus,代码行数:29,代码来源:Options.cs

示例9: CtorNullTest

		public void CtorNullTest ()
		{
			Binding b = new Binding (null, null, null);

			Assert.IsNull (b.PropertyName, "ctornull1");
			Assert.IsNull (b.DataSource, "ctornull2");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:7,代码来源:BindingTest.cs

示例10: Remove

 protected internal void Remove(Binding binding)
 {
     CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Remove, binding);
     this.OnCollectionChanging(e);
     this.RemoveCore(binding);
     this.OnCollectionChanged(e);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:BindingsCollection.cs

示例11: Add

 protected internal void Add(Binding binding)
 {
     CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, binding);
     this.OnCollectionChanging(e);
     this.AddCore(binding);
     this.OnCollectionChanged(e);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:BindingsCollection.cs

示例12: Bind

    public void Bind(object model_, string propertyOnModel_, Validators.IValidator validator_, bool colourNegRed_)
    {
      System.Windows.Forms.Binding binding;

      binding = new System.Windows.Forms.Binding("Text", model_, propertyOnModel_, validator_ != null, DataSourceUpdateMode.OnPropertyChanged);

      if (validator_ != null)
      {
        binding.Parse += new ConvertEventHandler(validator_.Parse);
        binding.Format += new ConvertEventHandler(validator_.Format);

        if (colourNegRed_ && validator_ is Validators.ISignChanged)
        {
          UseAppStyling = false;
          m_validator = validator_;
          ForeColor = System.Drawing.Color.Red;
          ((Validators.ISignChanged)validator_).SignChanged += handleSignChanged;
          ((Validators.ISignChanged)validator_).FireOnSignChanged();
        }
      }

      if (DataBindings["Text"] != null)
        DataBindings.Remove(DataBindings["Text"]);

      DataBindings.Add(binding);
    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:26,代码来源:BoundLabel.cs

示例13: build

        private void build(int row, int col)
        {
            string id = row.ToString() + col.ToString();
            int x = INIT_HORZ_PADDING + (UPDOWN_SIZE.Width + LBL_SIZE.Width + HORZ_PADDING) * col;
            int y = INIT_VERT_PADDING + (Math.Max(UPDOWN_SIZE.Height, LBL_SIZE.Width) + VERT_PADDING) * row;

            GenotypeCount data = (GenotypeCount)_dataBS.DataSource;
            bool isHomo = data.Genotype.IsHomozygous;

            // Initialize the Label
            _label = new Label() {
                Name = $"{(isHomo ? "Homo" : "Hetero")}CountLbl{id}",
                Location = new Point(x, y + LBL_OFFSET),
                AutoSize = false,
                Size = LBL_SIZE,
            };
            Binding lblBinding = new Binding("Text", _dataBS, "Genotype.Alleles", true, DataSourceUpdateMode.Never);
            lblBinding.Format += LblBinding_Format;
            _label.DataBindings.Add(lblBinding);

            // Initialize the NumericUpDown
            _upDown = new NumericUpDown() {
                Name = $"{(isHomo ? "Homo" : "Hetero")}CountUpDown{id}",
                Location = new Point(x + LBL_SIZE.Width, y),
                Size = UPDOWN_SIZE,
                Maximum = 100000m,  // 100,000
                Minimum = 0m,
                TabIndex = row,
                Value = 100m,
                ThousandsSeparator = true,
            };
            Binding countBinding = new Binding("Value", _dataBS, "Count", false, DataSourceUpdateMode.OnPropertyChanged);
            _upDown.DataBindings.Add(countBinding);
        }
开发者ID:Rabadash8820,项目名称:HardyWeinberg,代码行数:34,代码来源:GenotypeCountPrefab.cs

示例14: MouseImageViewerToolPropertyComponentControl

		public MouseImageViewerToolPropertyComponentControl(MouseImageViewerToolPropertyComponent component)
		{
			InitializeComponent();

			_chkInitiallySelected.DataBindings.Add("Checked", component, "InitiallyActive", false, DataSourceUpdateMode.OnPropertyChanged);

			_cboActiveMouseButtons.Format += OnCboActiveMouseButtonsFormat;
			_cboActiveMouseButtons.SelectedIndexChanged += OnComboBoxSelectedItemChangedUpdate;
			_cboActiveMouseButtons.Items.Add(XMouseButtons.Left);
			_cboActiveMouseButtons.Items.Add(XMouseButtons.Right);
			_cboActiveMouseButtons.Items.Add(XMouseButtons.Middle);
			_cboActiveMouseButtons.Items.Add(XMouseButtons.XButton1);
			_cboActiveMouseButtons.Items.Add(XMouseButtons.XButton2);
			_cboActiveMouseButtons.SelectedIndex = 0;
			_cboActiveMouseButtons.DataBindings.Add("SelectedItem", component, "ActiveMouseButtons", true, DataSourceUpdateMode.OnPropertyChanged);

			_cboGlobalMouseButtons.Format += OnCboActiveMouseButtonsFormat;
			_cboGlobalMouseButtons.SelectedIndexChanged += OnComboBoxSelectedItemChangedUpdate;
			_cboGlobalMouseButtons.Items.Add(XMouseButtons.None);
			_cboGlobalMouseButtons.Items.Add(XMouseButtons.Left);
			_cboGlobalMouseButtons.Items.Add(XMouseButtons.Right);
			_cboGlobalMouseButtons.Items.Add(XMouseButtons.Middle);
			_cboGlobalMouseButtons.Items.Add(XMouseButtons.XButton1);
			_cboGlobalMouseButtons.Items.Add(XMouseButtons.XButton2);
			_cboGlobalMouseButtons.SelectedIndex = 0;
			_cboGlobalMouseButtons.DataBindings.Add("SelectedItem", component, "GlobalMouseButtons", true, DataSourceUpdateMode.OnPropertyChanged);

			Binding keyModifierBinding = new Binding("KeyModifiers", component, "GlobalModifiers", true, DataSourceUpdateMode.OnPropertyChanged);
			keyModifierBinding.Format += OnKeyModifierBindingConvert;
			keyModifierBinding.Parse += OnKeyModifierBindingConvert;
			_chkGlobalModifiers.DataBindings.Add(keyModifierBinding);
		}
开发者ID:nhannd,项目名称:Xian,代码行数:32,代码来源:MouseImageViewerToolPropertyComponentControl.cs

示例15: CreateCheckEditInverseBinding

 public static Binding CreateCheckEditInverseBinding(string propertyName, object dataSource, string dataMember)
 {
     Binding bind = new Binding(propertyName, dataSource, dataMember);
     bind.FormattingEnabled = true;
     bind.Format += new ConvertEventHandler(BindingHelper.Invert);
     bind.Parse += new ConvertEventHandler(BindingHelper.Invert);
     return bind;
 }
开发者ID:AleksMorozova,项目名称:prizm,代码行数:8,代码来源:BindingHelper.cs


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