怎么编写语句挑出9的倍数的图片,求帮助

jnjxmgl 2012-04-06 09:18:57
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
Image d;
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
int x = 10;
int y = 0;

for (int i = 0; i < 100; i++)
{
Label lbl = new Label();
lbl.Text = string.Format("{0}", i + 1);
lbl.Font = new Font("宋体", 10);
lbl.Size = new Size(50, 30);
if (i % 16 == 0)
{
x = 10;
y += 90;
}
lbl.Location = new Point(x, y);

x += 80;
this.Controls.Add(lbl);
}
Random r = new Random(); int j = 10; int k = -60;
for (int i = 0; i < 100; i++)
{
PictureBox p = new PictureBox();


p.Image = System.Drawing.Bitmap.FromFile(@"icon\" + r.Next(1, 40) + ".bmp");

p.Width = 50;
p.Height = 50;

if (i % 16 == 0)
{
j = 10;
k += 90;
}

p.Location = new Point(j, k);

j += 80;
this.Controls.Add(p);
}
Button b = new Button();
b.Text = "重试";
b.Top = 600;
b.Left = 450;
b.Width = 100;
b.Height = 20;
this.Controls.Add(b);
Button b1 = new Button();
b1.Text = "读心";
b1.Top = 600;
b1.Left = 850;
b1.Width = 100;
b1.Height = 20;
this.Controls.Add(b1);
PictureBox p1 = new PictureBox();
p1.Image = d;
p1.Top = 600;
p1.Left = 1000;
p1.Width = 100;
p1.Height = 100;

this.Controls.Add(b1);
}
}
}

...全文
168 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
jnjxmgl 2012-04-09
  • 打赏
  • 举报
回复
我希望把9的倍数图片跳出来,让9的倍数图片一样,我烦扽那个只能实现随机加载
jnjxmgl 2012-04-09
  • 打赏
  • 举报
回复
我知道 但是我写不知道该从哪儿写,还望你说的详细点,或者帮我写一下,谢谢
threenewbee 2012-04-06
  • 打赏
  • 举报
回复
9的倍数就是整除9余数是0。
bdmh 2012-04-06
  • 打赏
  • 举报
回复
你先把规则描述清楚

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧