.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);
}