Destroyed Canvas handle in RzGrafx.pas -> “DrawParentImage”

Home Forums Konopka Signature VCL Controls (formerly Raize Components) Destroyed Canvas handle in RzGrafx.pas -> “DrawParentImage”

Viewing 1 reply thread
  • Author
    Posts
    • #2928
      Patrick Marten
      Participant

        Hello,

        we are using Raize 6.2.3 with Delphi 10.3.2 Rio and have updated our DevExpress components to the newest version recently. After doing so we discovered an issue in some forms using TRzPageControls. The error “Canvas does not allow drawing” occurs in the DevExpress skinning library, but the reason for the error is in the “RzGrafx.pas” unit.

        A colleague of mine had contact with DevExpress support and the guys did quite a research to figure it out:

        1. The instance of the RzPageControl in question is painted.
        2. That instance has transparency information, so it calls the DrawParentImage function
        3. That function calls the DrawParentImage method and this method refers to its parent (DevExpress’ GroupBox control) and “asks” to draw its content
        4. That GroupBox control is semitransparent due to skinning (the applied skin has semitransparent corners for group captions), so it “asks” its parent to draw the background
        5. The PrintWindow method, which DevExpress use to draw the control’s content, uses Windows messages.
        6. Sending these messages forces all device contexts (DCs) that are not locked to be destroyed
        7. Since Raize Components do not call the Lock/Unlock block for BgBmp.Canvas, the Canvas handle is also destroyed, so the “canvas does not allow drawing” error occurs.

        This suggested modification of the “RzGrafx.pas” file works fine:

        procedure DrawParentImage( Control: TControl; Dest: TCanvas; InvalidateParent: Boolean = False );
        begin
          Dest.Lock;  <<<<<< ADD
          DrawParentImage( Control, Dest.Handle, InvalidateParent );
          Dest.unlock; <<<<<< ADD
        end;

        Maybe this fix should be added officially?

      • #2970
        Ray Konopka
        Keymaster

          Hi Patrick,

          Thanks for taking the time to share your investigation of this issue and for posting the solution. I would encourage you to create a new issue on Embarcadero’s Quality Portal to report this issue and your findings.

          Since Embarcadero acquired the components in 2015, an official fix will need to come from them. Therefore, I am encouraging all KSVC users to report issues and enhancement requests to Embarcadero directly. I will continue to engage Embarcadero to encourage them to address issues like this and keep the library current, but I believe it will be good for Embarcadero to see issues being reported by other users.

          Thanks again for sharing your findings!

          Ray

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.