473,569 Members | 2,844 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

update custom control during Design time

Hi,

I still have problem updating my custom control at design time.
When i change a property of my custom control in the property window, i
would like to see this change immediately on my custom control at the
design time.

Unfortunately, my custom control does not refresh at design time when a
property is changed.

Here is my custom control class extract :

namespace MyComponent
{
public partial class Frame : UserControl
{
private EventHandler HandlerColorCha nged;

public Frame()
{
InitializeCompo nent();
}

private CGridLine m_GridLines= new CGridLine();

[Category("Appea rance")]
[Browsable(true)]
[DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Content)]
[Description("Se tup Style, Type and Color of gridlines to draw.")]
[TypeConverter(t ypeof(CGridLine Converter))]
public CGridLine GridLines
{
get
{
return this.m_GridLine s;
}
set
{
this.m_GridLine s = value;
this.Invalidate ();
}
}

protected override void OnPaint(PaintEv entArgs e)
{
if (this.m_GridLin es.Lines != GridLine.None)
{
Pen myPen = new Pen(this.m_Grid Lines.Color);
e.Graphics.Draw Rectangle(myPen , new
Rectangle(0,0,t his.Width-1,this.Height-1));
}
}
}
}

the property GridLines is based on the following class :

public class CGridLine
{
public event EventHandler ColorChanged;
[RefreshProperti es(RefreshPrope rties.Repaint)]
[NotifyParentPro perty(true)]
[DefaultValue(ty peof(Color), "ActiveBord er")]
public Color Color
{
get
{
return this.m_GridLine sColor;
}
set
{
if (this.m_GridLin esColor != value)
{
this.m_GridLine sColor = value;
OnColorChanged( EventArgs.Empty );
}
}
}

protected virtual void OnColorChanged( EventArgs e)
{
if (ColorChanged != null)
{
ColorChanged(th is, e);
}
}
}

thanks for help,

Al.
Feb 17 '07 #1
1 3000
Ok, I found how to cope with it. SO do not pay attention to the previous
post.

AL.

--== Alain ==-- wrote:
Hi,

I still have problem updating my custom control at design time.
When i change a property of my custom control in the property window, i
would like to see this change immediately on my custom control at the
design time.

Unfortunately, my custom control does not refresh at design time when a
property is changed.

Here is my custom control class extract :

namespace MyComponent
{
public partial class Frame : UserControl
{
private EventHandler HandlerColorCha nged;

public Frame()
{
InitializeCompo nent();
}

private CGridLine m_GridLines= new CGridLine();

[Category("Appea rance")]
[Browsable(true)]
[DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Content)]
[Description("Se tup Style, Type and Color of gridlines to draw.")]
[TypeConverter(t ypeof(CGridLine Converter))]
public CGridLine GridLines
{
get
{
return this.m_GridLine s;
}
set
{
this.m_GridLine s = value;
this.Invalidate ();
}
}

protected override void OnPaint(PaintEv entArgs e)
{
if (this.m_GridLin es.Lines != GridLine.None)
{
Pen myPen = new Pen(this.m_Grid Lines.Color);
e.Graphics.Draw Rectangle(myPen , new
Rectangle(0,0,t his.Width-1,this.Height-1));
}
}
}
}

the property GridLines is based on the following class :

public class CGridLine
{
public event EventHandler ColorChanged;
[RefreshProperti es(RefreshPrope rties.Repaint)]
[NotifyParentPro perty(true)]
[DefaultValue(ty peof(Color), "ActiveBord er")]
public Color Color
{
get
{
return this.m_GridLine sColor;
}
set
{
if (this.m_GridLin esColor != value)
{
this.m_GridLine sColor = value;
OnColorChanged( EventArgs.Empty );
}
}
}

protected virtual void OnColorChanged( EventArgs e)
{
if (ColorChanged != null)
{
ColorChanged(th is, e);
}
}
}

thanks for help,

Al.
Feb 17 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1890
by: Thomas Jespersen | last post by:
Hello How do I databind a ASP.NET Texbox to a custom object. I a WinForm I do it like this: Dim myCustomerObject As Customer() Private Sub CreateNewCustomer myCustomerObject = New Customer() myCustomerObject.FirstName = "Thomas"
7
2977
by: Shimon Sim | last post by:
I have a custom composite control I have following property
0
1390
by: onyxring | last post by:
I'm reposting this, because I had a bit of difficulty last time and think that it might have fallen through the cracks. If I'm posting to the wrong groups, please let me know. Surely someone has some experience with this... I've been building custom web controls in C# with VS2005. Currently I'm looking into adding design-time functionality...
15
6492
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then...
1
2356
by: --== Alain ==-- | last post by:
Hi, I have some issue with my custom control. When i change my property "GridLine.Color" my custom control should redraw its border with the specified color. However, nothing happens. therefore based on an example from a book i implemented an eventhandler and tried to manage it like that... but still nothing. Here is my code example :
5
4095
by: gerry | last post by:
I am trying to create a custom container control that will only ever contain a specific type of control. At design time, when a control of a different type is added to the container I would like to wrap the control in the proper control type - which is also a container. At design time I want to be able to turn this : <my:container>...
2
19426
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's...
0
2897
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's...
0
7695
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6281
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.