Jump to content

Form Location


korasoglu
 Share

Recommended Posts

Arkadaşlar bir botunum var ana tıklaldığım zaman formun butonun altına açılmasını istiyorum yani sanki aılır bir buton gibi olmasını istiyorum.

 a1 = pictureBox7.Location.X; a2 = pictureBox7.Location.Y; değerleri aldım

this.Location = new Point(Form1.a1, Form1.a2);

 

Denedim olmadı ben hemen tıkladığım nesnenin altına açılmasını istiyorum.

Link to comment
Share on other sites

        private void button1_Click(object sender, EventArgs e)
        {
            /*
             * X = Pencerenin windows ekranındaki pozisyonu (sağdan sola) + buttonun penceredeki pozisyonu + ufak bir ayarlama (5)
             * Y = Pencerenin windows ekranındaki pozisyonu (yukarıdan aşağıya)+ buttonun penceredeki pozisyonu + buttonun yüksekliği + ufak bir ayarlama (30)
             * 
             */ 
            Point pnt = new Point(this.Location.X + button1.Location.X + 5, this.Location.Y + button1.Location.Y + button1.Height + 30);
            Form2 frm = new Form2()
            {
                Location = pnt,
            };
            frm.Show();
        }

Not: Form2'nin StartPosition özelliği Manual olarak seçilmelidir.

Not2: Ufak ayarlama dediğim yerler form kenarlıkları yüzündendir.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...