日期:2014-05-19  浏览次数:20706 次

关于初始化窗体
我写了一个类,类中有个方法是将窗体初始化:代码如下
public   void   Form_Initialize(int   FormWidth,   int   FormHeight)
                {
                        int   ScreenHeight   =   System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height;
                        int   ScreenWidth   =   System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width;
                        this.Left   =   ScreenWidth   /   2   -   this.Width   /   2;
                        this.Top   =   ScreenHeight   /   2   -   this.Height   /   2;
                }
但是编译的时候总提示我“Class1 '   does   not   contain   a   definition   for   'Left '”
我怀疑是使用this的缘故,请问该如何修改啊?

------解决方案--------------------
public void Form_Initialize(Form form , int FormWidth, int FormHeight)
用这个
然后把函数中所有的this都换成form