I ‘ve had a couple of bug reports for the incorrect drawing of Krypton controls when there is a deep nesting of controls under Windows 7 64bit. You can see what I mean in the following image that shows a test application that has 8 KryptonNavigator instances all inside each other.

Incorrect drawing

I spent a couple of different attempts investigating this with no luck. No matter what I did and how I looked at the scenario the Krypton code did not seem to be doing anything wrong. Fortunately someone spotted a Microsoft Knowledge Base article describing this issue and presenting a workaround. You can read it here.

The solution to the above problem was to add the following new control and then replace the 4th instance of the KryptonNavigator with the new KryptonNavigatorDelay class.

 public class KryptonNavigatorDelay : KryptonNavigator
   protected override void OnSizeChanged(EventArgs e)
     if (Handle != null)
          { base.OnSizeChanged(e); });

This results in the following appearance when resizing the window at runtime.

Correct drawing

The issue is with the operating system and seems to manifest itself under Windows 7 64bit when you have a depth of around 16 deep. Testing with various different controlsdoes not seem to make much difference in the depth required to see problems. Apparently the same problem can occur under 32bit operating systems but not until you have a much deeper level of nesting. Hence you are only likely to have encountered this problem under 64bit.

I cannot simply at the above code to every Krypton container because the solution causes a delay when drawing the control as the BeginInvoke delays execution of the delegate until the current windows message has been completed. So if you experience the issue then you need to check your nesting depth and look at implementing the work around at an appropriate level in the control hierarchy.

16 Responses to “Deep nesting and redrawing”

  1. Sven Says:

    Thanks for this post Phil. We have this issue in our application and have spent a lot of time to find the source for this bug without success. But finally… Thanks Phil =)

  2. Brent Says:

    Many thanks for digging in to this since I haven’t made the time to do so!

  3. Alex Says:

    Thank you for publishing this. I have been frustrated by it, as well

  4. 翻譯公證 Says:

    Excellent keen synthetic eyesight regarding fine detail and
    can foresee problems prior to these people take place.

  5. more Says:

    I love to disseminate knowledge that will I’ve accrued through the year to
    help enhance group efficiency.

  6. 翻譯公證 Says:

    Whats up! I simply wish to give a huge thumbs up for the good info you
    have right here on this post. I will be coming again to your
    blog for extra soon.

  7. Canada goose parka Says:

    Hi there, i read your blog from time to time and i own a similar one and i was just
    wondering if you get a lot of spam remarks? If so how
    do you reduce it, any plugin or anything you can recommend?
    I get so much lately it’s driving me crazy so any support is very much

  8. tf2 item generator Says:

    I comment when I appreciate a post on a website or I
    have something to contribute to the conversation. Usually it is triggered by the
    passion communicated in the post I looked at. And after this post
    Windows Forms Controls for .NET Developers.
    I was actually moved enough to post a comment ;) I do have
    2 questions for you if you do not mind. Is it just me or does it look like some of these remarks come across like they are
    left by brain dead people? :-P And, if you are posting at other online social sites, I would like to
    follow you. Would you list the complete urls of all your social
    pages like your Facebook page, twitter feed, or linkedin profile?

    I’m confident all of you below play Team Fortress two, or else you wouldn’t be here!

    I also play TF2, and one particular thing that I couldn’t
    get my head close to was accumulating all the products!!
    I’v observed some players cant even accumulate most of the products,
    never thoughts ALL of them!! I was focused to getting all the
    items, but it appeared unattainable, so being an skilled programmer, I acquired to perform!

    Following hours of tough operate I developed, what I say one of the ideal hacks out there!
    (biased considerably?!) The device that I have developed enables
    you to unlock any of the items you would like in TF2!
    I’ts straightforward really…
    I was arranging to promote this device and permit some cash start rolling in, but
    i know the sensation of not getting capable to pay for it,
    or being a ‘poor’ dude on TF2, so I have determined to give this
    out for free of charge to see what individuals believe of it!
    Just read the tutorial below outlining how to acquire and use the

  9. stylin trucks coupon code Says:

    I’ve been searching on-line over a couple of a long time today, having said that i certainly not located almost any exciting report such as your own property. It is really price adequate for me personally. In my view, in the event many internet marketers as well as writers built good material as you most likely does, the online world might be a much bigger very helpful than before.

  10. hidradenitis suppurativa Says:

    Carbon dioxide laser medical procedures is at the moment thought to be the
    previous resort for those who have state-of-the-art to its highest stage, where the affected
    places are excised, and the pores and skin is grafted.
    When the summer months rolled around, she felt like she had been at just some sort
    of all-time low. Another randomized clinical trial known as the Heart
    Outcomes Prevention Evaluation (HOPE) Study found a lack of protection with vitamin E supplements.

  11. Minecraft Admin Hack Says:

    Our minecraft force op tool has fully transformed the manner in which minecraft servers perform.

    An administration perceives that they are the sole kinds that are able to control their machine.
    They may be completely wrong! With all the minecraft force op instrument, you may now
    take full control of the machine and use it, because you please.

    You can also kick out your other administrative!

  12. Anik Singal Inbox Blueprint 2.0 Says:

    I was curious if you ever thought of changing the layout of your site?
    Its very well written; I love what youve got to say. But maybe you could a little more in the way of
    content so people could connect with it better.
    Youve got an awful lot of text for only having 1
    or 2 pictures. Maybe you could space it out better?

  13. water damage restoration houston Says:

    For newest news you have to pay a quick visit internet and on web I found this web page as a best web site for latest updates.

  14. ต้นโกสนราคาถูกมาก Says:

    Hi there it’s me, I am also visiting this web site regularly, this website is in fact fastidious and
    the users are genuinely sharing nice thoughts.

  15. Lilia Gayoso Says:

    jeyi couldon

  16. ios jailbreak ipod touch 2g Says:

    I’ve been exploring for a little bit for any high-quality articles or blog posts on this kind
    of house . Exploring in Yahoo I finally stumbled upon this
    site. Reading this information So i’m happy to show
    that I’ve an incredibly just right uncanny feeling I came upon just what I needed.
    I most indisputably will make certain to don?t put out of your mind this website and provides it a glance on a continuing basis.

Leave a Reply