日期:2014-05-18 浏览次数:21149 次
#region//窗口大小改变
        float x=0;
        float y=0;
        private void Frm_Resize_1(object sender, System.EventArgs e)
------解决方案--------------------
位置怎么调整, 是相对位移不变,还是上下左右的坐标的比例不变,如果是前者则用Anchor属性,若为后者,则用代码吧,下面是代码:
        private void TestFormResizeEvent_Resize(object sender, EventArgs e)
        {
            int width = this.Width;
            int height = this.Height;
            int x = (int)(this.Width * this.leftPercent);//leftPercent和topPercent是根据初始化的坐标位置算出来的与宽、高的比例
            int y = (int)(this.Height * this.topPercent);
            this.btnTest.Location = new System.Drawing.Point(x, y);
        }