C# 滚动条在Mdi子幻灯片窗体中不工作

C# 滚动条在Mdi子幻灯片窗体中不工作,c#,winforms,scrollbar,mdichild,C#,Winforms,Scrollbar,Mdichild,我有一个在mdi父窗体中加载的子窗体。此子窗体在加载时具有滑动效果,从屏幕左侧开始,并将设置在屏幕中央(我使用一个简单的计时器完成此操作) 问题是,如果我没有将表单的dockstyle设置为fill滚动条不工作,并且如果我将dockstyle设置为fill,滑动效果将不起作用,表单加载也很简单 这是表格1中的按钮: Timer timerPrevMonth = new Timer(); //reserve_vaght_azar is the form that will be l

我有一个在mdi父窗体中加载的子窗体。此子窗体在加载时具有滑动效果,从屏幕左侧开始,并将设置在屏幕中央(我使用一个简单的计时器完成此操作)

问题是,如果我没有将表单的
dockstyle
设置为
fill
滚动条不工作,并且如果我将
dockstyle
设置为
fill
,滑动效果将不起作用,表单加载也很简单

这是表格1中的按钮:

    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();
    }
这是定时器功能:

    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();
    }
void timerPrevMonth\u勾选(对象发送方,事件参数e)
{
timerPrevMonth.Stop();
reservevaghtazar.Location=新点(reservevaghtazar.Location.X+15,this.Location.Y);
如果(this.Location.X-reservevaghtazar.Location.X我解决了这个问题

我只是在reservevaghtazar.Focus()之后添加了
reservevaghtazar.Dock=DockStyle.Fill;

问题是,在幻灯片窗体完全加载到屏幕之前,我正在对接窗体。到,我更改了对接线的位置,问题解决了


但是很奇怪,如果表单没有填写Mdi父级,滚动条就不起作用。

请发布一些代码,重复这个问题。神秘的问题,表单没有DockStyle属性。你到底在说什么?请让我写一些代码告诉你,我想问题是现在clear@Arash哪个版本的.NET fra您使用的是什么?请出示
reserve\u vaght\u azar的声明