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. Message Box start position

Message Box start position

Scheduled Pinned Locked Moved C#
question
4 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.
  • A Offline
    A Offline
    AnnnS
    wrote on last edited by
    #1

    hi all My Doubt might be a simple one .... how can we display the message Box in the center of the parent window?? i am passing 'this' in the arguments ... still its displayed in the center of the screen , not in the center of the parent window ... Can anybody suggest an idea?? Akhil

    F A 2 Replies Last reply
    0
    • A AnnnS

      hi all My Doubt might be a simple one .... how can we display the message Box in the center of the parent window?? i am passing 'this' in the arguments ... still its displayed in the center of the screen , not in the center of the parent window ... Can anybody suggest an idea?? Akhil

      F Offline
      F Offline
      Flow84
      wrote on last edited by
      #2

      I dont think that this is possible. But you could always do your own MessageBox with a Form. Example: Form f = new Form(); f.Size = new Size(100, 100); f.StartPosition = FormStartPosition.CenterParent; f.ShowDialog();

      1 Reply Last reply
      0
      • A AnnnS

        hi all My Doubt might be a simple one .... how can we display the message Box in the center of the parent window?? i am passing 'this' in the arguments ... still its displayed in the center of the screen , not in the center of the parent window ... Can anybody suggest an idea?? Akhil

        A Offline
        A Offline
        Andrei Ungureanu
        wrote on last edited by
        #3

        Hy, My idea is this. Suppose you have a windows form named frmMain and the TextBox txtTest. At form load event place this code: txtTest.Left = frmMain.ActiveForm.Width / 2 - txtTest.Width / 2; txtTest.Top = frmMain.ActiveForm.Height / 2 - txtTest.Height / 2; Also at design time set the Anchors of txtTest to Right and Down. It should work.

        Do your best to be the best

        A 1 Reply Last reply
        0
        • A Andrei Ungureanu

          Hy, My idea is this. Suppose you have a windows form named frmMain and the TextBox txtTest. At form load event place this code: txtTest.Left = frmMain.ActiveForm.Width / 2 - txtTest.Width / 2; txtTest.Top = frmMain.ActiveForm.Height / 2 - txtTest.Height / 2; Also at design time set the Anchors of txtTest to Right and Down. It should work.

          Do your best to be the best

          A Offline
          A Offline
          AnnnS
          wrote on last edited by
          #4

          Thanx For the reply But i dont really understand how do u relate messagebox and textbox...

          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