Click here to Skip to main content
15,895,462 members
Home / Discussions / Windows Forms
   

Windows Forms

 
AnswerRe: i got error Pin
smartyP18-Sep-07 3:37
smartyP18-Sep-07 3:37 
AnswerRe: i got error Pin
Paul Conrad27-Oct-07 11:27
professionalPaul Conrad27-Oct-07 11:27 
QuestionDatagridview Pin
somagunasekaran17-Sep-07 20:18
somagunasekaran17-Sep-07 20:18 
AnswerRe: Datagridview Pin
Paul Conrad27-Oct-07 11:28
professionalPaul Conrad27-Oct-07 11:28 
QuestionBindingList versus DataGridview.Rows.Add Pin
dreamz648016-Sep-07 22:45
dreamz648016-Sep-07 22:45 
AnswerRe: BindingList versus DataGridview.Rows.Add Pin
Urs Enzler17-Sep-07 2:02
Urs Enzler17-Sep-07 2:02 
AnswerRe: BindingList versus DataGridview.Rows.Add Pin
dreamz648017-Sep-07 19:40
dreamz648017-Sep-07 19:40 
QuestionSlow repaint of controls [modified] Pin
MrRobot16-Sep-07 21:36
MrRobot16-Sep-07 21:36 
so here quick and dirt code to illustrate problem i have.
PROBLEM: when you have controls more that few, it tooks a lot of time for redraw them all.
this redrawing it visible and horrible.
even if you using custom control with (i think) faster repaint, it nosense...

so, maybe there's some styles or properties or something to make it faster?
or some other techniques?

--
yours,
mrRobot.

-- modified at 6:29 Monday 17th September, 2007
as i found here:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2044742&SiteID=1

there is no good solution for this problem. it possible to freeze window/control for repainting, but no speedup at all. sad.

/*
 * mr_robot test custom control
 * */
using System;
using System.Drawing;
using System.Windows.Forms;

namespace custCompTest2
{

	public class custCompTest2 : Form
	{
		public custCompTest2()
		{
			//kind of inline InitializeComponent()
			this.Name = "custCompTest2";
			this.Text = "custCompTest2";
			this.ClientSize = new System.Drawing.Size(400, 400);

			for(int n=0; n<800; n++)
				this.Controls.Add( (new tgC()) );
		
		}//~: custCompTest2()

		protected override void OnSizeChanged(EventArgs e)
		{
			this.SuspendLayout();
			int x=0, y=0, w=Width/40, h=Height/21;
			foreach (Control c1 in Controls)
			{
				c1.Location = new Point(x,y);
				c1.Size = new Size(w,h);
				if(x+w*2+1<Width) { x+=w; } else { x=0;y+=h; }
			}
			this.ResumeLayout(false);
		}
		
		protected override void OnLoad(EventArgs e)
		{
			this.OnSizeChanged(e);
		}
		
		// UPDATED!
		// kind of BAD SOLUTION from:
		// http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2044742&SiteID=1
		/*
		protected override CreateParams CreateParams { 
			get { 
				CreateParams cp = base.CreateParams; 
				cp.ExStyle |= 0x02000000; 
				return cp; 
			} 
		}
		*/

		[STAThread]
		static void Main() 
		{
			Application.Run(new custCompTest2());
		}
	
	}//~: custCompTest2 : Form

	public class tgC : Control
	{
		public tgC()
		{
        	this.SetStyle(
            	ControlStyles.UserPaint | //paints itself and is not painted by the system operation.
            	ControlStyles.AllPaintingInWmPaint | // ignores the OnPaintBackground
            	ControlStyles.DoubleBuffer | // Double buffering
            	ControlStyles.ResizeRedraw  // repaint itself when resized.
            	, true);
		}
		
		protected override void OnPaint(PaintEventArgs e)
		{
			Graphics g = e.Graphics;
			g.DrawRectangle(Pens.Black, 1,1, Width-2, Height-2);
		}

	}//~: tgC : Control

}

AnswerRe: Slow repaint of controls Pin
Luc Pattyn16-Sep-07 22:51
sitebuilderLuc Pattyn16-Sep-07 22:51 
GeneralRe: Slow repaint of controls Pin
MrRobot17-Sep-07 0:50
MrRobot17-Sep-07 0:50 
GeneralRe: Slow repaint of controls Pin
Luc Pattyn17-Sep-07 1:19
sitebuilderLuc Pattyn17-Sep-07 1:19 
GeneralRe: Slow repaint of controls Pin
MrRobot17-Sep-07 2:57
MrRobot17-Sep-07 2:57 
GeneralRe: Slow repaint of controls Pin
Luc Pattyn17-Sep-07 2:59
sitebuilderLuc Pattyn17-Sep-07 2:59 
GeneralRe: Slow repaint of controls Pin
MrRobot17-Sep-07 5:44
MrRobot17-Sep-07 5:44 
GeneralRe: Slow repaint of controls Pin
Dave Kreskowiak17-Sep-07 13:54
mveDave Kreskowiak17-Sep-07 13:54 
GeneralRe: Slow repaint of controls Pin
MrRobot17-Sep-07 21:45
MrRobot17-Sep-07 21:45 
AnswerRe: Slow repaint of controls Pin
MrRobot17-Sep-07 0:28
MrRobot17-Sep-07 0:28 
QuestionToolstrip control Work like toolbox in vs2005 Pin
VB 8.013-Sep-07 20:33
VB 8.013-Sep-07 20:33 
QuestionImage Background in a RichTextBox Pin
Stige13-Sep-07 11:52
Stige13-Sep-07 11:52 
AnswerRe: Image Background in a RichTextBox Pin
DigiOz Multimedia16-Sep-07 12:49
DigiOz Multimedia16-Sep-07 12:49 
QuestionWebBrowser Control. Urgent. Pin
Elizma13-Sep-07 6:18
Elizma13-Sep-07 6:18 
AnswerRe: WebBrowser Control. Urgent. Pin
Paul Conrad26-Sep-07 16:18
professionalPaul Conrad26-Sep-07 16:18 
QuestionRunTime How to Set A Object Type Pin
M.Sathiskumar13-Sep-07 0:49
M.Sathiskumar13-Sep-07 0:49 
AnswerRe: RunTime How to Set A Object Type Pin
Lutosław17-Sep-07 4:40
Lutosław17-Sep-07 4:40 
QuestionUser Control with container area? [modified] Pin
MrBean12-Sep-07 23:23
MrBean12-Sep-07 23:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.