I added the 35 PictureBox to the form at the design stage and ı want to assign these picturebox to array but ı cant do this please help me about this subject!

解决方案First, you don''t need PictureBoxs to do this, at all. You just need to draw the portions of the image you need where you need them. Using picbox controls just complicates things for you.

What is an array going to do for you? Nothing...

The code below worked for me:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace TestTabs

{

public partial class Form1 : Form

{

List pictureBoxes;

public Form1()

{

pictureBoxes = null;

InitializeComponent();

}

private List collectPictureBoxes(List collection, Control me)

{

foreach (Control ctrl in me.Controls)

{

if (ctrl.GetType() == typeof(PictureBox))

{

collection.Add((PictureBox)ctrl);

}

if (ctrl.HasChildren)

{

collectPictureBoxes(collection, ctrl);

}

}

return collection;

}

private void Form1_Load(object sender, EventArgs e)

{

pictureBoxes = collectPictureBoxes(new List(), this);

foreach (PictureBox pb in pictureBoxes)

{

MessageBox.Show(pb.Name);

}

}

}

}

Regards,

—MRB

I woudln''t assign them as design time: I would just go straight in at run time. The reason for that is that is that there is no real occasion when you want to refer to the PictureBoxes by name, just by position relative to a 6x6 array. In actual fact, I probably wouldn''t use Pictureboxes anyway, but would draw directly onto a panel instead, and have a 6x6 array of integers to tell me which section of the picture should be in which square. But, picture boxes will work too.

If you must create them at design time, then creating an array of them isn''t too difficult - it''s just messy:

private PictureBox[,] pictures;

private void SetPictures()

{

pictures = new PictureBox[6, 6] {

{pictureBox1, pictureBox2, pictureBox3, pictureBox1, pictureBox2, pictureBox3},

{pictureBox1, pictureBox2, pictureBox3, pictureBox1, pictureBox2, pictureBox3},

{pictureBox1, pictureBox2, pictureBox3, pictureBox1, pictureBox2, pictureBox3},

{pictureBox1, pictureBox2, pictureBox3, pictureBox1, pictureBox2, pictureBox3},

{pictureBox1, pictureBox2, pictureBox3, pictureBox1, pictureBox2, pictureBox3},

{pictureBox1, pictureBox2, pictureBox3, pictureBox1, pictureBox35, null},

};

}(You have to do it in a method, as the compiler won''t let you use non-static field initializers)

You will have to change the names - I cut''n''pasted to get the 35 I needed.

c#拼图碎片形状,用c#制作图片拼图相关推荐

  1. c#拼图碎片形状_使用神经网络解决拼图游戏

    在一个排列不变性的数据上神经网络是困难的.拼图游戏就是这种类型的数据,那么神经网络能解决一个2x2的拼图游戏吗? 什么是置换不变性(Permutation Invariance)? 如果一个函数的输出 ...

  2. c#拼图碎片形状_添加你的拼图碎片

    造物能量-添加你的拼图碎片 亲爱的 你可能不再对作为他人的笑话来源或贬低他人的价值感到舒适.你在发现一个内在的声音经常在说话说到一半的时候打断你.一个将你曾经认为的或说过的话作废的声音.因为你在开始伴 ...

  3. c#拼图碎片形状_拼图的碎片形状的种类

    拼图的碎片形状的种类 dnf十周年开放了一个庆典拼图碎片的活动,点击图中的图标可以开启活动页面. 需要拼凑出一整张图画来完成活动. 活动完成的奖励是一张角色改名卡,非常的实用. 需要进入到对应英雄等级 ...

  4. php拼图游戏开发,原生javascript制作的拼图游戏实现方法详解

    本文实例讲述了原生javascript制作的拼图游戏实现方法.分享给大家供大家参考,具体如下: 实现方法 //1.让所有的li(在ul里)可以拖拽 //2.交换li的位置  计算背景图位置 //1.让 ...

  5. html5制作拼图游戏教程,用HTML5制作视频拼图的教程

    几天前同事给我看了一个特效,是一个拼图游戏,不同的是,拼图里的是动画.他让我看下做个DEMO,于是就自己整了一会,也确实不难.用canvas很容易做.所以这篇博文不适合高手看....就是随便写来玩玩的 ...

  6. c#拼图碎片形状_将碎片拼成完整的拼图

    将碎片拼成完整的拼图 时间: 2017-12-18 12:24:15 | 作者:学霸 在这个日新月异的时代,随着移动互联网的迅速发展,各类信息传播或是用于 社交的媒体快速地不断更替.为了满足不同人群个 ...

  7. python制作图片拼图游戏下载_Python图像处理——人物拼图游戏

    游戏介绍: 拼图游戏将一幅图片分割咸若干拼块并将它们随机打乱顺序,当将所有拼块都放回原位置时,就完成了拼图(游戏结束).本人物拼图游戏为3行3列,拼块以随机顺序排列,玩家用鼠标单击空白块四周的交换它们 ...

  8. c#拼图碎片形状_C#拼图游戏编写代码

    本文设计了C#拼图游戏程序,供大家参考,具体内容如下 功能描述: 1.用户自定义上传图片 2.游戏难度选择:简单(3*3).一般(5*5).困难(9*9)三个级别 3.纪录完成步数 模块: 1.拼图类 ...

  9. c#拼图碎片形状_拼图游戏C#代码

    声明:本游戏由 14477-Ly 所写,可以转载,须说明出处 using System; using System.Collections.Generic; using System.Linq; us ...

最新文章

  1. MySQL的SQL Profiler性能分析器
  2. 273 Integer to English Words 整数转换英文表示
  3. python操作hbase,Python操作Hbase
  4. 工业机械人运动学正逆解,简单粗暴!!!!!!
  5. 如何用Pygame写游戏(八)
  6. .net mysql 序号_MYSQL如何自动为查询数据的结果编上序号详解
  7. 力扣150. 逆波兰表达式求值(JavaScript)
  8. 时序分析基本概念介绍——SDC概述
  9. 服务器端配置nodejs环境(使用pm2进程管理运行)
  10. Apache下设置整站变灰方法
  11. 安卓系统命令 ftp服务器,安卓手机 ftp服务器
  12. 浅谈Unity中的rotation和Quaternion的乘法
  13. 如何在线无痕去除图片水印
  14. 有理数域上lamada矩阵(方阵)化标准形的实现
  15. mac终端里新建html文件,mac命令行终端怎么创建文件 mac命令行终端创建文件教程...
  16. 服务器物理架构部署图,部署图
  17. 2011年度中国地区安全威胁大事记
  18. 毕业设计之 ---- 基于大数据挖掘的岗位薪资水平分析
  19. 手游无间狱完整源码(开发+运维+环境搭建+GM命令等)
  20. 痞子衡嵌入式:嵌入式Cortex-M系统中断延迟及其测量方法简介

热门文章

  1. 现代操作系统学习笔记三、死锁
  2. 软件测试内容全貌——全景图 (1)
  3. 《AngularJS深度剖析与最佳实践》一 2.4 控制器
  4. RS485通信--AT_SURF案例No.10
  5. 黄柳青:中国软件的致命缺陷是什么!
  6. 树莓派11bullseye换源/Opencv安装
  7. Unity3D研究院之异步加载游戏场景与异步加载游戏资源进度条(三十一)
  8. GBASE 8a MPP EXplain extended
  9. 专业档案门类代码编码方案
  10. Transflow安装时弹出错误:You are using pip version 9.0.1, however version 19.1.1 is available. You should co