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
  1. Home
  2. General Programming
  3. C#
  4. Make control draw on top of other forms

Make control draw on top of other forms

Scheduled Pinned Locked Moved C#
helpquestion
3 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.
  • J Offline
    J Offline
    JacksonBrown1960
    wrote on last edited by
    #1

    I have a main form that uses AddOwnedForm to allow these forms to draw on top of the main form. The problem I am having is with a control that I created by inheriting from System.Windows.Forms.Control. When I display this control, which belongs to the main form, it will draw properly until it tries to write on top of an area occupied by an owned form. Is there a way to allow a control to draw on top of anything. I tried using SetTopLevel but that seems to turn it into a form and puts a forms border around it. I have seen the build in ComboBox control pop up its listbox over anything so I figure it must be possible. Does anyone have any ideas? Thanks, Jay

    H 1 Reply Last reply
    0
    • J JacksonBrown1960

      I have a main form that uses AddOwnedForm to allow these forms to draw on top of the main form. The problem I am having is with a control that I created by inheriting from System.Windows.Forms.Control. When I display this control, which belongs to the main form, it will draw properly until it tries to write on top of an area occupied by an owned form. Is there a way to allow a control to draw on top of anything. I tried using SetTopLevel but that seems to turn it into a form and puts a forms border around it. I have seen the build in ComboBox control pop up its listbox over anything so I figure it must be possible. Does anyone have any ideas? Thanks, Jay

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Try overridding the CreateParams property and doing something like so:

      protected virtual System.Windows.Forms.CreateParams CreateParams
      {
      get
      {
      CreateParams parms = base.CreateParams;
      parms.Style |= WS_POPUP; // Defined as 0x80000000
      return parms;
      }
      }

      I'm not totally positive this will work, but it's worth a try.

      -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

      J 1 Reply Last reply
      0
      • H Heath Stewart

        Try overridding the CreateParams property and doing something like so:

        protected virtual System.Windows.Forms.CreateParams CreateParams
        {
        get
        {
        CreateParams parms = base.CreateParams;
        parms.Style |= WS_POPUP; // Defined as 0x80000000
        return parms;
        }
        }

        I'm not totally positive this will work, but it's worth a try.

        -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

        J Offline
        J Offline
        JacksonBrown1960
        wrote on last edited by
        #3

        Unfortunately that did not work the way I needed. When you modify a control to have the WS_POPUP style it no longer acts as a child on the form and processing of other controls does not work. Thanks for the suggestion.

        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