around the part rendering
Style partStyle = Zone.PartStyle;
if (!partStyle.IsEmpty) {
partStyle.AddAttributesToRender(writer, Zone);
}
// We want to have 5 pixels of spacing aroung the EditorPart contents. There are
// 3 ways to accomplish this:
// 1.

- This is bad because it adds 5px of space above
// the legend. It also makes the fieldset too wide.
// 2.

- This is bad because the PartStyle-BackColor
// will now span the whole width of the legend. For consistency with WebPartChrome,
// we want the PartChromeStyle-BackColor to show in the 5px of space around the contents.
// 3.

- This is the best option.
//
// For now, I don't think we should render a margin here. People writing custom
// EditorParts can add a margin to their contents if they want it. This is not the
// same as the WebPartChrome case, since for WebParts we allow people to use ServerControls,
// that will likely not have a margin. (
writer.RenderBeginTag(HtmlTextWriterTag.Div);
RenderPartContents(writer, editorPart);
writer.RenderEndTag(); // Div
}
writer.RenderEndTag(); // Fieldset
}
protected virtual void RenderPartContents(HtmlTextWriter writer, EditorPart editorPart) {
// The AccessKey is rendered by the chrome on the

tag, so we don't want
// the EditorPart to render it on its own tags.
string accessKey = editorPart.AccessKey;
if (!String.IsNullOrEmpty(accessKey)) {
editorPart.AccessKey = String.Empty;
}
editorPart.RenderControl(writer);
if (!String.IsNullOrEmpty(accessKey)) {
editorPart.AccessKey = accessKey;
}
}
private void RenderTitle(HtmlTextWriter writer, EditorPart editorPart) {
string displayTitle = editorPart.DisplayTitle;
if (String.IsNullOrEmpty(displayTitle)) {
return;
}
// Apply TitleStyle to the Legend
TableItemStyle titleTableItemStyle = Zone.PartTitleStyle;
// PERF: Cache this, since it is needed for every EditorPart in the zone
if (_titleTextStyle == null) {
// Need to copy the TableItemStyle to a plain Style, since we are going to apply it to
// the

around the part rendering
Style partStyle = Zone.PartStyle;
if (!partStyle.IsEmpty) {
partStyle.AddAttributesToRender(writer, Zone);
}
// We want to have 5 pixels of spacing aroung the EditorPart contents. There are
// 3 ways to accomplish this:
// 1.

- This is bad because it adds 5px of space above
// the legend. It also makes the fieldset too wide.
// 2.

- This is bad because the PartStyle-BackColor
// will now span the whole width of the legend. For consistency with WebPartChrome,
// we want the PartChromeStyle-BackColor to show in the 5px of space around the contents.
// 3.

- This is the best option.
//
// For now, I don't think we should render a margin here. People writing custom
// EditorParts can add a margin to their contents if they want it. This is not the
// same as the WebPartChrome case, since for WebParts we allow people to use ServerControls,
// that will likely not have a margin. (
writer.RenderBeginTag(HtmlTextWriterTag.Div);
RenderPartContents(writer, editorPart);
writer.RenderEndTag(); // Div
}
writer.RenderEndTag(); // Fieldset
}
protected virtual void RenderPartContents(HtmlTextWriter writer, EditorPart editorPart) {
// The AccessKey is rendered by the chrome on the

tag, so we don't want
// the EditorPart to render it on its own tags.
string accessKey = editorPart.AccessKey;
if (!String.IsNullOrEmpty(accessKey)) {
editorPart.AccessKey = String.Empty;
}
editorPart.RenderControl(writer);
if (!String.IsNullOrEmpty(accessKey)) {
editorPart.AccessKey = accessKey;
}
}
private void RenderTitle(HtmlTextWriter writer, EditorPart editorPart) {
string displayTitle = editorPart.DisplayTitle;
if (String.IsNullOrEmpty(displayTitle)) {
return;
}
// Apply TitleStyle to the Legend
TableItemStyle titleTableItemStyle = Zone.PartTitleStyle;
// PERF: Cache this, since it is needed for every EditorPart in the zone
if (_titleTextStyle == null) {
// Need to copy the TableItemStyle to a plain Style, since we are going to apply it to
// the