locked
Problem with visual inheritance RRS feed

  • Question

  • Hi folks

    I'm trying to develop a simple heirarchy of dialogs.

    The base form contains standard OK/Cancel buttons whose parent is a panel docked to the bottom of the form. I've checked the generated code, and they have been placed correctly as children of the panel.

    When I build the project, the positioning of the buttons on the derived forms changes somewhat randomly within the panel. Sometimes they place themselves partially or entirely off LHS the form.

    I've tried this with the buttons unanchored, anchored to the right of the panel, and anchored to the top, bottom, right of the panel. Same result :-(

    Any tips would be most welcome. I've come to a grinding halt till I can find a fix...


    Thursday, January 26, 2006 3:25 PM

Answers

  • this is a bug with .NET 1.1 visual inheritance for windows forms particularly anchoring.  Somewhat related to the bug reported here.  I myself had hit this roadblock and i blogged about it here

    I saw using reflector that in .NET 2.0 is making this property changes at design time transactional which is supposed to fix this issue.

    Sunday, January 29, 2006 7:31 PM

All replies

  • After a bit more playing around, I can be more specific.

    The problem occurs if I change the size of the derived form. When I'm dragging the resize handle, anchoring seems to work as expected. But after the build, the positioning breaks. Am I asking too much or should this be working?

    I've tried the obvious, such as closing and re-opening Visual C#, which I understand can sometimes help with visual inheritance bugs, and I've tried every combination of anchoring.
    Thursday, January 26, 2006 3:40 PM
  • this is a bug with .NET 1.1 visual inheritance for windows forms particularly anchoring.  Somewhat related to the bug reported here.  I myself had hit this roadblock and i blogged about it here

    I saw using reflector that in .NET 2.0 is making this property changes at design time transactional which is supposed to fix this issue.

    Sunday, January 29, 2006 7:31 PM
  • Hi Joey

    I'm using 2.0, so it looks like there are still some problems.

    With a bit of trial and error I narrowed the issue down to the docking of the panel on which my buttons were placed. I undocked the panel and positioned it with bottom|left|right anchoring instead, placing the panel manually. This seems to have fixed the problem so far.

    I'll check out the references in your blog to see if there's a better solution.
    Wednesday, February 1, 2006 10:07 AM
  • By the way - is it worth reporting this as a bug to microsoft? Do they take any notice of bug-posts by individuals?
    Wednesday, February 1, 2006 10:14 AM
  • are you saying that it is still an issue with 2.0?

    Yes, they are responding on the ladybug feedback center...

    Wednesday, February 1, 2006 10:17 AM
  • I had this same sort of problem, and found that once I resized the derived form I needed to rebuild the project to get the inherited controls (docked to the bottom of the form) to appear in the right place.  But that was all, a simple rebuild put them where they were supposed to be.
    Wednesday, February 1, 2006 9:04 PM
  • When I rebuild the buttons wander about - sometimes they position themselves outside of the form itself!
    Monday, February 20, 2006 11:46 AM
  • I am experiencing the same problem. Controls on my inherited forms just move around, usually moved to the left hand side with location as minus something!!! Very frustrating.

    And this is in Visual Studio 2005...

    Thursday, August 10, 2006 1:34 PM
  • Somebody knows if there's a solution for this problem ?

    I'm having the same problem with Visual Studio 2005 (C#) and Service pack 1

     

    Thanks

    Friday, February 2, 2007 3:47 PM