How to see properties composed in the Trowel of Properties?

  • Thread starter Thread starter Alvaro
  • Start date Start date
A

Alvaro

Good day;

I have this one problem;

I declared struct "myNumber", and in a UserControl "MyControl".

I declared a property myNumber named "NumberComposition", desire that in
the properties palette of the created controls of MyControl type me
appear the property in the same way as they appear the Font, Location or
Size properties.

That I must do?

To see I cosay

The code is:

___________________________________________________________________
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace My.Windows.Controls
{
public struct myNumber {
public readonly Int32 Precision;
public readonly Int32 Scale;
public Number(Int32 precision,Int32 scale ){
Precision = precision;
Scale = scale;
}
}
/// <summary>
/// Descripción breve de Mycon.
/// </summary>
public class MyControl: System.Windows.Forms.UserControl
{
/// <summary>
/// Variable del diseñador requerida.
/// </summary>
private System.ComponentModel.Container components = null;
private myNumber _numbercomposition = new Number(13,0);

public MyControl()
{
// Llamada necesaria para el Diseñador de formularios Windows.Forms.
InitializeComponent();

// TODO: agregar cualquier inicialización después de llamar a
InitializeComponent

}

public myNumber NumberComposition{
get{
return this._numbercomposition;
}
set{
if (this._numbercomposition.ToString() == value.ToString())
return;
this._numbercomposition = value;
if(this.NumberType == NumericType.Integer &&
this._numbercomposition.Scale > 0 )
MessageBox.Show("Value error");
}
}

protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}
 
Hi and Good day !

Wow ! That looks like Spanish !

The answer (in English !) , if I understand you correctly, is to use the
Browsable attribute:

[Browsable(true)] public int MyProperty
{
get {
// Insert code here.
return 0;
}
set {
// Insert code here.
}
}
 
Hi;

The property this Browsable OK in the Properties Palete, but it is not
possible to be edited. I wish that she sees herself like Font, Location
or Size properties that also is of type struct.

tks...

Hi and Good day !

Wow ! That looks like Spanish !

The answer (in English !) , if I understand you correctly, is to use the
Browsable attribute:

[Browsable(true)] public int MyProperty
{
get {
// Insert code here.
return 0;
}
set {
// Insert code here.
}
}

Good day;

I have this one problem;

I declared struct "myNumber", and in a UserControl "MyControl".

I declared a property myNumber named "NumberComposition", desire that in
the properties palette of the created controls of MyControl type me
appear the property in the same way as they appear the Font, Location or
Size properties.

That I must do?

To see I cosay

The code is:

___________________________________________________________________
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace My.Windows.Controls
{
public struct myNumber {
public readonly Int32 Precision;
public readonly Int32 Scale;
public Number(Int32 precision,Int32 scale ){
Precision = precision;
Scale = scale;
}
}
/// <summary>
/// Descripción breve de Mycon.
/// </summary>
public class MyControl: System.Windows.Forms.UserControl
{
/// <summary>
/// Variable del diseñador requerida.
/// </summary>
private System.ComponentModel.Container components = null;
private myNumber _numbercomposition = new Number(13,0);

public MyControl()
{
// Llamada necesaria para el Diseñador de formularios Windows.Forms.
InitializeComponent();

// TODO: agregar cualquier inicialización después de llamar a
InitializeComponent

}

public myNumber NumberComposition{
get{
return this._numbercomposition;
}
set{
if (this._numbercomposition.ToString() == value.ToString())
return;
this._numbercomposition = value;
if(this.NumberType == NumericType.Integer &&
this._numbercomposition.Scale > 0 )
MessageBox.Show("Value error");
}
}

protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}
 
Back
Top