Giter Site home page Giter Site logo

Comments (2)

joachimmarder avatar joachimmarder commented on June 9, 2024

Thanks, issue 1 and 2 are addressed.

Incidentally it is also worth moving UpdateHeaderRect() after the inherited call

Agreed.

Instead of using CurrentPPI it is faster ....

I don't think we should do preemptive performance optimization here.

and more reliable to use FCurrentPPI

Can you explain why? Given general best practices, one should use the property, not the member variable.

from virtual-treeview.

pyscripter avatar pyscripter commented on June 9, 2024

@joachimmarder
Thanks for the changes!

I don't think we should do preemptive performance optimization here.

It is not about optimization. As explained in #1205 FCurrentPPI is a protected field and CurrentPPI is a property that gets the PPI from the control handle. The former is more reliable and consistent with the current control scaling state. So, if you can (meaning if FCurrentPPI has been updated by the inherited ChangeScale), you should use FCurrentPPI instead of CurrentPPI.

On Issue 2:
You can significantly simplify the code by not checking IsSystemStyle and just using StyleServices.GetElementSize, Please see above.

In other words the following:

      if StyleServices.IsSystemStyle then
      begin
        {$if CompilerVersion >= 33}
        if TOSVersion.Check(10) and (TOSVersion.Build >= 15063)  then
          Theme := OpenThemeDataForDPI(Handle, 'BUTTON', CurrentPPI)
        else
        {$ifend}
          Theme := OpenThemeData(Self.Handle, 'BUTTON');
        Details := StyleServices.GetElementDetails(tbCheckBoxUncheckedNormal);
        Res := GetThemePartSize(Theme, BM.Canvas.Handle, Details.Part, Details.State, nil, TS_TRUE, lSize) = S_OK;
      end
      else

can just be removed!

from virtual-treeview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.