共用方式為


WebPart.ShouldSerializeWidth method

會傳回Width屬性是否有所變更其預設值。

Namespace:  Microsoft.SharePoint.WebPartPages
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'宣告
Public Overridable Function ShouldSerializeWidth As Boolean
'用途
Dim instance As WebPart
Dim returnValue As Boolean

returnValue = instance.ShouldSerializeWidth()
public virtual bool ShouldSerializeWidth()

傳回值

Type: System.Boolean
true已變更屬性值,從預設值 ;否則,請false。

備註

由於Width屬性沒有簡單的預設值,會提供ShouldSerializeWidth方法。此方法會指出屬性是否有所變更其預設值。您通常叫用這個方法開發 designer WebPart類別,或建立您自己的網頁組件或工具組件時,讓您可以避免整天保存的預設值。

如果您覆寫此函數,請將您的函數應傳回true ,如果已從其預設值變更對應的屬性或SerializeAll屬性為true。例如:

public override bool ShouldSerializeWidth() 
{ 
   return SerializeAll || defaultWidth != _width; 
}                          

請參閱

參照

WebPart class

WebPart members

Microsoft.SharePoint.WebPartPages namespace