English 中文(简体)
不展示形象
原标题:image not displaying
  • 时间:2011-02-27 21:04:39
  •  标签:
  • c#

我希望你们能够帮助我! 我正试图把游戏简单化到死地。 当用户点击纽子时,我想死去。 选择随机编号,根据该数字,冰 d显示了该数字的形象。 工作! 然后,我希望我们的用户能够根据他们回过来的眼光向前迈进,增加他们所pin的东西,并看到这一景象。 当 de笑时,一切都是完美的,但出于某种原因,pa子永远不会走! 请告诉我,为什么。 我随函附上以下守则。 谢谢你!

protected void btnSpin_Click(object sender, EventArgs e)
    {
        Random randomNumber = new Random();
        int x = randomNumber.Next(1, 6);
        switch (x)
        {
            case 1:
                //imgDie.ImageUrl = "~/Images/dice1.jpg";
                Session["Die"] = "~/Images/dice1.jpg";
                break;
            case 2:
                Session["Die"] = "~/Images/dice2.jpg";
                break;
            case 3:
                Session["Die"] = "~/Images/dice3.jpg";
                break;
            case 4:
                Session["Die"] = "~/Images/dice4.jpg";
                break;
            case 5:
                Session["Die"] = "~/Images/dice5.jpg";
                break;
            case 6:
                Session["Die"] = "~/Images/dice6.jpg";
                break;
        }
        imgDie.ImageUrl = (string)Session["Die"];

        place = place + x;
        switch (place)
        {
            case 2:
                img2.Visible = true;
                img2.ImageUrl = (string)Session["Imagesrc"];

                break;
            case 3:
                img3.Visible = true;
                img3.ImageUrl = (string)Session["Imagesrc"];
                break;
            case 4:
                img4.Visible = true;
                img4.ImageUrl = (string)Session["Imagesrc"];

                break;
            case 5:
                img5.Visible = true;
                img5.ImageUrl = (string)Session["Imagesrc"];

                break;
            case 6:
                img6.Visible = true;
                img6.ImageUrl = (string)Session["Imagesrc"];

                break;
            case 7:
                img7.Visible = true;
                img7.ImageUrl = (string)Session["Imagesrc"];

                break;
            case 8:
                img8.ImageUrl = (string)Session["Imagesrc"];
                img8.Visible = true;
                break;
问题回答

我的猜测是你的位置变量,是一个成员领域,随着每一页的施工而重新开始。 c 标明你的位置,视你或会议情况,就像你的其他 st。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签