Ejmin Issaian
Ejmin Issaian

Reputation: 1

Changing the starting point of a Panel in WinForm C#

I want to Change my starting top-left point of a panel , that is the main starting point of panels , to top-right starting point. In other word, I want to reverse it. the Timer object calls the event every 30 milliseconds. and it visibles the panel and changes its width from 0 to 140. it's height is unchangeable.

  private void SettingButton_Click(object sender, EventArgs e)
        {
            settingPanel.AutoScrollPosition = new Point(699, 77);
            settingPanel.Visible = (settingPanel.Visible ? false : true);
            settingPanel.Size = (settingPanel.Visible ? new Size(0, 355) : new Size(140, 355));
            slidingTimer.Start();
        }

        private void SlidingTimer_Tick(object sender, EventArgs e)
        {
            if (settingPanel.Visible)
            {
                if (settingPanel.Width <= 140)
                {
                    settingPanel.Width += 20;
                    this.Refresh();
                }
                else
                {
                    slidingTimer.Stop();
                }
            }
    }  

Upvotes: 0

Views: 107

Answers (0)

Related Questions