Note that there are some explanatory texts on larger screens.

plurals
  1. POCStatic Custom Control
    primarykey
    data
    text
    <p>I am trying to create a custom <code>CStatic</code> control in <code>vc++</code> and have a few problems.</p> <p>I originally was just using a <code>CStatic</code> control with the <code>SS_BLACKRECT</code> style. This was good for the situation until I needed to display an image over the control on demand.</p> <p>I figured out all the logistics behind actually drawing the image onto the control but I cant seem to figure out how to do so without interfering with other things.</p> <p>Basically I want the control to function as a normal <code>CStatic</code> with the <code>SS_BLACKRECT</code> style most of the time. </p> <p>Then I need to be able to call a method that will cause it to draw an image over the control instead. I am doing the drawing using <code>GDI</code> and have tried it both in the <code>OnPaint()</code> method and the <code>DrawItem()</code> method without success. I can get it to draw in the <code>OnPaint()</code> but when I call the base <strong><code>CStatic::OnPaint()</code></strong> it draws over my image. </p> <p>I need to be able to allow it to draw like normal but then just throw an image in on top. When I tried to do it in the <code>DrawItem()</code> method I had a problem because obviously it was not drawing using the <code>SS_BLACKRECT</code> style but waiting for me to draw the control like its supposed to.</p> <p>I guess what I think I'm looking for is one of three things. A way to draw using <code>GDI</code> after the base <code>OnPaint()</code> method finishes. A way to have the control draw the default <code>SS_BLACKRECT</code> style and then <code>OWNERDRAW</code> the image afterwards. Or the code to mimic the drawing of <code>SS_BLACKRECT</code>. </p> <p>The last one might be the easiest but I just don't know all the things I need to set up to draw a <code>CStatic</code> control like the default DrawItem. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload