Solved

DesignerSerializationVisibility -- what is it exactly?

Posted on 2008-06-25
2
5,103 Views
Last Modified: 2010-04-21
There seems to be very little information
DesignerSerializationVisibility can be:

1) Hidden - The code generator does not produce code for the object.
2) Visible - The code generator produces code for the object.
3) Content - The code generator produces code for the contents of the object, rather than for the object itself.

Please explain to me what the above 3 points mean exactly, and how they will affect the 2 properties below in the code snippet.

Thank you very much for helping a newbie.
[Browsable(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]

        public new Size Size

        {

            get { return base.Size; }

            set { base.Size = value; }

        }

 

        public Color CellColor

        {

            get { return _cellColor; }

            set

            {

                _cellColor = value;

                this.Invalidate();

            }

        }

Open in new window

0
Comment
Question by:yaronusa
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 21866760
If you look at the .designer code, where the control is used, you can see the effect of chaning the designer serialization process.  Normally, control properties are stored in the .designer code.

Example:

            //
            // ReportViewer
            //
            this.ReportViewer.ActiveViewIndex = -1;
            this.ReportViewer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.ReportViewer.DisplayGroupTree = false;
            this.ReportViewer.Dock = System.Windows.Forms.DockStyle.Fill;
            this.ReportViewer.Location = new System.Drawing.Point(0, 0);
            this.ReportViewer.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.ReportViewer.Name = "ReportViewer";
            this.ReportViewer.SelectionFormula = "";
            this.ReportViewer.Size = new System.Drawing.Size(617, 738);
            this.ReportViewer.TabIndex = 0;
            this.ReportViewer.ViewTimeSelectionFormula = "";

If you want a property that doesn't get stored in the .designer file, then you can change the DesignerSerializationVisibility attribute value.
0
 

Author Closing Comment

by:yaronusa
ID: 31470609
Thanks for confirming that... I DID think the designer code should change and it didn't seem to, but I'll play with it and get it to change I'm sure.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Handling arrays 14 34
index Out OF Range Exception error 4 32
How to Get total minutes between two hours 4 27
fomat Json objects 6 18
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now