Jump to content

Transparent Controls


Recommended Posts

Hi guys, I am modifying the Paint.NET control to see if I can use it for a test project I am building.

I have createe a custom control with true transparency (via the ExStyle param change. It's basically a transparent label with a shape drawn on it). I can add this control anywhere on the form I want, and it shows up, even over other controls.

However, if I move the control over the DocumentView control, my transparent control is erased (basically any part of the control that is overlapping the documentview control gets wiped out). It's like the DocumentView control is always on the highest z-order, but SendToBack/BringToFront does nothing to change this. If I remove the Transparency ExStyle param, the control will show up properly.

I can not figure out why I can't lay my transparent control over the DocumentView control. Does anyone have any ideas on what the deal is here?

Link to comment
Share on other sites

Of course when I say DocumentView I mean the DocumentView/SurfaceBox/PanelEx combination that makes up the workspace environment drawing canvas

I figured it probably wasn't designed this way, but I thought it would work-

What I guess I don't understand is this:

1. the document view control paints itself

2. my control paints itself over a portion of the document view

3. document view RE-paints itself.

Is there something that tells the DocumentView/SurfaceBox/PanelEx combination to invalidate when something is drawn over it?

Link to comment
Share on other sites

If you want to draw "on" a DocumentView, implement a SurfaceBoxGraphicsRenderer.

The SurfaceBox has a list of SurfaceBoxRenderers that it uses to render on to its double buffer surface. SurfaceBoxGraphicsRenderer derives from that class and DocumentView recognizes instances of it and allows them to draw outside the canvas area using standard GDI+.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...