Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / August 2005

Tip: Looking for answers? Try searching our database.

UserControl on inherited form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sebastian Bargmann - 05 Aug 2005 10:39 GMT
Hi,

I'm having a mysterious problem in the designer. I have created a simple
usercontrol, which apparantly works fine except when placed on a inherited
form in the designer.

I drop the control on the form. Change one of the properties in the designer
(a color-setting in this case) and hit "build". The property then reverts to
its default value (defined in the constructor).

For some reason, when using an inherited form, the usercontrol's ctor is
called when I hit "build". But the designer fails to either save/load the
new value before/after doing so.

I'm guessing that I'm missing some vital attribute somewhere - relevant code
sections below:

<code>

public class Bevel : System.Windows.Forms.UserControl
{
  private Color highlightColor;
  [...]

  public Bevel()
  {
     InitializeComponent();
     highlightColor = SystemColors.ControlLightLight;
     [...]
  }

  private void InitializeComponent()
  {
    components = new System.ComponentModel.Container();
  }

  [Category("Appearance")]
  [Description ("Highlight color")]
  [DefaultValue(typeof(Color), "ControlLightLight")]
  public Color HighlightColor
  {
    get
    {
      return highlightColor;
    }
    set
    {
      highlightColor = value;
      Invalidate();
    }
  }
 [...]
}

</code>

Any clues?

Thanks,
Sebastian
Allen Anderson - 13 Aug 2005 19:57 GMT
are you certian this only happens with an inherited form?  have you tried a regular form to make sure it's not a problem with the serialization of the property?  what is the type of the property?

>Hi,
>
[quoted text clipped - 56 lines]
>Thanks,
>Sebastian
Sebastian Bargmann - 16 Aug 2005 06:55 GMT
Hi Allen,

> are you certian this only happens with an inherited form?  have you tried
> a regular form to make sure it's not a problem with the serialization of
> the property?  what is the type of the property?

Yes, I only happens when dealing with inherited forms. The type of the
property is Color - but it happens with other types as well (enums at
least).

Thanks,
Sebatian

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.