Loading...
Loading...
Compare original and translation side by side
using Syncfusion.Windows.Forms.Tools;
namespace MyWinFormsApp
{
public partial class Form1 : Form
{
private EditableList editableList1;
public Form1()
{
InitializeComponent();
SetupEditableList();
}
private void SetupEditableList()
{
// Create and initialize
this.editableList1 = new EditableList();
this.editableList1.Location = new System.Drawing.Point(20, 20);
this.editableList1.Size = new System.Drawing.Size(300, 200);
// Populate items
this.editableList1.ListBox.Items.AddRange(new object[] {
"Item 1",
"Item 2",
"Item 3"
});
// Apply modern style
this.editableList1.Style = Syncfusion.Windows.Forms.Appearance.Office2016;
// Add to form
this.Controls.Add(this.editableList1);
}
}
}Imports Syncfusion.Windows.Forms.Tools
Public Class Form1
Private editableList1 As EditableList
Public Sub New()
InitializeComponent()
SetupEditableList()
End Sub
Private Sub SetupEditableList()
' Create and initialize
Me.editableList1 = New EditableList()
Me.editableList1.Location = New System.Drawing.Point(20, 20)
Me.editableList1.Size = New System.Drawing.Size(300, 200)
' Populate items
Me.editableList1.ListBox.Items.AddRange(New Object() {
"Item 1",
"Item 2",
"Item 3"
})
' Apply modern style
Me.editableList1.Style = Syncfusion.Windows.Forms.Appearance.Office2016
' Add to form
Me.Controls.Add(Me.editableList1)
End Sub
End Classusing Syncfusion.Windows.Forms.Tools;
namespace MyWinFormsApp
{
public partial class Form1 : Form
{
private EditableList editableList1;
public Form1()
{
InitializeComponent();
SetupEditableList();
}
private void SetupEditableList()
{
// Create and initialize
this.editableList1 = new EditableList();
this.editableList1.Location = new System.Drawing.Point(20, 20);
this.editableList1.Size = new System.Drawing.Size(300, 200);
// Populate items
this.editableList1.ListBox.Items.AddRange(new object[] {
"Item 1",
"Item 2",
"Item 3"
});
// Apply modern style
this.editableList1.Style = Syncfusion.Windows.Forms.Appearance.Office2016;
// Add to form
this.Controls.Add(this.editableList1);
}
}
}Imports Syncfusion.Windows.Forms.Tools
Public Class Form1
Private editableList1 As EditableList
Public Sub New()
InitializeComponent()
SetupEditableList()
End Sub
Private Sub SetupEditableList()
' Create and initialize
Me.editableList1 = New EditableList()
Me.editableList1.Location = New System.Drawing.Point(20, 20)
Me.editableList1.Size = New System.Drawing.Size(300, 200)
' Populate items
Me.editableList1.ListBox.Items.AddRange(New Object() {
"Item 1",
"Item 2",
"Item 3"
})
' Apply modern style
Me.editableList1.Style = Syncfusion.Windows.Forms.Appearance.Office2016
' Add to form
Me.Controls.Add(Me.editableList1)
End Sub
End Class// Bind to a data source
List<string> dataSource = new List<string>();
dataSource.Add("Product A");
dataSource.Add("Product B");
dataSource.Add("Product C");
this.editableList1.ListBox.DataSource = dataSource;// Bind to a data source
List<string> dataSource = new List<string>();
dataSource.Add("Product A");
dataSource.Add("Product B");
dataSource.Add("Product C");
this.editableList1.ListBox.DataSource = dataSource;User Interaction:
1. Click on an item to select it
2. Click again to enter edit mode (TextBox appears)
3. Edit the text in the TextBox
4. Change focus (click elsewhere, press Tab)
5. List updates automatically with edited value用户交互流程:
1. 点击列表项选中
2. 再次点击进入编辑模式(显示TextBox)
3. 在TextBox中编辑文本
4. 切换焦点(点击其他位置、按下Tab键)
5. 列表自动更新为编辑后的值// Enable automatic scrollbars
this.editableList1.AutoScroll = true;
this.editableList1.AutoScrollMargin = new System.Drawing.Size(2, 2);
this.editableList1.AutoScrollMinSize = new System.Drawing.Size(3, 3);// Enable automatic scrollbars
this.editableList1.AutoScroll = true;
this.editableList1.AutoScrollMargin = new System.Drawing.Size(2, 2);
this.editableList1.AutoScrollMinSize = new System.Drawing.Size(3, 3);// Display button on the right during editing
this.editableList1.WantButton = true;
// Handle button click if needed
this.editableList1.Button.Click += (s, e) => {
MessageBox.Show("Button clicked!");
};// Display button on the right during editing
this.editableList1.WantButton = true;
// Handle button click if needed
this.editableList1.Button.Click += (s, e) => {
MessageBox.Show("Button clicked!");
};// Apply Office2016 theme with color scheme
this.editableList1.Style = Syncfusion.Windows.Forms.Appearance.Office2016;
this.editableList1.Office2016ColorScheme = ScrollBarOffice2016ColorScheme.Colorful;// Apply Office2016 theme with color scheme
this.editableList1.Style = Syncfusion.Windows.Forms.Appearance.Office2016;
this.editableList1.Office2016ColorScheme = ScrollBarOffice2016ColorScheme.Colorful;| Property | Description | Example |
|---|---|---|
| ListBox | Access to embedded ListBox control | |
| TextBox | Access to editing TextBox control | |
| Button | Access to optional button control | |
| WantButton | Show/hide button during editing | |
| AutoScroll | Enable automatic scrollbars | |
| Style | Visual appearance style | |
| DockPadding | Padding for docked controls | |
| 属性 | 描述 | 示例 |
|---|---|---|
| ListBox | 访问内置ListBox控件 | |
| TextBox | 访问编辑用TextBox控件 | |
| Button | 访问可选按钮控件 | |
| WantButton | 编辑时显示/隐藏按钮 | |
| AutoScroll | 启用自动滚动条 | |
| Style | 视觉外观样式 | |
| DockPadding | 停靠控件的内边距 | |
// ListBox events
this.editableList1.ListBox.SelectedIndexChanged += ListBox_SelectedIndexChanged;
this.editableList1.ListBox.Click += ListBox_Click;
// TextBox events
this.editableList1.TextBox.TextChanged += TextBox_TextChanged;
this.editableList1.TextBox.Leave += TextBox_Leave;
// Button events (if WantButton = true)
this.editableList1.Button.Click += Button_Click;// ListBox事件
this.editableList1.ListBox.SelectedIndexChanged += ListBox_SelectedIndexChanged;
this.editableList1.ListBox.Click += ListBox_Click;
// TextBox事件
this.editableList1.TextBox.TextChanged += TextBox_TextChanged;
this.editableList1.TextBox.Leave += TextBox_Leave;
// Button事件(当WantButton = true时可用)
this.editableList1.Button.Click += Button_Click;