本文整理汇总了C#中System.Windows.Forms.DataGridView.DoubleBuffered方法的典型用法代码示例。如果您正苦于以下问题:C# DataGridView.DoubleBuffered方法的具体用法?C# DataGridView.DoubleBuffered怎么用?C# DataGridView.DoubleBuffered使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGridView
的用法示例。
在下文中一共展示了DataGridView.DoubleBuffered方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: openFile
private async void openFile(string fileName)
{
try
{
dynamic file = null;
var dgv = new DataGridView();
// Display the hidden progressbar in the statusbar.
pbProgress.Visible = true;
// Determine what file type it is and cast to the appropriate type.
switch (Path.GetExtension(fileName))
{
case ".shn":
if (Path.GetFileNameWithoutExtension(fileName).ToLower() == "questdata")
{
file = new QuestFile(fileName);
Program.LoadedFiles.Add(file);
Extensions.FileType = FileType.QuestFile;
var mainTab = new TabPage("QuestFile");
var qTab = new TabPage("Quests");
var dTab = new TabPage("Dialouges");
mainTab.BackColor = Color.White;
dTab.BackColor = Color.White;
qTab.BackColor = Color.White;
var tc = new TabControl();
tc.Dock = DockStyle.Fill;
qTab.Padding = new Padding(0, 5, 0, 0);
dTab.Padding = new Padding(0, 5, 0, 0);
mainTab.Padding = new Padding(0, 5, 0, 0);
tc.TabPages.Add(qTab);
tc.TabPages.Add(dTab);
mainTab.Controls.Add(tc);
var qPanel = new QuestPanel(file);
qPanel.Dock = DockStyle.Fill;
qTab.BackColor = Color.White;
qTab.Controls.Add(qPanel);
tcFiles.TabPages.Add(mainTab);
tcFiles.SelectedIndex = tcFiles.TabPages.Count - 1;
pbProgress.Visible = false;
pbProgress.Value = 0;
lblStatus.Text = "Ready";
updateFileInfo();
return;
}
file = new SHNFile(fileName);
Extensions.FileType = FileType.SHNFile;
break;
case ".txt":
file = new ShineFile(fileName);
Extensions.FileType = FileType.ShineFile;
break;
default:
throw new Exception("File type not supported");
}
lblStatus.Text = "Reading " + Path.GetFileName(fileName);
// Await the asynchronous Load method and display the reported progress in our progressbar.
await Task.Run(() => file.Load(new Progress<int>(value =>
mainStatusStrip.Invoke(new MethodInvoker(() =>
{
pbProgress.Value = value;
}))
)));
Program.LoadedFiles.Add(file);
if (file.GetType() == typeof(SHNFile))
{
dgv = new DataGridView();
dgv.Dock = DockStyle.Fill;
dgv.BackgroundColor = Color.WhiteSmoke;
dgv.DoubleBuffered(true);
dgv.DataSource = file;
dgv.CellEnter += File_CellEnter;
var tab = new TabPage(file.TableName);
file.RowChanged += new DataRowChangeEventHandler(File_RowChanged);
tab.Controls.Add(dgv);
tcFiles.TabPages.Add(tab);
tcFiles.SelectedIndex = tcFiles.TabPages.Count - 1;
}
else if (file.GetType() == typeof(ShineFile))
//.........这里部分代码省略.........
示例2: createFile
private async void createFile(IFile file)
{
try
{
var dgv = new DataGridView();
if (file.GetType() == typeof(QuestFile))
{
file = file ?? new QuestFile("");
Program.LoadedFiles.Add(file);
Extensions.FileType = FileType.QuestFile;
var mainTab = new TabPage("QuestFile");
var qTab = new TabPage("Quests");
var dTab = new TabPage("Dialouges");
mainTab.BackColor = Color.White;
dTab.BackColor = Color.White;
qTab.BackColor = Color.White;
var tc = new TabControl();
tc.Dock = DockStyle.Fill;
qTab.Padding = new Padding(0, 5, 0, 0);
dTab.Padding = new Padding(0, 5, 0, 0);
mainTab.Padding = new Padding(0, 5, 0, 0);
tc.TabPages.Add(qTab);
tc.TabPages.Add(dTab);
mainTab.Controls.Add(tc);
var qPanel = new QuestPanel((QuestFile)file);
qPanel.Dock = DockStyle.Fill;
qTab.Controls.Add(qPanel);
mainTab.Controls.Add(tc);
tcFiles.TabPages.Add(mainTab);
tcFiles.SelectedIndex = tcFiles.TabPages.Count - 1;
}
else if (file.GetType() == typeof(SHNFile))
{
dgv = new DataGridView();
dgv.Dock = DockStyle.Fill;
dgv.BackgroundColor = Color.WhiteSmoke;
dgv.DoubleBuffered(true);
dgv.DataSource = file;
((SHNFile)file).CreateFile();
dgv.CellEnter += File_CellEnter;
var tab = new TabPage(((DataTable)file).TableName);
((DataTable)file).RowChanged += new DataRowChangeEventHandler(File_RowChanged);
tab.Controls.Add(dgv);
tcFiles.TabPages.Add(tab);
tcFiles.SelectedIndex = tcFiles.TabPages.Count - 1;
}
else if (file.GetType() == typeof(ShineFile))
{
var mainTab = new TabPage(((ShineFile)file).DataSetName);
var tcTables = new TabControl();
tcTables.Dock = DockStyle.Fill;
tcTables.SelectedIndexChanged += new EventHandler((object s, EventArgs e) =>
{
((ShineFile)file).SelectedIndex = tcTables.SelectedIndex;
});
mainTab.Controls.Add(tcTables);
tcFiles.TabPages.Add(mainTab);
mainTab.BackColor = Color.White;
tcFiles.SelectedIndex = tcFiles.TabCount - 1;
foreach (var table in ((ShineFile)file).Tables)
{
dgv = new DataGridView();
dgv.Dock = DockStyle.Fill;
dgv.BackgroundColor = Color.WhiteSmoke;
dgv.DoubleBuffered(true);
dgv.DataSource = table;
dgv.CellEnter += File_CellEnter;
var tab = new TabPage(((DataTable)table).TableName);
((DataTable)table).RowChanged += new DataRowChangeEventHandler(File_RowChanged);
tab.Controls.Add(dgv);
tcTables.TabPages.Add(tab);
}
}
updateFileInfo();
}
catch (Exception ex)
{
pbProgress.Visible = false;
pbProgress.Value = 0;
//.........这里部分代码省略.........