471,605 Members | 1,688 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,605 software developers and data experts.

Loading Controls Programatically

Hi,

I am using C# VS2005 and I am having a problem that I did not notice
before in VS2003.

I have created myUserControl that contains a Panel. The panel is
loaded dynamically with a number of ListViews. The number depends on
the size of the form (therefore the size of the panel which is
anchored to resize when form is resized.

Basically, I load my ListView as:

Panel.SuspendLayout();

// Loads a number of ListViews depending on Panel size
LoadListViewControls(Panel.Size);

Panel.ResumeLayout();

I have 2 questions:
1. Should I dispose my dynamically loaded listviews when reloading
panel or resizing it?

2. I have noticed that when I drag another window over my form, the
properties of my ListViews (ForeColor and Font) change to the same
properties of container (my panel). So my ListViews which had
programatically set ForeColor and Font to say Red, Arial will change
to panels properties which are say MS Sans Sarif, Black. (It also
happens when form is maximized on ListViews that were not visible
before maximize).
How to fix this?

Any Help Will Be Appreciated,

_dino_
Jan 16 '06 #1
1 2126
For those interested, I have found out that this is rather an IDE
issue than coding issue. When I run my application from IDE, this
repainting problem occurs, when I run it from compiled .exe, the
problem is gone.

_dino_

On Mon, 16 Jan 2006 18:51:28 GMT, Dino Buljubasic
<di**@noplacelikehome.com> wrote:
Hi,

I am using C# VS2005 and I am having a problem that I did not notice
before in VS2003.

I have created myUserControl that contains a Panel. The panel is
loaded dynamically with a number of ListViews. The number depends on
the size of the form (therefore the size of the panel which is
anchored to resize when form is resized.

Basically, I load my ListView as:

Panel.SuspendLayout();

// Loads a number of ListViews depending on Panel size
LoadListViewControls(Panel.Size);

Panel.ResumeLayout();

I have 2 questions:
1. Should I dispose my dynamically loaded listviews when reloading
panel or resizing it?

2. I have noticed that when I drag another window over my form, the
properties of my ListViews (ForeColor and Font) change to the same
properties of container (my panel). So my ListViews which had
programatically set ForeColor and Font to say Red, Arial will change
to panels properties which are say MS Sans Sarif, Black. (It also
happens when form is maximized on ListViews that were not visible
before maximize).
How to fix this?

Any Help Will Be Appreciated,

_dino_


Jan 23 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by John Richardson | last post: by
3 posts views Thread by markeboy | last post: by
1 post views Thread by John Cosmas | last post: by
reply views Thread by Phl | last post: by
1 post views Thread by Dino Buljubasic | last post: by
3 posts views Thread by =?Utf-8?B?cml2YWxAbmV3c2dyb3Vwcy5ub3NwYW0=?= | last post: by
2 posts views Thread by adiel_g | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.