Removing flash during resize
C#
3
Posts
2
Posters
0
Views
1
Watching
-
If window is resized, listbox flashes. how to remove flash during resize ?
using System;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Drawing;public class Test
{
static void Main()
{
Application.Run(new ReportDialogForm());
}
}class ReportDialogForm : Form
{public ReportDialogForm() { tabControl1 = new TabControl(); tabPage1 = new TabPage(); reportListBox = new ListBox(); tabControl1.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right))); tabControl1.Controls.Add(tabPage1); tabControl1.Location = new Point(0, 0); tabControl1.Padding = new Point(0, 0); tabControl1.SelectedIndex = 0; tabControl1.Size = new Size(591, 296); tabControl1.TabIndex = 0; tabPage1.Controls.Add(reportListBox); tabPage1.Location = new Point(4, 29); tabPage1.Margin = new Padding(0); tabPage1.Size = new Size(583, 263); tabPage1.TabIndex = 0; tabPage1.Layout += new LayoutEventHandler(tabPage1\_Layout); reportListBox.Anchor = AnchorStyles.None; reportListBox.Size = new Size(287, 384); reportListBox.TabIndex = 1000; ClientSize = new Size(588, 292); Controls.Add(tabControl1); for (int i = 0; i < 100; i++) reportListBox.Items.Add( "MMMMMMMMMMMMMMMMMMMMMM"); Load += new EventHandler(ReportDialogForm\_Load); } void ReportDialogForm\_Load(object sender, EventArgs e) { StartPosition = FormStartPosition.Manual; Location = new Point(10, 10); ClientSize = new Size(400, 400); } void tabPage1\_Layout(object sender, LayoutEventArgs e) { SuspendLayout(); int height = 100; reportListBox.Top = height; reportListBox.Height = tabPage1.Height - height; reportListBox.Width = tabPage1.Width / 2; reportListBox.Left = 0; ResumeLayout(); } TabControl tabControl1; TabPage tabPage1; ListBox reportListBox;
}
Andrus
-
If window is resized, listbox flashes. how to remove flash during resize ?
using System;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Drawing;public class Test
{
static void Main()
{
Application.Run(new ReportDialogForm());
}
}class ReportDialogForm : Form
{public ReportDialogForm() { tabControl1 = new TabControl(); tabPage1 = new TabPage(); reportListBox = new ListBox(); tabControl1.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right))); tabControl1.Controls.Add(tabPage1); tabControl1.Location = new Point(0, 0); tabControl1.Padding = new Point(0, 0); tabControl1.SelectedIndex = 0; tabControl1.Size = new Size(591, 296); tabControl1.TabIndex = 0; tabPage1.Controls.Add(reportListBox); tabPage1.Location = new Point(4, 29); tabPage1.Margin = new Padding(0); tabPage1.Size = new Size(583, 263); tabPage1.TabIndex = 0; tabPage1.Layout += new LayoutEventHandler(tabPage1\_Layout); reportListBox.Anchor = AnchorStyles.None; reportListBox.Size = new Size(287, 384); reportListBox.TabIndex = 1000; ClientSize = new Size(588, 292); Controls.Add(tabControl1); for (int i = 0; i < 100; i++) reportListBox.Items.Add( "MMMMMMMMMMMMMMMMMMMMMM"); Load += new EventHandler(ReportDialogForm\_Load); } void ReportDialogForm\_Load(object sender, EventArgs e) { StartPosition = FormStartPosition.Manual; Location = new Point(10, 10); ClientSize = new Size(400, 400); } void tabPage1\_Layout(object sender, LayoutEventArgs e) { SuspendLayout(); int height = 100; reportListBox.Top = height; reportListBox.Height = tabPage1.Height - height; reportListBox.Width = tabPage1.Width / 2; reportListBox.Left = 0; ResumeLayout(); } TabControl tabControl1; TabPage tabPage1; ListBox reportListBox;
}
Andrus