共用方式為


SPPictureLibrary Class

Represents a document library that contains pictures.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.SPList
    Microsoft.SharePoint.SPDocumentLibrary
      Microsoft.SharePoint.SPPictureLibrary

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

Syntax

<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public Class SPPictureLibrary _
    Inherits SPDocumentLibrary

Dim instance As SPPictureLibrary
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public class SPPictureLibrary : SPDocumentLibrary

Remarks

To obtain an SPPictureLibrary object, cast the given list as a picture library, as shown in the following example.

Dim pictureLibrary As SPPictureLibrary = CType(list, SPPictureLibrary)  
SPPictureLibrary oPictureLibrary = (SPPictureLibrary)list;

Warning

Changing the values of any of the properties of SPPictureLibrary may lead to adverse effects in the user interface and is not supported.

Examples

The following code example displays property settings for the size of images used in a picture library on the specified site.

Dim site As SPWeb = 
    SPControl.GetContextSite(Context).AllWebs("Site_Name")

Dim pictureLibrary As SPPictureLibrary = 
    CType(site.Lists("List_Title"), SPPictureLibrary)

Response.Write(pictureLibrary.ThumbnailSize.ToString() & " :: " & _
    pictureLibrary.WebImageHeight.ToString() & " :: " & _
    pictureLibrary.WebImageWidth.ToString())
using(SPWeb oWebsite = SPContext.Current.Site.AllWebs["Website_Name"])
{
SPPictureLibrary oPictureLibrary = 
    (SPPictureLibrary)oWebsite.Lists["List_Title"];

Response.Write(oPictureLibrary.ThumbnailSize.ToString() + " :: " +
    oPictureLibrary.WebImageHeight.ToString() + " :: " +
    oPictureLibrary.WebImageWidth.ToString());
}

Note

Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Best Practices: Using Disposable Windows SharePoint Services Objects.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

SPPictureLibrary Members

Microsoft.SharePoint Namespace