Using structs as properties in custom controls

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
Back
Top