将图片框放在一个数组中/制作一个以图片框为元素的数组

时间:2017-09-16 21:32:21

标签: c++ visual-c++

任何人都可以帮我将图片框放在一个数组中。我试图使用图片框为项目制作滑动瓷砖图片益智游戏。我已将图像设置到图片框中。现在我必须将它们输入到数组中。我找到了这个帖子[iterating through PictureBoxes in visual c++,但它对我不起作用。 感谢。

编辑: 这是我目前的代码。我已经添加了" private:static array ^ pictures =(gcnew array(64));"从上面的链接。虽然,当我尝试设置图片[0] = picbox1等时,我得到一个构建错误。 代码的其他部分Image 1 Image 2

pragma一次

namespace projimagepuzzle {

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

/// <summary>
/// Summary for Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
    Form1(void)
    {
        InitializeComponent();
        //
        //TODO: Add the constructor code here
        //

    }

protected:
    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    ~Form1()
    {
        if (components)
        {
            delete components;
        }
    }
private: System::Windows::Forms::PictureBox^  picboxorigimage;
protected: 

protected: 

protected: 

protected: 
private: System::Windows::Forms::Label^  lblOrigIm;
private: System::Windows::Forms::Label^  lblpuzzle;
private: System::Windows::Forms::PictureBox^  picbox1;
private: System::Windows::Forms::PictureBox^  picbox2;
private: System::Windows::Forms::PictureBox^  picbox3;
private: System::Windows::Forms::PictureBox^  picbox4;
private: System::Windows::Forms::PictureBox^  picbox5;
private: System::Windows::Forms::PictureBox^  picbox6;
private: System::Windows::Forms::PictureBox^  picbox7;
private: System::Windows::Forms::PictureBox^  picbox8;
private: System::Windows::Forms::PictureBox^  picbox9;
private: System::Windows::Forms::PictureBox^  picboxnull;





private:
    /// <summary>
    /// Required designer variable.
    /// </summary>
    System::ComponentModel::Container ^components;



    //ForPicArray
private: static array<System::Windows::Forms::PictureBox^>^ pictures=(gcnew array<System::Windows::Forms::PictureBox^>(64));

0 个答案:

没有答案