search
Japanese Chinese Nederlands Espanol Italiano Deutsch Francais Twitter Rss Feeds
.NET Framework GroupsView
Deployment Server
.NET Distributed_Apps
.NET
.NET ADO.NET
.NET ASP.NET
.NET ASP.NET Security
.NET ASP.NET Webcontrols
.NET ASP.NET Web Services
.NET Clr
.NET Compact Framework
.NET Drawing
.NET Interop
.NET Micro Porting
.NET Performance
.NET Web Services
.NET Windows Forms
.NET Windows Forms Controls
.NET General
.NET Csharp
.NET Visual Basic
.NET Vc
.NET Security
.NET Xml
Scripting Jscript
Scripting Visual Basicscript
Scripting Wsh
Smartphone Developer
Visual Basic Com
Visual Basic Controls
Visual Basic Crystal
Visual Basic Database Ado
Visual Basic Syntax
Visual Basic Vista Compatibility
Visual Basic Winapi
Vc Atl
Vc Debugger
Vc Language
Vc Mfc
Vc Stl
Visio Developer Visual Basica
Vsnet Debugging
Windows Powershell
Windowsce Embedded Vc
Xml
Xsl

Group SummariesView
.NET Framework
Access
BizTalk
Certifications
CRM
DDK
Exchange Server
FoxPro
French
French .NET
Games
German
German .NET
Graphic Design
IIS
Internet
ISA Server
Italian
Italian .NET
Maps
MCIS
Miscellaneous
Mobile Application Development
Money
MSN
Networking
Office
Ops Mgr
Publisher
Security
SharePoint
Small Business
Spanish
Spanish .NET
SQL Server
Systems Management Server
Transaction Server
Virtual PC / Virtual Server
Visual Studio
Win32
Windows 2000
Windows 2003 Server
Windows 7
Windows Live
Windows Media
Windows Update
Windows Vista
Windows XP
 

View All Microsoft NET Csharp Posts  Ask A New Question 

Custom Control property problem - Mehrdad

Friday, June 06, 2008 2:39 PM

When I put any component on a form, all of the initial values of the
components properties are collected in a auto created private method named
InitializeComponent. like this:
----------------------------------------------
this.button1.Location = new System.Drawing.Point(66, 279);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
-------------------------------------------------------------------
When I put my own control, all of its properties are added into the
InitializeComponent methode except the GraphInfo class which I defined it as
a property using the below code:
-------------------------------
[Category("Graph")]
[Browsable(true)]
public List<GraphInfo> Graphs
{
get { return this.graphs; }
}
-------------------------------
The class consists of a number of integer values.
Any idea?

Thanks in advance,
Mehrdad
reply
 

Custom Control property problem - Peter Duniho

Friday, June 06, 2008 2:48 PM

Are you sure that the Designer supports that?

I admit, I use the Designer in only the most rudimentary ways most of the
time, so I'm not familiar with the exact details for stuff like this.  But
it's not surprising to me at all that the Designer might ignore a property
that's a List<> of some arbitrary class you've defined, at least by
default.

It's _possible_ there's some way to write some sort of plug-in component
for the Designer that would handle this.  But otherwise, I'm not sure what
you expect the Designer to do with that.  What sort of UI would it present
to the user for initialization of this arbitrary collection?

Pete
reply

Thank you for your response. - Mehrdad

Friday, June 06, 2008 3:13 PM

Thank you for your response. Accually, as a part of a project, I need to
build a specific histogram (control) which can support multiple graphs. The
GraphInfo class contains all of the information for the each indivisual
graph and I need to define it as a dynamic array property to support
unlimited number of graphs.

Thank you again,
Mehrdad
reply

Custom Control property problem - Peter Duniho

Friday, June 06, 2008 4:38 PM

Well, as has been suggested to you twice already, the Designer may not
show you the property unless it has a setter that can be used to set the
value.

However, in the end...just because you _need_ to do something, that
doesn't mean that the Designer will support that particular something.  I
appreciate your essay regarding how you want to use this property, but I
don't see how that's relevant with respect to whether the Designer will
work with that use.

I recommend you follow the advice that has been given to you and add a
setter for the property.  If that doesn't do the trick, then it's entirely
possible you can't do this, given the lack of suggestions other than that.

Pete
reply

No difference!!! - Mehrdad

Friday, June 06, 2008 4:44 PM

No difference!!!

Thanks,
Mehrdad
reply

Actually, the desiner shows the property in the "properties" window, but after - Mehrdad

Friday, June 06, 2008 5:07 PM

Actually, the desiner shows the property in the "properties" window, but
after adding some graphs in the collection, non of the graphs info is saved
in the InitializeComponent methode, so, by closing and reopening the VS2008,
all of the graphs info are removed from the collection!!!

Thanks,
Mehrdad
reply

Custom Control property problem - Peter Duniho

Friday, June 06, 2008 5:50 PM

Sorry to say, I'm not really sure what else you expected.  The Designer
can easily deal with properties of primitive types.  But I would expect
for complex types, it would have no way of knowing implicitly how to
construct instances of the classes you're dealing with.

I have seen hints that the Designer is actually quite flexible, and that
if you want some specific functionality, it's possible to _write_ special
handlers for particular data types you want.  But the scenario you're
talking about is something I'd be surprised to see handled automatically.

I could be wrong.  After all, you _are_ posting in the C# newsgroup.
There's random knowledge here about various .NET and VS topics, but it is
a language-specific newsgroup after all.  I recommend that, given no
specific descriptions of how to do this have been posted so far, you may
want to find a newsgroup that is more specific to the use of Visual
Studio, or even the Designer specifically.

Pete
reply

Custom Control property problem - parez

Sunday, June 08, 2008 4:19 AM

Just taking shot here.. try adding a set property  and see what
happens..
reply

Previous Microsoft NET Csharp conversation.