How can I create a new ImageElement by passing parameter to it.

private void button1_Click(object sender, EventArgs e)
        {
            DrawButton("Digit.png", 90, 50,EButton1);
        }
        /// <summary>
        /// Draw Image Button
        /// </summary>
        private void DrawButton(string image,int left, int top, ImageElement element)
        {
            element =new ImageElement();
            element.Source = @image;
            element.Left = left;
            element.Top = top;
            element.AlphaChannel = true;
            element.Click += new EventHandler(iname_Click);
            this.Canvas.Children.Add(element);
            this.Invalidate();
        // Now element should be = EButton1 ! of course the above example does not works ! 
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.