|

楼主 |
发表于 2022-6-11 08:21:45
|
显示全部楼层
又见鬼了,当时调试程序时一切正常。保存里第二天打开运行,窗口一直是最大化。
this->Width = (screenImage->Width + (322 - 300)< swidth) ? screenImage->Width + (322 - 300) : swidth;
this->Height = (screenImage->Height + (374 - 278)< sheight) ? screenImage->Height + (374 - 278) : sheight;
尺寸的第二次赋值没有任何效果。
需要,取消最大化,并且计算去加载窅口的坐标。。。
TMD,调试好好的,第二天就变了。。。
真TMD是狗改不了吃屎,难缠的小鬼。。。。
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e)
{
backImage = nullptr;
extern bool loop;
loop = false;
hidden = false;
if (screenImage != nullptr)
{
this->WindowState = FormWindowState::Maximized; //窗口最大化
int swidth = this->Width; //获取窗口最大宽度
int sheight = this->Height; //获取窗口最大高度
int Point_x; //Point_x Point_y计算加载窗口坐标
int Point_y;
this->WindowState = FormWindowState::Normal; //取消窗口最大化
//默认窗口Size(322, 374) 默认图片框Size(300, 278)
if (screenImage->Width + (322 - 300) < swidth)
{
this->Width = screenImage->Width + (322 - 300);
Point_x = (swidth - (screenImage->Width + (322 - 300))) / 2;
}
else
{
this->Width = swidth;
Point_x = 0;
}
if(screenImage->Height + (374 - 278) < sheight)
{
this->Height = screenImage->Height + (374 - 278);
Point_y = (sheight-(screenImage->Height + (374 - 278)))/2;
}
else
{
this->Height = sheight;
Point_y = 0;
}
this->Location = System::Drawing::Point(Point_x, Point_y);
this->pictureBox1->Image = screenImage;
}
}
这次,没问题了。。。
Size没问题,Point没问题。
就差Size超出,限制Size以后。如何添加滚动条了。。。 |
|