回复 6楼 op123
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以后。如何添加滚动条了。。。