Click here to Skip to main content
15,904,023 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi every one,

i have a method in which i want to display an image in the panel control.
first i put this picture in the picturebox then i add it to the panel control.

i am using two threads but it give me the error as i have mentioned in the subjection of this question.

error i am getting at line
this.agentbox.left = p.x;

anybody could give me suggestion please.

C#
private delegate void DrawOnPanelCircleDelegate(Point pp, Bitmap r );
       public void DrawOnPanelCircle(Point p, Bitmap ratImage)
       {

           if (InvokeRequired)
           {
               DrawOnPanelCircleDelegate drwOnPanelCircle = new DrawOnPanelCircleDelegate((pp, r) => DrawOnPanelCircle(p, ratImage));
               this.BeginInvoke(drwOnPanelCircle, new object[] { p, ratImage });
           }


           lock (_locker)
           {
               this.agentBox .Image = ratImage;
               this.agentBox.SizeMode = PictureBoxSizeMode.StretchImage;

               //this.Invoke((MethodInvoker)delegate
               //{
                   this.agentBox.Left = p.X;
                   this.agentBox.Top = p.Y;
               //});  
               
              
              // Application.DoEvents();


           }
Posted

I did not know that you posted a separate question (which was right thing to do) and just answered: how to draw more than one images on an image and to display through picturebox[^].

—SA
 
Share this answer
 
Comments
Muhammad Tufail 1979 4-Feb-14 11:01am    
sorry for that
Sergey Alexandrovich Kryukov 4-Feb-14 11:29am    
No problem at all. Please consider the answer, ask your follow-up questions if you have any and then accept the answer formally.
—SA
Abhinav S 4-Feb-14 11:05am    
5.
Sergey Alexandrovich Kryukov 4-Feb-14 11:29am    
Thank you, Abhinav.
—SA
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 4-Feb-14 11:31am    
Not sure the approach show in the referenced article is the best, but it worth looking at, a 5.
—SA
Abhinav S 4-Feb-14 12:22pm    
Thank you SA.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900