cześć,
szukam cały czas w internecie sposobu na zrobienie custom user controlki, ktora bede mogł przemieszczać w uruchomionym programie za pomocą myszy. chciałbym jednak, żeby kontrolka ten kod miała w sobie.. tzn dodając kontrolkę do Windows Form'a z toolboxa nie chce ustawiać w Form1.cs Eventów tylko chciałbym, żeby kontolka już to miała tak jak ma zmianę koloru FillEclipsa po wystąpieniu Eventu najechania myszą oraz kliknięcia.. zerknijcie na kod:

 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CustomUserControl1
{
    public partial class JazzButton : Control
    {
   
        public Color fill;
 public bool _Hovering = false;
        public bool Hovering
        {
            get { return _Hovering; }
            set
            {
                if (value == _Hovering)
                    return;
                _Hovering = value;
                Invalidate();

            }
        }
        private bool _Pressed = false;
        private bool Pressed
        {
            get { return _Pressed; }
            set
            {
                if (value == _Pressed)
                    return;
                _Pressed = value;
                Invalidate();

            }
        }
        public JazzButton()
        {
            InitializeComponent();
        }

        public new string Text
        {
            get { return base.Text; }
            set 
            {
                if (value == base.Text)
                
                    return;

                base.Text = value;
                Invalidate();

            }
        }

        protected override void OnMouseMove(MouseEventArgs e)
        {
            Hovering = true; }
        
        protected override void  OnMouseLeave(EventArgs e)
        {
            Hovering = false;
        }
      
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                Pressed = true;
            }
        }
         protected override void OnMouseUp(MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
                Pressed = false;
 }
        protected override void OnPaint(PaintEventArgs pe)
        {
            this.Height = 300;
            this.Width = 200;
            Graphics gfx1 = pe.Graphics;
            Rectangle rec1 = ClientRectangle;
            rec1.Width -= 1;
            rec1.Height -= 1;

            gfx1.FillRectangle(new SolidBrush(Parent.BackColor), ClientRectangle);

            if (Pressed)
            {
                fill = Color.Orange;
            }
            else if (Hovering)
                fill = Color.LightCyan;
            else
                fill = Color.Cyan;

            gfx1.FillRectangle(new SolidBrush(fill), rec1);

            gfx1.DrawRectangle(new Pen(Color.Blue, 1.0f), rec1);

            Font fnt1 = new Font("Verdana", (float)rec1.Height * 0.1f, FontStyle.Bold, GraphicsUnit.Pixel);

            StringFormat sf1 = new StringFormat();
            sf1.Alignment = StringAlignment.Center;
            sf1.LineAlignment = StringAlignment.Near;
            gfx1.DrawString(Text, fnt1, new SolidBrush(Color.Black), new RectangleF((float)rec1.Left, (float)rec1.Top, (float)rec1.Width, (float)rec1.Height), sf1);

        }
        protected override void OnPaintBackground(PaintEventArgs pevent)
        {
            
        }
    }
}

zastanawiam się jakie metody przeciążyć, czy np. OnMouseDown zrobić połączenie współrzędnych kursora ze współrzędnymi rysowania kontrolki.. trochę nieefektywne..
widziałem różne kody na ten temat ale jakoś żaden mi nie pasował..
fajnie by było gdyby ktoś podpowiedział troszkę ;)
pozdrawiam