Control not appear in designer

  • Thread starter Thread starter wavemill
  • Start date Start date
W

wavemill

Hello!

I have created a custom control, but it's not draw in my designer, but
he is draw in my application.
If you have some tutorial to create control, with category attibute and
more...

Thank you,

J.Berdoues

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

namespace XpButton
{
public partial class CustomControl1 : Control
{
public CustomControl1()
{
InitializeComponent();
}

protected override void OnPaint(PaintEventArgs pe)
{
int X = this.Width;
int Y = this.Height;
Bitmap bmpOff = new Bitmap(X, Y);
Graphics gr = Graphics.FromImage(bmpOff);

SolidBrush brush = new SolidBrush(Color.Black);
gr.FillRectangle(brush, 0, 0, X, Y);
pe.Graphics.DrawImage(bmpOff, 0, 0);
brush.Dispose();

// Calling the base class OnPaint
base.OnPaint(pe);
}
}
}
 
Hello!
I have created a custom control, but it's not draw in my designer, but
he is draw in my application.
If you have some tutorial to create control, with category attibute and
more...

Thank you,

J.Berdoues

Are you using Visual Studio 2003 or 2005? If you're using VS 2003, it's
not very easy to make your custom control show up properly inside the
form designer. If you really need this functionality, you should
probably switch to VS 2005, which makes writing such a custom control
much easier.

-- john
 
Back
Top