Sign in to follow this  

[.net] [C# , Compact Framework 1.1] Component creation / updating visual problem.

This topic is 4395 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I have a standard form, however some (lots of) buttons are created using code inside the constructor. During the creation of these buttons the form is updated, resulting in it being visible (even though it's pretty fast) that each control is added to the form (row by row, each for from left to right). Is there any way to avoid this? ::::: EXAMPLE CODE BEGIN
public FormClassName()
{
  // This is the constructor of "public class FromClassName : System.Windows.Forms.Form"

  //
  // Required for Windows Form Designer support
  //
  InitializeComponent();

  //
  // TODO: Add any constructor code after InitializeComponent call
  //

  // BEGIN: I would like everything inside the for-loops to turn up "at once"
  for (int j = 0 ; j < 8 ; j++)
    for (int i = 0 ; i < 8 ; i++)
    {
      Button b = new System.Windows.Forms.Button();
      b.Parent = this;
      b.Bounds = new Rectangle(0,0,20,20);
      b.Location = new System.Drawing.Point(i * b.Width, j * b.Height);
      this.Controls.Add(b);
    }
  //   END: I would like everything inside the for-loops to turn up "at once"
}
::::: EXAMPLE CODE END Is this possible? And if I am not making myself clear don't hesitate to tell me so. [Edited by - kentylarsson on November 29, 2005 8:20:51 PM]

Share this post


Link to post
Share on other sites
Thanks for you answer! Unfortunately I need to stick with Compact Framework 1.1, which makes those two methods unavailable. Otherwise it would have worked.

Anyone else who has any idea?

[edit] LiyonDR: No it's not available using the CF 1.1 either. :(

[edit2]

I found out about Control.CopyTo() and used it instead without any improvement.

[Edited by - kentylarsson on November 30, 2005 1:57:56 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
public FormClassName()
{
// This is the constructor of "public class FromClassName : System.Windows.Forms.Form"

//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//

// BEGIN: I would like everything inside the for-loops to turn up "at once"
for (int j = 0 ; j <

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
sorry about that previous post - not sure what happened there.

try setting b.Visible = false before this.Controls.Add(b)

then add this code at the end:

foreach( Control ctl in this.Controls )
{
ctl.Visible = true;
}


this way all controls are added to the form invisible then shown together at the end, hope this helps.

Share this post


Link to post
Share on other sites
Quote:
Original post by kentylarsson
Thanks for you answer! Unfortunately I need to stick with Compact Framework 1.1, which makes those two methods unavailable. Otherwise it would have worked.

Anyone else who has any idea?

[edit] LiyonDR: No it's not available using the CF 1.1 either. :(

[edit2]

I found out about Control.CopyTo() and used it instead without any improvement.


Perhaps you should learn to RTFM, because SuspendLayout and ResumeLayout are part of the .NET framework 1.1. I've seen it many times in the Auto generated code, and I check the MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolclasssuspendlayouttopic.asp

That link, will indeed tell you that SuspendLayout/ResumeLayout are part of the .NET 1.1 framework.

Toolmaker

Share this post


Link to post
Share on other sites
Quote:
Original post by Toolmaker
Quote:
Original post by kentylarsson
Thanks for you answer! Unfortunately I need to stick with Compact Framework 1.1, which makes those two methods unavailable. Otherwise it would have worked.

Anyone else who has any idea?

[edit] LiyonDR: No it's not available using the CF 1.1 either. :(

[edit2]

I found out about Control.CopyTo() and used it instead without any improvement.


Perhaps you should learn to RTFM, because SuspendLayout and ResumeLayout are part of the .NET framework 1.1. I've seen it many times in the Auto generated code, and I check the MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolclasssuspendlayouttopic.asp

That link, will indeed tell you that SuspendLayout/ResumeLayout are part of the .NET 1.1 framework.

Toolmaker


Thanks for your hilarious answer Toolmaker! You managed to be both unhelpful, unfriendly and most of all incompetent. And all at the same time!

If you tell someone else to RTFM you should at least be able to read it yourself, and be able to correctly read the topic you're replying to.

1. The question was about .NET Compact Framework 1.1, it even said so in your quote of my post.
2. SuspendLayout and ResumeLayout are not part of .NET Compact Framework 1.1. The methods which are availible in CF 1.1 are marked so under the method name in the list. Look in MSDN for confirmation: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWindowsFormsControlMethodsTopic.asp

Anonymous Poster
I'll try your suggestion later today, I hope that it will solve my problem but I am doubtful. Thanks for you answer!

Share this post


Link to post
Share on other sites

This topic is 4395 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this