A custom tool(circle button) that is created by a class does not appear in toolbox after rebuild (VS 2022)

Cem Tuğanlı 1 Reputation point
2022-09-26T10:19:53.327+00:00

I was trying to create a round button. For this, we need to create a class, here is the code:

   using System;  
   using System.Collections.Generic;  
   using System.Linq;  
   using System.Text;  
   using System.Threading.Tasks;  
   using System.Windows.Forms;  
   using System.Drawing.Drawing2D;  
     
   namespace CircularButton  
   {  
       internal class CircularButton :Button  
       {  
           protected override void OnPaint(PaintEventArgs pevent)  
           {  
               GraphicsPath g = new GraphicsPath();  
               g.AddEllipse(0, 0, ClientSize.Width, ClientSize.Height);  
               this.Region = new System.Drawing.Region(g);  
               base.OnPaint(pevent);  
           }  
       }  
   }  

After creating and coding this class, we need to rebuild the solution, after rebuilding, we must see the new CİRCLE BUTTON tool in the TOOLBOX:

enter image description here

However, I do not get neither this circule button option nor the "applicationName Components" tab:

enter image description here

I do not have both. How can I solve this problem?

Developer technologies | Windows Forms
Developer technologies | C#
{count} votes

1 answer

Sort by: Most helpful
  1. Đỗ Hồng Ngọc 1 Reputation point
    2022-10-01T03:00:05.59+00:00

    I think CircularButton should be a public but not internal class.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.