将pixtureBox放入panel中为什么Width和Height可以放大却不能缩小?

.net(VC++ Windows Form)将pixtureBox放入panel中为什么Width和Height可以放大却不能缩小?
this->panel1->AllowDrop = true;
this->panel1->AutoScroll = true;
this->panel1->AutoSize = true;
this->panel1->AutoSizeMode = System::Windows::Forms::AutoSizeMode::GrowAndShrink;
this->panel1->Controls->Add(this->pictureBox1);
//这是放大的代码
private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
if(mytime< 7)
{
mytime++;
pictureBox1->Width=pictureBox1->Width*2;
pictureBox1->Height=pictureBox1->Height*2;

}
//这是缩小的代码
private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) {
if(mytime>1)
{
mytime--;
pictureBox1->Width=pictureBox1->Width/2;
pictureBox1->Height=pictureBox1->Height/2;
//this->panel1->Size = System::Drawing::Size(w, h);
}

1个回答

去掉autosize看看
什么叫没法缩小,说清楚

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐