C#Winforms picturebox vs Imagelist以不同的形式

发布于 2025-01-24 13:44:26 字数 730 浏览 5 评论 0原文

我正在尝试通过if语句中的c#Winforms中的另一个形式提供图片。要更具体地,如果我从图像列表中选择图片,其计数数字为1,我想将该图片提供给另一个表单及其名称(通过手动写作),当我单击按钮时,所有这些都可以。这是我的代码,请耐心等待,并帮助我修复它。我没有任何错误,该程序运行得很好,但是我有此错误,图片和文本没有出现在其他表单上。祝你有美好的一天!!!

备注:cakechoose_pic,prajituri_pic是pictureboxes

private void button3_Click(object sender, EventArgs e)
        {
            if(cakeChoose_pic.Image==imageList1.Images[1])
            {
                Comanda comanda = new Comanda();
                this.Hide();
                comanda.Closed += (s, args) => this.Close();
                comanda.Show();

                comanda.prajituri_pic.Image = imageList1.Images[1];
                comanda.prajitura_txtBox.Text = "Amandina";
            }


        }

I am trying to provide the picture from a PictureBox to another form in C# WinForms by if statement. To be more concrete, if I choose a pic from an image list and its count number is 1, I want to provide that picture to another form and its name (by manual writing), all that when I click a button. Here's my code, please be patient and help me to fix it. I don't have any errors, the program is working perfectly, but I have this bug, the pictures and the text doesn't appear on the other form. Have a great day!!!

Remarks: cakeChoose_pic, prajituri_pic are PictureBoxes

private void button3_Click(object sender, EventArgs e)
        {
            if(cakeChoose_pic.Image==imageList1.Images[1])
            {
                Comanda comanda = new Comanda();
                this.Hide();
                comanda.Closed += (s, args) => this.Close();
                comanda.Show();

                comanda.prajituri_pic.Image = imageList1.Images[1];
                comanda.prajitura_txtBox.Text = "Amandina";
            }


        }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文