public TankBlasterUserControl(Battlefield arena) { InitializeComponent(); _arena = arena; _bombImgSource = ResourceImageHelper.LoadImage(Properties.Resources.bomb); _missileImgSource = ResourceImageHelper.LoadImage(Properties.Resources.missile); _regularTileImgSource = ResourceImageHelper.LoadImage(Properties.Resources.regularTile); _fortifiedTileImgSource = ResourceImageHelper.LoadImage(Properties.Resources.fortifiedTile); _fortifiedTileBlastImgSource = ResourceImageHelper.LoadImage(Properties.Resources.fortifiedTileBlast); _indestructibleTileImgSource = ResourceImageHelper.LoadImage(Properties.Resources.indestructibleTile); _mapBackgroundImgSource = ResourceImageHelper.LoadImage(Properties.Resources.grass); _bombExplHorImgSource = ResourceImageHelper.LoadImage(Properties.Resources.bomb_expl_mid_hor); _bombExplVerImgSource = ResourceImageHelper.LoadImage(Properties.Resources.bomb_expl_mid_vert); _tileSize = (int)(Height - PlayersGrid.Height) / _arena.Board.GetLength(1); Width = _tileSize * _arena.Board.GetLength(0); BoardGrid = new TankBlasterGridControl(); BoardGrid.SetValue(Grid.RowProperty, 1); BoardGrid.Init(_arena.Board.GetLength(0), _arena.Board.GetLength(1), _tileSize); Background = new ImageBrush(_mapBackgroundImgSource); MainGrid.Children.Add(BoardGrid); arena.ArenaChanged += OnArenaChange; }
protected internal virtual void LoadIcons() { Assembly asm = typeof(SchedulerControl).Assembly; this.recurringIcon = ResourceImageHelper.CreateIconFromResources(SchedulerIconNames.RecurringAppointment, asm); this.normalIcon = ResourceImageHelper.CreateIconFromResources(SchedulerIconNames.Appointment, asm); }
private void LoadIcon(BuildStatusEnum statusValue, bool isInProgress, bool isStuck) { BuildStatus status = new BuildStatus(statusValue, isInProgress, isStuck); if (iconsByKey.ContainsKey(status.Key)) { return; } try { string resourceName = string.Format("JenkinsTray.Resources.StatusIcons.{0}.gif", status.Key); Image img = ResourceImageHelper.CreateImageFromResources(resourceName, GetType().Assembly); byte[] imgBytes = DevExpress.XtraEditors.Controls.ByteImageConverter.ToByteArray(img, ImageFormat.Gif); iconsByKey.Add(status.Key, imgBytes); } catch (Exception ex) { XtraMessageBox.Show(JenkinsTrayResources.FailedLoadingIcons_Text, JenkinsTrayResources.FailedLoadingIcons_Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); LoggingHelper.LogError(logger, ex); throw new Exception("Failed loading icon: " + status, ex); } }
protected internal virtual void LoadIcons() { Assembly asm = typeof(Appointment).Assembly; this.recurringSvgImage = ResourceImageHelper.CreateSvgImageFromResources(SchedulerSvgImageNames.NewRecurringAppointment, asm); this.normalSvgImage = ResourceImageHelper.CreateSvgImageFromResources(SchedulerSvgImageNames.NewAppointment, asm); }
public static Image GetResourceImage(string resourceName, string itemName) { string name = string.Format("PreciousUI.Resources.Images.{0}.{1}", resourceName, itemName); Image image = ResourceImageHelper.CreateImageFromResources(name, Assembly.GetExecutingAssembly()); return(image); }
public RepositoryItemToggleSwitch() { base.CheckStyle = CheckStyles.UserDefined; base.GlyphAlignment = DevExpress.Utils.HorzAlignment.Far; base.PictureUnchecked = ResourceImageHelper.CreateImageFromResources("WindowsApplication3.Resources.ToggleSwitchOff.png", typeof(RepositoryItemToggleSwitch).Assembly); base.PictureChecked = ResourceImageHelper.CreateImageFromResources("WindowsApplication3.Resources.ToggleSwitchOn.png", typeof(RepositoryItemToggleSwitch).Assembly); base.PictureGrayed = ResourceImageHelper.CreateImageFromResources("WindowsApplication3.Resources.ToggleSwitchDisabled.png", typeof(RepositoryItemToggleSwitch).Assembly); }
public Form1() { InitializeComponent(); xtraTabControl1.CustomHeaderButtons[0].ToolTip = "Add Image..."; xtraTabControl1.CustomHeaderButtons[1].ToolTip = "Remove Image"; AddImage("Start Page", ResourceImageHelper.CreateImageFromResources("XtraTabControl_CustomButtons.08.jpg", typeof(Form1).Assembly)); xtraTabControl1.TabPages[0].ShowCloseButton = DefaultBoolean.False; }
public void SetUpBots(IEnumerable <ICompetitor> competitors) { _field.Bots = competitors.Select(competitor => new TankBlasterBot(competitor)).ToList(); for (var i = 0; i < _field.Bots.Count; i++) { _field.Bots[i].Location = GetBotRandomStartupLocation(); _field.Bots[i].Image = ResourceImageHelper.LoadImage(i % 2 == 0 ? Resources.tank1 : Resources.tank2); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { string image = parameter as string ?? value as string; if (image == null) { throw new NullReferenceException("parameter"); } return(ResourceImageHelper.GetResourceImage(image)); }
public static SvgImage GetSvgImage(string imageName) { SvgImage svgImage; if (!svgImages.TryGetValue(imageName, out svgImage)) { svgImage = ResourceImageHelper.CreateSvgImageFromResources(prefix + imageName + ext, typeof(SvgResources).Assembly); svgImages.Add(imageName, svgImage); } return(svgImage); }
Image CreateImage(byte[] data) { if (data == null) { return(ResourceImageHelper.CreateImageFromResourcesEx("DevExpress.DevAV.Resources.Unknown-user.png", typeof(Employee).Assembly)); } else { return(ByteImageConverter.FromByteArray(data)); } }
internal static Image CreateImage(this Picture picture, string defaultImage = null) { if (picture == null) { if (string.IsNullOrEmpty(defaultImage)) { defaultImage = DefaultPic; } return(ResourceImageHelper.CreateImageFromResourcesEx(defaultImage, typeof(Picture).Assembly)); } return(ByteImageConverter.FromByteArray(picture.Data)); }
public static void RegisterRichTextIndentEdit() { //EditorClassInfo info = EditorRegistrationInfo.Default.Editors[InternalEditorTypeName]; //if (info != null) // EditorRegistrationInfo.Default.Editors.Remove(info); // TODO: replace image Bitmap img = ResourceImageHelper.CreateBitmapFromResources("DevExpress.XtraRichEdit.Bitmaps256.RichTextEdit.bmp", Assembly.GetExecutingAssembly()); img.MakeTransparent(Color.Magenta); EditorClassInfo editorInfo = new EditorClassInfo(typeof(RichTextIndentEdit).Name, typeof(RichTextIndentEdit), typeof(RepositoryItemRichTextIndentEdit), typeof(DevExpress.XtraEditors.ViewInfo.BaseSpinEditViewInfo), new DevExpress.XtraEditors.Drawing.ButtonEditPainter(), true, img); editorInfo.AllowInplaceEditing = ShowInContainerDesigner.OnlyInBars; EditorRegistrationInfo.Default.Editors.Add(editorInfo); }
public PictureObject(string name, string url) { Name = name; Image = ResourceImageHelper.CreateImageFromResources("DevExpress.XtraEditors.Images.loading.gif", typeof(BackgroundImageLoader).Assembly); BackgroundImageLoader bg = new BackgroundImageLoader(); bg.Load(url); bg.Loaded += (s, e) => { Image = bg.Result; if (!(Image is Image)) { Image = ResourceImageHelper.CreateImageFromResources("DevExpress.XtraEditors.Images.Error.png", typeof(BackgroundImageLoader).Assembly); } PropertyChanged(this, new PropertyChangedEventArgs("Image")); bg.Dispose(); }; }
public static void RegisterCustomButtonEdit() { Image img = null; try { img = ResourceImageHelper.CreateBitmapFromResources("TestCustomRepositoryItem.Resources.image_icon.png", Assembly.GetExecutingAssembly()); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); } EditorRegistrationInfo.Default.Editors.Add(new EditorClassInfo(EditName, typeof(CustomButtonEdit), typeof(RepositoryItemCustomButtonEdit), typeof(DevExpress.XtraEditors.ViewInfo.ButtonEditViewInfo), new ButtonEditPainter(), true, img, typeof(ButtonEditAccessible))); }
public static Image CreateCheckBadge(Color color) { var assembly = typeof(KanbanHelper).Assembly; SvgBitmap svgBitmap; using (var stream = ResourceImageHelper.FindStream("DevExpress.XtraGrid.Demos.Images.CheckImage.svg", typeof(KanbanHelper).Assembly)) { svgBitmap = SvgBitmap.FromStream(stream); } if (svgBitmap == null) { return(null); } var pallet = new SvgPalette(); pallet.Colors.Add(new SvgColor("Black", color)); return(svgBitmap.Render(pallet)); }
private void gridView1_RowCellClick(object sender, RowCellClickEventArgs e) { txtVehicleName.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "HINHANH").ToString(); if (txtVehicleName.Text == "") { pictureBox1.Image = ResourceImageHelper.CreateImageFromResources("DevExpress.XtraEditors.Images.loading.gif", typeof(BackgroundImageLoader).Assembly); if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GIAXE").ToString() != "") { pictureBox1.Image = null; } } else { pictureBox1.Image = new Bitmap(txtVehicleName.Text); } }
private void frmConsoleAbout_Load(object sender, EventArgs e) { if (ComponentAttribute == null && ComponentType != null) { ComponentAttribute = AssemblyHelper.GetCustomAttributes <XCIComponentAttribute>(ComponentType); } if (ComponentAttribute != null) { labName.Text = ComponentAttribute.Name; labAuthor.Text = ComponentAttribute.Author; labContact.Text = ComponentAttribute.Contact; labVersion.Text = ComponentAttribute.Version; labCopyRight.Text = ComponentAttribute.CopyRight; txtDescription.Text = ComponentAttribute.Description; this.Text = "关于 " + ComponentAttribute.Name; string path = ComponentAttribute.Logo; if (path.IsNotEmpty()) { this.pictureBox1.Image = new Bitmap(ResourceImageHelper.CreateBitmapFromResources(path, ComponentType.Assembly), 64, 64); } else { Type type = typeof(IManager); var img = ResourceImageHelper.CreateBitmapFromResources("XCI.XCIComponent.ComponentLogo.png", type.Assembly); this.pictureBox1.Image = new Bitmap(img, 64, 64); } } if (Logo != null) { this.pictureBox1.Image = Logo; } }
private void LoadIcon(BuildStatusEnum statusValue, bool isInProgress, bool isStuck) { BuildStatus status = new BuildStatus(statusValue, isInProgress, isStuck); if (iconsByKey.ContainsKey(status.Key)) { return; } try { string resourceName = string.Format("JenkinsTray.Resources.TrayIcons.{0}.ico", status.Key); Icon icon = ResourceImageHelper.CreateIconFromResources(resourceName, GetType().Assembly); iconsByKey.Add(status.Key, icon); } catch (Exception ex) { XtraMessageBox.Show(JenkinsTrayResources.FailedLoadingIcons_Text, JenkinsTrayResources.FailedLoadingIcons_Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); LoggingHelper.LogError(logger, ex); throw new Exception("Failed loading icon: " + statusValue, ex); } }
static System.Drawing.Image LoadImage(string path) { System.Reflection.Assembly currentAssembly = System.Reflection.Assembly.GetAssembly(typeof(ChildForm)); return(ResourceImageHelper.CreateImageFromResources( "DevExpress.Samples.DocumentSelector." + path.Replace(@"\", "."), currentAssembly)); }
static void InitModules() { ModuleManager.DefaultManager.Register( Regions.Navigation, new DevExpress.Mvvm.ModuleInjection.Module(Modules.Dashboard, () => NavigationItemViewModel.Create(Modules.Dashboard, "Sales", "Revenue" + Environment.NewLine + "Snapshots", ResourceImageHelper.GetResourceImage("Sales.png")), typeof(NavigationItemView))); ModuleManager.DefaultManager.Register( Regions.Navigation, new DevExpress.Mvvm.ModuleInjection.Module(Modules.Products, () => NavigationItemViewModel.Create(Modules.Products, "Products", "Revenue" + Environment.NewLine + "by Products", ResourceImageHelper.GetResourceImage("Products.png")), typeof(NavigationItemView))); ModuleManager.DefaultManager.Register( Regions.Navigation, new DevExpress.Mvvm.ModuleInjection.Module(Modules.Sectors, () => NavigationItemViewModel.Create(Modules.Sectors, "Sectors", "Revenue" + Environment.NewLine + "by Sectors", ResourceImageHelper.GetResourceImage("Sectors.png")), typeof(NavigationItemView))); ModuleManager.DefaultManager.Register( Regions.Navigation, new DevExpress.Mvvm.ModuleInjection.Module(Modules.Regions, () => NavigationItemViewModel.Create(Modules.Regions, "Regions", "Revenue" + Environment.NewLine + "by Regions", ResourceImageHelper.GetResourceImage("Regions.png")), typeof(NavigationItemView))); ModuleManager.DefaultManager.Register( Regions.Navigation, new DevExpress.Mvvm.ModuleInjection.Module(Modules.Channels, () => NavigationItemViewModel.Create(Modules.Channels, "Channels", "Revenue" + Environment.NewLine + "by Sales Channels", ResourceImageHelper.GetResourceImage("Channels.png")), typeof(NavigationItemView))); ModuleManager.DefaultManager.Register(Regions.Main, new DevExpress.Mvvm.ModuleInjection.Module(Modules.Dashboard, () => SalesDashboardViewModel.Create(), typeof(SalesDashboard))); ModuleManager.DefaultManager.Register(Regions.Main, new DevExpress.Mvvm.ModuleInjection.Module(Modules.Products, () => ProductsViewModel.Create(), typeof(ProductsView))); ModuleManager.DefaultManager.Register(Regions.Main, new DevExpress.Mvvm.ModuleInjection.Module(Modules.Sectors, () => SectorsViewModel.Create(), typeof(SectorsView))); ModuleManager.DefaultManager.Register(Regions.Main, new DevExpress.Mvvm.ModuleInjection.Module(Modules.Regions, () => RegionsViewModel.Create(), typeof(RegionsView))); ModuleManager.DefaultManager.Register(Regions.Main, new DevExpress.Mvvm.ModuleInjection.Module(Modules.Channels, () => ChannelsViewModel.Create(), typeof(ChannelsView))); ModuleManager.DefaultManager.Inject(Regions.Navigation, Modules.Dashboard); ModuleManager.DefaultManager.Inject(Regions.Navigation, Modules.Products); ModuleManager.DefaultManager.Inject(Regions.Navigation, Modules.Sectors); ModuleManager.DefaultManager.Inject(Regions.Navigation, Modules.Regions); ModuleManager.DefaultManager.Inject(Regions.Navigation, Modules.Channels); ModuleManager.DefaultManager.Inject(Regions.Main, Modules.Dashboard); ModuleManager.DefaultManager.Inject(Regions.Main, Modules.Products); ModuleManager.DefaultManager.Inject(Regions.Main, Modules.Sectors); ModuleManager.DefaultManager.Inject(Regions.Main, Modules.Regions); ModuleManager.DefaultManager.Inject(Regions.Main, Modules.Channels); ModuleManager.DefaultManager.Navigate(Regions.Navigation, Modules.Dashboard); }
protected LoginViewModel() { Icon = ResourceImageHelper.GetResourceImage("User.png"); UserName = "******"; }
void InitializeInDesignMode() { Caption = "Sales"; Description = "Revenue" + Environment.NewLine + "Snapshots"; Glyph = ResourceImageHelper.GetResourceImage("Sales.png"); }
public MainForm() { InitializeComponent(); //textEdit4.ReadOnly = true; textEdit4.Properties.Appearance.Image = global::TestDEControls.Properties.Resources.save_16x16; textEdit4.Properties.Appearance.Options.UseImage = true; textEdit4.Properties.AppearanceFocused.Image = global::TestDEControls.Properties.Resources.save_16x16; textEdit4.Properties.AppearanceFocused.Options.UseImage = true; textEdit4.Properties.AppearanceDisabled.Image = global::TestDEControls.Properties.Resources.save_16x16; textEdit4.Properties.AppearanceDisabled.Options.UseImage = true; textEdit4.Properties.AppearanceReadOnly.Image = global::TestDEControls.Properties.Resources.save_16x16; textEdit4.Properties.AppearanceReadOnly.Options.UseImage = true; btnSet.Visible = false; _boolVictim4CheckBox = _boolVictim4ToggleSwitch = true; _defaultBooleanVictim4ToggleSwitch = DefaultBoolean.True; _stringVictim = "123456789012"; _textEdit3Binding = textEdit3.DataBindings.Add("EditValue", this, "StringVictim", true, DataSourceUpdateMode.OnPropertyChanged); _textEdit3Binding.BindingComplete += TextEdit3BindingBindingComplete; _textEdit3Binding.Format += TextEdit3BindingFormat; _textEdit3Binding.Parse += TextEdit3BindingParse; textEdit3.CustomDisplayText += TextEdit3CustomDisplayText; //tabControl.SelectedTabPage = tabPageButtons; lookUpEdit1.Properties.DataSource = GetDataTable(); lookUpEdit1.Properties.ValueMember = "id"; lookUpEdit1.Properties.DisplayMember = "Name"; lookUpEdit1.Properties.Columns.Clear(); lookUpEdit1.Properties.Columns.Add(new LookUpColumnInfo("Name")); lookUpEdit1.Properties.ShowHeader = false; lookUpEdit1.Properties.ShowFooter = false; lookUpEdit2.Properties.DataSource = GetListStubsWithIdBool(); lookUpEdit2.Properties.ValueMember = "Id"; lookUpEdit2.Properties.DisplayMember = "Name"; lookUpEdit2.Properties.Columns.Clear(); lookUpEdit2.Properties.Columns.Add(new LookUpColumnInfo("Name")); lookUpEdit2.Properties.ShowHeader = false; lookUpEdit2.Properties.ShowFooter = false; //lookUpEdit2.DataBindings.Add("EditValue", editObjectWithBool, "FBool", false, DataSourceUpdateMode.OnPropertyChanged); lookUpEdit2.DataBindings.Add("EditValue", editObjectWithNullableBool, "FBool", false, DataSourceUpdateMode.OnPropertyChanged); lookUpEdit3.Properties.DataSource = GetListStubsWithIdInt(); lookUpEdit3.Properties.ValueMember = "Id"; lookUpEdit3.Properties.DisplayMember = "Name"; lookUpEdit3.Properties.Columns.Clear(); lookUpEdit3.Properties.Columns.Add(new LookUpColumnInfo("Name")); lookUpEdit3.Properties.ShowHeader = false; lookUpEdit3.Properties.ShowFooter = false; lookUpEdit3.DataBindings.Add("EditValue", editObjectWithInt, "FInt", false, DataSourceUpdateMode.OnPropertyChanged); lookUpEdit4.Properties.DataSource = GetListStubsWithIdDevExpressDefaultBoolean(); lookUpEdit4.Properties.ValueMember = "Id"; lookUpEdit4.Properties.DisplayMember = "Name"; lookUpEdit4.Properties.Columns.Clear(); lookUpEdit4.Properties.Columns.Add(new LookUpColumnInfo("Name")); lookUpEdit4.Properties.ShowHeader = false; lookUpEdit4.Properties.ShowFooter = false; lookUpEdit4.DataBindings.Add("EditValue", editObjectWithDevExpressDefaultBoolean, "FBool", false, DataSourceUpdateMode.OnPropertyChanged); textEdit1.Properties.Mask.MaskType = MaskType.RegEx; textEdit1.Properties.Mask.EditMask = "a{1,3}"; textEdit1.Properties.Mask.AutoComplete = AutoCompleteType.None; gridControl1.DataSource = GetDataTable(); var repositoryItemComboBox = new RepositoryItemComboBox(); repositoryItemComboBox.Items.AddRange(new[] { 1, 2, 3 }); // https://documentation.devexpress.com/#WindowsForms/DevExpressXtraEditorsHyperLinkEdit_OpenLinktopic var repositoryItemHyperLinkEdit = new RepositoryItemHyperLinkEdit(); repositoryItemHyperLinkEdit.SingleClick = true; //repositoryItemHyperLinkEdit.ReadOnly = true; repositoryItemHyperLinkEdit.TextEditStyle = TextEditStyles.DisableTextEditor; var repositoryItemSpinEdit = new RepositoryItemSpinEdit(); repositoryItemSpinEdit.DisplayFormat.FormatString = "0.###############"; repositoryItemSpinEdit.DisplayFormat.FormatType = FormatType.Numeric; repositoryItemSpinEdit.Mask.EditMask = "n15"; repositoryItemSpinEdit.MaxLength = 30; repositoryItemSpinEdit.MaxValue = 79228162514264.337593543950335m; gridControl1.RepositoryItems.Add(repositoryItemComboBox); gridControl1.RepositoryItems.Add(repositoryItemHyperLinkEdit); gridControl1.RepositoryItems.Add(repositoryItemSpinEdit); gridView1.Columns.ColumnByFieldName("Dep").ColumnEdit = repositoryItemComboBox; gridView1.Columns.ColumnByFieldName("Url").ColumnEdit = repositoryItemHyperLinkEdit; gridView1.Columns.ColumnByFieldName("Salary").ColumnEdit = repositoryItemSpinEdit; repositoryItemComboBox.EditValueChanging += RepositoryItemComboBoxOnEditValueChanging; repositoryItemComboBox.EditValueChanged += RepositoryItemComboBoxOnEditValueChanged; gridView1.CustomRowCellEdit += GridViewOnCustomRowCellEdit; //gridView1.OptionsBehavior.Editable = false; gridView1.Click += gridViewClick; //gridView1.CustomDrawRowIndicator += GridViewCustomDrawRowIndicatorFake; checkEdit4.DataBindings.Add("EditValue", this, "BoolVictim4CheckBox", false, DataSourceUpdateMode.OnPropertyChanged); //checkEdit4.DataBindings.Add("EditValue", this, "BoolVictim4CheckBox", false, DataSourceUpdateMode.OnValidation); //pictureEdit.Enabled = false; pictureEdit.ReadOnly = true; pictureEdit.Properties.ReadOnly = true; pictureEdit.Properties.AllowFocused = false; //pictureEdit.Properties.ShowMenu = false; var assembly = typeof(PictureMenu).Assembly; var imageList = ImageHelper.CreateImageCollectionFromResources("DevExpress.XtraEditors.Images.PictureMenu.png", typeof(PictureMenu).Assembly, new Size(0x10, 0x10), Color.Empty); Image img = null; try { img = ResourceImageHelper.CreateBitmapFromResources("DevExpress.XtraEditors.ImageEdit.bmp", typeof(ButtonEdit).Assembly); img.Save("ImageEdit.bmp"); imageList = ImageHelper.CreateImageCollectionFromResources("DevExpress.XtraEditors.Images.Editors.bmp", typeof(PictureMenu).Assembly, new Size(0x10, 0x10), Color.Empty); imageList.Images[12].Save("12.bmp"); //img = (Bitmap)Bitmap.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("DevExpress.XtraEditors.Images.Editors.bmp")); } catch (Exception) { } comboBoxEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; comboBoxEdit1.Properties.Items.AddRange(Enumerable.Range(65, 26).Select(item => (object)(new string((char)item, 10))).ToArray()); //timeEdit1.Properties.ReadOnly = true; timeEdit1.Enabled = false; listOfAction.Add(GridViewCustomDrawRowIndicatorFake); DecimalVictim = 1.123456789010000m; //DecimalVictim = 0.00000001m; spinEdit1.DataBindings.Add("EditValue", this, "DecimalVictim", false, DataSourceUpdateMode.OnPropertyChanged); //spinEdit1.EditValueChanged += SpinEditEditValueChanged; //spinEdit1.CustomDisplayText += SpinEditCustomDisplayText; toggleSwitch1.DataBindings.Add("EditValue", this, "BoolVictim4ToggleSwitch", false, DataSourceUpdateMode.OnPropertyChanged); _toggleSwitch2Binding = toggleSwitch2.DataBindings.Add(/*"EditValue"*/ "IsOn", this, "DefaultBooleanVictim4ToggleSwitch", true, DataSourceUpdateMode.OnPropertyChanged); _toggleSwitch2Binding.Parse += ToggleSwitchBindingParse; _toggleSwitch2Binding.Format += ToggleSwitchBindingFormat; _toggleSwitch2Binding.BindingComplete += ToggleSwitchBindingBindingComplete; buttonEdit1.ReadOnly = true; buttonEdit1.ButtonClick += ButtonEdit1_ButtonClick; buttonEdit1.Properties.Buttons[1].Enabled = false; buttonEdit1.EditValue = "blah-blah-blah"; }