Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Equivalent Win32 API to Control.InvokePaint?

Equivalent Win32 API to Control.InvokePaint?

Scheduled Pinned Locked Moved C#
jsonquestionlearning
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Li kai Liu Angus
    wrote on last edited by
    #1

    Hi, Does anyone know the equivalent APIs or mechanisms of doing InvokePaint or InvokePaintBackground in Controls? I want to tell a parent control to redraw itself inside the control's client area, so it looks like a control can be have "transparent" background (of course, not real transparent). However InvokePaint is a protected method. There is no chance for me to use these methods if I'm not inheriting the control class. Thanks:) Li-kai Liu

    D 1 Reply Last reply
    0
    • L Li kai Liu Angus

      Hi, Does anyone know the equivalent APIs or mechanisms of doing InvokePaint or InvokePaintBackground in Controls? I want to tell a parent control to redraw itself inside the control's client area, so it looks like a control can be have "transparent" background (of course, not real transparent). However InvokePaint is a protected method. There is no chance for me to use these methods if I'm not inheriting the control class. Thanks:) Li-kai Liu

      D Offline
      D Offline
      David Stone
      wrote on last edited by
      #2

      Ummm. If you are writing a control, you should be inheriting from the control class. Thus, you should have the ability to call the InvokePaint method. Some more specifics might be nice if we're going to solve your problems. :) Norm Almond: I seen some GUI's in my life but WTF is this mess ;-) Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough:) Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children:laugh: Leppie:My sister is 25:eek: -Norm on the MailMagic GUI

      L 2 Replies Last reply
      0
      • D David Stone

        Ummm. If you are writing a control, you should be inheriting from the control class. Thus, you should have the ability to call the InvokePaint method. Some more specifics might be nice if we're going to solve your problems. :) Norm Almond: I seen some GUI's in my life but WTF is this mess ;-) Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough:) Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children:laugh: Leppie:My sister is 25:eek: -Norm on the MailMagic GUI

        L Offline
        L Offline
        Li kai Liu Angus
        wrote on last edited by
        #3

        That's what I don't want it to be at the moment...:(( I know I have to inherit the control class in order to use it (because it's protected method...) Currently, I'm writing many custom controls that each of them requires this functionality. Therefore, I think it's a good idea to "extract" this method as an external one so that every control I've written could use it by calling this external function, something like: public static void DrawParentBackground(Graphic g, Control parent, Control callerControl) No inheritance is involved in order to use these protected method... Thanks again:)

        1 Reply Last reply
        0
        • D David Stone

          Ummm. If you are writing a control, you should be inheriting from the control class. Thus, you should have the ability to call the InvokePaint method. Some more specifics might be nice if we're going to solve your problems. :) Norm Almond: I seen some GUI's in my life but WTF is this mess ;-) Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough:) Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children:laugh: Leppie:My sister is 25:eek: -Norm on the MailMagic GUI

          L Offline
          L Offline
          Li kai Liu Angus
          wrote on last edited by
          #4

          Well, maybe still not very clear in my previous reply. I included a picture of the button control I've been writing for fun. http://www.ykliu.com/problem.png[^] It's a small button that draw everything from scratch. I plan a few features for this button: - support theme automatically. done! (Thanks for help from James T. Johnson) - support shadowed text. done! (Thanks for great tutorials from Christian Graus) - to able to draw underlying control, so it looks like transparent background is supported. Well, that's why I come up with this question. Though, I am able to use InvokePaint, InvokePaintBackground to redraw the underlying parent control. Suddenly this question comes to my mind. If I want to write another custom control that use this feature by using InvokePaint. There is no way but inheriting it from Control Class. Wouldn't it be better if I can write a static function, passing the caller control and caller's parent control as parameter, then the function will repaint caller control with the underlying parent's background. Thanks in advance... P.S. there's also another painting problem I found. illustrated in the included image. Li-kai Liu

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups