Menu

#49 Auto size column wrong for changed fonts

v1.0 (example)
open
Lee
None
7
2014-09-11
2014-09-10
ssdi
No

Auto size column calculated incorrectly when font changed. Trivial typo.

Patch attached.

1 Attachments

Related

Bugs: #49

Discussion

  • ssdi

    ssdi - 2014-09-11

    Patch fixes TreeViewAdv.AutoSizeColumn(TreeColumn column) behavior for non default tree Fonts.

    Does _measureContext.Font not being updated in some cases ?
    As I remember - yes. Erroneously calculated width. It was a long time and in my branch this patch applied.

    In method TreeViewAdv.AutoSizeColumn(TreeColumn column) local variable DrawContext context created but not used for calculate column width.

    When you change the font, 'OnFontChanged' is invoked.
    Yes, but _measureContext.Font updated after call event handlers(base.OnFontChanged(e), see source).

    With patch control work correctly in complicated cases.

     
    • Lee

      Lee - 2014-09-16

      Just came back from vacation, thus the delay.

      The matter is that this issue is supposed to be resolved using
      '_measureContext.Font'
      instead of being bypassed according to the design paradigm of the project.
      As I see correct, Instancing a new DrawContext object is redundant and
      should be removed from 'TreeViewAdv.AutoSizeColumn'

      One might swap the two lines (highlighted in purple) in
      'TreeViewAdv.OnFontChanged'
      to resolve the issue you've just addressed.

      protected override void OnFontChanged(EventArgs e)
      { base.OnFontChanged(e);
      _measureContext.Font = Font;
      FullUpdate();
      }

      If you already tried these ways and none of them work and/or there's a
      design flaw in TreeViewAdv/.Net framework.
      Then I'll ask you to send me an example program showing the issue.

      On 11 September 2014 12:09, ssdi ssdi@users.sf.net wrote:

      Patch fixes TreeViewAdv.AutoSizeColumn(TreeColumn column) behavior for non
      default tree Fonts.

      Does _measureContext.Font not being updated in some cases ?
      As I remember - yes. Erroneously calculated width. It was a long time and
      in my branch this patch applied.

      In method TreeViewAdv.AutoSizeColumn(TreeColumn column) local variable
      DrawContext context created but not used for calculate column width.

      When you change the font, 'OnFontChanged' is invoked.
      Yes, but _measureContext.Font updated after call event
      handlers(base.OnFontChanged(e), see source).

      With patch control work correctly in complicated cases.

      Status: open
      Group: v1.0 (example)
      Created: Wed Sep 10, 2014 10:05 AM UTC by ssdi
      Last Updated: Wed Sep 10, 2014 10:05 AM UTC
      Owner: Lee

      Auto size column calculated incorrectly when font changed. Trivial typo.

      Patch attached.

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/treeviewadv/bugs/49/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #49


Log in to post a comment.