N0P 64 Well today i was going through my PC and i found my custom animated button which looks outstanding this is the c# code but if you want to use it in vb you will have to create a dll and add to the toolbox. Code: [hide] using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using System.Drawing.Drawing2D; namespace AnimatedGradientButton { [DefaultEvent("Click")] public partial class CustomButton : UserControl { int wh = 20; float ang = 45; Color cl0 = Color.Blue, cl1 = Color.Orange; Timer t = new Timer(); string txt = "CustomButton"; public CustomButton() { DoubleBuffered = true; t.Interval = 60; t.Start(); t.Tick += (s, e) => { Angle = Angle % 360 + 1; }; ForeColor = Color.White; } public float Angle { get { return ang; } set { ang = value; Invalidate(); } } public int BorderRadius { get { return wh; } set { wh = value; Invalidate(); } } public Color Color0 { get { return cl0; } set { cl0 = value; } } public Color Color1 { get { return cl1; } set { cl1 = value; } } protected override void OnPaint(PaintEventArgs e) { e.Graphics.SmoothingMode = SmoothingMode.HighQuality; GraphicsPath gp = new GraphicsPath(); gp.AddArc(new Rectangle(0, 0, wh, wh), 180, 90); gp.AddArc(new Rectangle(Width - wh, 0, wh, wh), -90, 90); gp.AddArc(new Rectangle(Width - wh, Height - wh, wh, wh), 0, 90); gp.AddArc(new Rectangle(0, Height, wh, wh), 90, 90); e.Graphics.FillPath(new LinearGradientBrush(ClientRectangle,cl0,cl1,ang), gp); e.Graphics.DrawString(txt, Font, new SolidBrush(ForeColor), ClientRectangle, new StringFormat() { LineAlignment = StringAlignment.Center, Alignment = StringAlignment.Center }); base.OnPaint(e); } } } [/hide] Here is a example used in my latest thread of the buttons! :monkas: :feelsgood: :smart: :ezy: Quote Share this post Link to post Share on other sites
Manthe 0 Thanks for sharing, i believe with this i can make better design for my projects <3 Quote Share this post Link to post Share on other sites
apexlegendisrael 1 thanks for sharing, first like! Quote Share this post Link to post Share on other sites
belle delphine 50 Well today i was going through my PC and i found my custom animated button which looks outstanding this is the c# code but if you want to use it in vb you will have to create a dll and add to the toolbox. Code: Here is a example used in my latest thread of the buttons! :monkas: :feelsgood: :smart: :ezy: aprriciate it vm Quote Share this post Link to post Share on other sites