How do you get an element in the form from the library?



  • I created Windows Form Application and connected a new empty library to it, and I can use this library for Form1, and I need to be able to use PictureBox in this library class.

    I saw something like that:

    public PictureBox getPictureBox() 
    {
        return pictureBox1;
    }
    


  • The specific name of a copy of the counterol, which will be in shape, you can put it in the designer. In default, it's probably picture Box1. If you set out the method proposed by you, he'll return the reference to the ezeplar and work with it.

    using System;
    using System.Drawing;
    using System.Windows.Forms;
    

    namespace WindowsFormsApplicationX
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }
    public PictureBox getPictureBox()
    {
    return pictureBox1;
    }
    }
    }




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2