Вопрос

i have a child form that loads in mdi parent.this child form has slide effect when its loading and come from left of the screen and will be set in center of screen(i did this with a simple timer).

The Problem is that if i dont set dockstyle of the form to fill the scroll bar does not work and if i set dockstyle to fill,the sliding effect wont work and form loads simple!

this is the button in form1:

    Timer timerPrevMonth = new Timer();
    //reserve_vaght_azar is the form that will be load in sliding effect
    reserve_vaght_azar reservevaghtazar = null;
    private void btn_prev_dey_Click(object sender,EventArgs e)
    {

        reservevaghtazar = new reserve_vaght_azar();
        reservevaghtazar.StartPosition = FormStartPosition.Manual;
        reservevaghtazar.Location = new Point( this.Location.X-Width,Location.Y );
        reservevaghtazar.MdiParent = MdiParent;
        this.TopMost = true;
       //here is dockstyle
       // reservevaghtazar.Dock=DockStyle.Fill;
        reservevaghtazar.Show();
        timerPrevMonth.Start();
    }

This Is the timer Function :

    void timerPrevMonth_Tick(object sender,EventArgs e)
    {
        timerPrevMonth.Stop();
        reservevaghtazar.Location = new Point( reservevaghtazar.Location.X +15,this.Location.Y );

        if (this.Location.X-reservevaghtazar.Location.X <5)
        {
            reservevaghtazar.Location = new Point( this.Location.X,this.Location.Y );
            this.TopMost = false;
            reservevaghtazar.BringToFront();
            reservevaghtazar.Focus();

        }
        else
            timerPrevMonth.Start();
    }

when press button in form1,form reserve_vaght_azar will be load in sliding effect

Это было полезно?

Решение

I Solved That!

I simply added reservevaghtazar.Dock=DockStyle.Fill; after reservevaghtazar.Focus();

The Problem was that i was docking the form before the slide form completely load in screen.to i changed the position of docking line and it solved.

But yet Its very Strange that scrollbar doesnt work if the form doesnt be fill in Mdi parent.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top