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. WCF and WF
  4. Positioning window like popup control.

Positioning window like popup control.

Scheduled Pinned Locked Moved WCF and WF
6 Posts 3 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.
  • U Offline
    U Offline
    User 2322509
    wrote on last edited by
    #1

    Hi, I have logic to show window when mouse is over listbox item (something like hover window). I would like to position this window same like popup control would position. Eg. i want to show this window exactly left to the listbox and if there is no enough space on screen, would like to position to other side where space is available. Thanks.

    I 1 Reply Last reply
    0
    • U User 2322509

      Hi, I have logic to show window when mouse is over listbox item (something like hover window). I would like to position this window same like popup control would position. Eg. i want to show this window exactly left to the listbox and if there is no enough space on screen, would like to position to other side where space is available. Thanks.

      I Offline
      I Offline
      Ian Shlasko
      wrote on last edited by
      #2

      Simple enough... Call PointToScreen() on the listbox to get the coordinates relative to the screen, and position the window like that. Something like this (Pseudocode): pt = listbox.PointToScreen Left = pt.X - ActualWidth Top = pt.Y if (Left < 0) Left = pt.X + listbox.ActualWidth

      Proud to have finally moved to the A-Ark. Which one are you in? Developer, Author (Guardians of Xen)

      U 1 Reply Last reply
      0
      • I Ian Shlasko

        Simple enough... Call PointToScreen() on the listbox to get the coordinates relative to the screen, and position the window like that. Something like this (Pseudocode): pt = listbox.PointToScreen Left = pt.X - ActualWidth Top = pt.Y if (Left < 0) Left = pt.X + listbox.ActualWidth

        Proud to have finally moved to the A-Ark. Which one are you in? Developer, Author (Guardians of Xen)

        U Offline
        U Offline
        User 2322509
        wrote on last edited by
        #3

        Thanks, that worked. But if i set the position before calling Show() method , it has no effect on position. And if set position after Show() widow flickers (moves position). How to avoid flickering? Thanks

        I 1 Reply Last reply
        0
        • U User 2322509

          Thanks, that worked. But if i set the position before calling Show() method , it has no effect on position. And if set position after Show() widow flickers (moves position). How to avoid flickering? Thanks

          I Offline
          I Offline
          Ian Shlasko
          wrote on last edited by
          #4

          Set the window startup position to manual... Otherwise it'll try to position itself automatically.

          Proud to have finally moved to the A-Ark. Which one are you in? Developer, Author (Guardians of Xen)

          U 1 Reply Last reply
          0
          • I Ian Shlasko

            Set the window startup position to manual... Otherwise it'll try to position itself automatically.

            Proud to have finally moved to the A-Ark. Which one are you in? Developer, Author (Guardians of Xen)

            U Offline
            U Offline
            User 2322509
            wrote on last edited by
            #5

            No Luck, still flickering.

            C 1 Reply Last reply
            0
            • U User 2322509

              No Luck, still flickering.

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              Set it to manual, position it, then call show. It won't flicker.

              Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

              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