Using structs as properties in custom controls

G

Guest

Hi,

how do I have to decalre a struct in C# to be able to use it as a property
in a custom control?

I do have a custom control with design time support and I want to add a
property similar like the standard Size Property.
Using my control I am not able to access the property. The control Designer
displays it as inactive and the compiler returns:

"Cannot modify the return value of
'TargetControls.TBaseDisplayControl.DisplayValue' because it is not a
variable"

Below is an excerpt of my code

public struct theStruct
{
private int m_i;
private int m_j;
public theStruct(int ii, int jj)
{
m_i=ii;
m_j=jj;
}
}

private Size m_Dummy;
public Size Dummy
{
get
{
return m_Dummy;
}
set
{
m_Dummy = value;
}
}

Thanks,

Bjoern
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top