Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
A custom tool(circle button) that is created by a class does not appear in toolbox after rebuild (VS 2022)


What I have tried:

<pre>I was trying to create a round button. For this, we need to create a class, here is the code:
<pre lang="C#">```
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.


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

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

I did everything in this video, but it does not work:
https://www.youtube.com/watch?v=HG7hi9s7YhQ
Posted
Updated 26-Sep-22 3:01am
v2

1 solution

It works for me: if I copy'n'paste your code into a new class in my app and build it, the button appears in the toolbox under "[MyProjectName] Components" and can be dragged onto a form.

Have you tried "reset toolbox" from the context menu? Try shutting VS, the reopening your project afterwards as well.
 
Share this answer
 

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