我设法创建了一个图片框数组。
private: static array<System::Windows::Forms::PictureBox^>^ pictures = (gcnew array<System::Windows::Forms::PictureBox^>(64));
现在,如果某个位置(coordX,coordY)是空闲的,我想生成一个Picture Box。有没有办法做到这一点?
答案 0 :(得分:0)
你需要一个矩形交叉算法然后你做这样的事情
var desiredX = ?;
var desiredY = ?;
var desiredW = ?;
var desiredH = ?;
var intersect = false;
foreach(var picture in pictures){
if(picture intersect(desiredX, desiredY, desiredW, desiredH)){
intersect = true;
break;
}
}
if(!intersect){
//add new picture here
pictures.add(newPicture);
}