如何重置 pivotGridControl 设置 (DevExpress)?
How to reset pivotGridControl settings (DevExpress)?
Сannot update form butReset_Click
不工作 RestoreLayoutFromRegistry
从另一个表单。怎么做才对?我从另一个表单创建了一个表单,有必要从 2 个表单中重置 pivotGridControl
设置。我无法重置设置。
namespace WindowsFormsApp4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
butReset.Click += new System.EventHandler(butReset_Click);
pivotGridControl1.SaveLayoutToRegistry(regKey);
}
string regKey = "DevExpress\XtraPivotGrid\Layouts\PivotGridLayout";
public Button butLoad = new Button();
public Button butReset = new Button();
public void LoadBtn_Click(object sender, EventArgs e)
{
Form1 fr = new Form1();
Form form = new Form();
form.Show();
ListBox listBox1 = new ListBox();
listBox1.Size = new System.Drawing.Size(200, 100);
listBox1.Location = new System.Drawing.Point(10, 10);
form.Controls.Add(listBox1);
listBox1.MultiColumn = true;
listBox1.SelectionMode = SelectionMode.MultiExtended;
DirectoryInfo dir = new DirectoryInfo(@"E:\");
FileInfo[] files = dir.GetFiles("*.txt");
butReset.Text = "Сбросить настройки";
butReset.Location = new Point(140, 160);
form.Controls.Add(butReset);
butLoad.Text = "Принять";
butLoad.Location = new Point(30, 160);
form.Controls.Add(butLoad);
var fileNamesWithoutExtension = files
.Select(fi => Path.GetFileNameWithoutExtension(fi.Name));
foreach (string fn in fileNamesWithoutExtension)
{
listBox1.Items.Add(fn.ToString());
}
}
private void SaveBtn_Click(object sender, EventArgs e)
{
pivotGridControl1.RestoreLayoutFromRegistry(regKey);
}
static public void butReset_Click(object sender, EventArgs e)
{
Form1 er = new Form1();
er.pivotGridControl1.RestoreLayoutFromRegistry(er.regKey);
//MessageBox.Show("dsdsdfsdf");
}
}
}
使用PivotGridOptionsDataField.Reset()
方法将所有选项重置为默认值。你的情况
static public void butReset_Click(object sender, EventArgs e)
{
pivotGridControl1.Reset();
}
参考文档:https://docs.devexpress.com/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridOptionsDataField.Reset
Сannot update form butReset_Click
不工作 RestoreLayoutFromRegistry
从另一个表单。怎么做才对?我从另一个表单创建了一个表单,有必要从 2 个表单中重置 pivotGridControl
设置。我无法重置设置。
namespace WindowsFormsApp4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
butReset.Click += new System.EventHandler(butReset_Click);
pivotGridControl1.SaveLayoutToRegistry(regKey);
}
string regKey = "DevExpress\XtraPivotGrid\Layouts\PivotGridLayout";
public Button butLoad = new Button();
public Button butReset = new Button();
public void LoadBtn_Click(object sender, EventArgs e)
{
Form1 fr = new Form1();
Form form = new Form();
form.Show();
ListBox listBox1 = new ListBox();
listBox1.Size = new System.Drawing.Size(200, 100);
listBox1.Location = new System.Drawing.Point(10, 10);
form.Controls.Add(listBox1);
listBox1.MultiColumn = true;
listBox1.SelectionMode = SelectionMode.MultiExtended;
DirectoryInfo dir = new DirectoryInfo(@"E:\");
FileInfo[] files = dir.GetFiles("*.txt");
butReset.Text = "Сбросить настройки";
butReset.Location = new Point(140, 160);
form.Controls.Add(butReset);
butLoad.Text = "Принять";
butLoad.Location = new Point(30, 160);
form.Controls.Add(butLoad);
var fileNamesWithoutExtension = files
.Select(fi => Path.GetFileNameWithoutExtension(fi.Name));
foreach (string fn in fileNamesWithoutExtension)
{
listBox1.Items.Add(fn.ToString());
}
}
private void SaveBtn_Click(object sender, EventArgs e)
{
pivotGridControl1.RestoreLayoutFromRegistry(regKey);
}
static public void butReset_Click(object sender, EventArgs e)
{
Form1 er = new Form1();
er.pivotGridControl1.RestoreLayoutFromRegistry(er.regKey);
//MessageBox.Show("dsdsdfsdf");
}
}
}
使用PivotGridOptionsDataField.Reset()
方法将所有选项重置为默认值。你的情况
static public void butReset_Click(object sender, EventArgs e)
{
pivotGridControl1.Reset();
}
参考文档:https://docs.devexpress.com/CoreLibraries/DevExpress.XtraPivotGrid.PivotGridOptionsDataField.Reset