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 window dock/undock to parent window

Make window dock/undock to parent window

Scheduled Pinned Locked Moved C#
1 Posts 1 Posters 1 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.
  • M Offline
    M Offline
    manchukuo
    wrote on last edited by
    #1

    Hi, I am trying to do an app which has children windows inside it, and make it capable of when drag the mouse off the parent window it undocks and float all around the desktop, but for some reason i can seem to accomplish this. I am using the SetWindowLong method to change style of the window from WS_CHILD to WS_POPUP but it doesn't work, can someone please show me some code to make it work :sigh:

    long lastStyle = NativeMethods.GetWindowLong(myControl.Handle,
    (int)NativeMethods.GetWindowLongConst.GWL_EXSTYLE);

    long newStyle = NativeMethods.SetWindowLong(myControl.Handle,
    (int)NativeMethods.GetWindowLongConst.GWL_STYLE,
    (uint)NativeMethods.WindowStyles.WS_POPUP);

    newStyle = NativeMethods.SetWindowLong(myControl.Handle,
    (int)NativeMethods.GetWindowLongConst.GWL_EXSTYLE,
    (long)(NativeMethods.WindowStylesEx.WS_EX_APPWINDOW | NativeMethods.WindowStylesEx.WS_EX_TOOLWINDOW));

    myControl.Location = new Point(100, 200);//just a test

    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