Solved

DesignerSerializationVisibility -- what is it exactly?

Posted on 2008-06-25
2
5,161 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 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

23 Experts available now in Live!

Get 1:1 Help Now