Thread: lock winform to top, left, right or bottome of desktop

  1. #1
    Registered User
    Join Date
    Jan 2004
    Posts
    13

    lock winform to top, left, right or bottome of desktop

    Hi,

    I have a tricky winform request that i'm not sure can be done.

    You know how when you unlock the win xp taskbar, you can drag it to any side of the desktop and it locks into place. Is is possible to have this functionality with my win form program?

    Its 100 pixels wide so i'd ike it to start up locked to the right side of the screen and when the user clicks it, they can drag and drop it to the top, bottom ect.

    Any tips would be great.

    Thanks

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    I don't know how that's done, but maybe you can find it in google with something like "c# programming restricting winform edge screen".
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    A starting point:
    Example of C# dockable form

  4. #4
    Software engineer
    Join Date
    Aug 2005
    Location
    Oregon
    Posts
    283
    It is a tricky task. There's a few things you'll need: the taskbar (basically a window form in 100 pixels or more. Next, when you click on the form (click event), you need the mouse's x/y position. When you release the mouse button, set the form to its new location based on that x/y coordinate. That should be a good start. Let us know

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Odd 3D Invis Objects?
    By Zeusbwr in forum Game Programming
    Replies: 4
    Last Post: 12-07-2004, 07:01 PM
  2. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  4. Please help me
    By teedee46 in forum C++ Programming
    Replies: 9
    Last Post: 05-06-2002, 11:28 PM
  5. Stack functions as arrays instead of node pointers
    By sballew in forum C Programming
    Replies: 8
    Last Post: 12-04-2001, 11:13 AM