Språk

CroppedBitmap Konstruktorer

Definition

Initierar en ny instans av CroppedBitmap klassen.

Överlagringar

Name Description
CroppedBitmap()

Initierar en ny instans av CroppedBitmap klassen.

CroppedBitmap(BitmapSource, Int32Rect)

Initierar en ny instans av CroppedBitmap klassen som har angivet Source och SourceRect.

CroppedBitmap()

Initierar en ny instans av CroppedBitmap klassen.

public:
 CroppedBitmap();
public CroppedBitmap();
Public Sub New ()

Kommentarer

CroppedBitmap implementerar ISupportInitialize gränssnittet för att optimera initieringen av flera egenskaper. Om du vill initiera en CroppedBitmap skapad med den här konstruktorn måste du utföra egenskapsinitiering mellan BeginInit och EndInit anrop.

Gäller för

CroppedBitmap(BitmapSource, Int32Rect)

Initierar en ny instans av CroppedBitmap klassen som har angivet Source och SourceRect.

public:
 CroppedBitmap(System::Windows::Media::Imaging::BitmapSource ^ source, System::Windows::Int32Rect sourceRect);
public CroppedBitmap(System.Windows.Media.Imaging.BitmapSource source, System.Windows.Int32Rect sourceRect);
new System.Windows.Media.Imaging.CroppedBitmap : System.Windows.Media.Imaging.BitmapSource * System.Windows.Int32Rect -> System.Windows.Media.Imaging.CroppedBitmap
Public Sub New (source As BitmapSource, sourceRect As Int32Rect)

Parametrar

source
BitmapSource

Den Source nya CroppedBitmap instansen.

sourceRect
Int32Rect

Den SourceRect nya CroppedBitmap instansen.

Undantag

source är null.

sourceRect ligger utanför gränserna sourceför .

Exempel

I följande exempel visas hur du använder CroppedBitmap(BitmapSource, Int32Rect) för att initiera en ny instans av CroppedBitmap klassen.

// Create an Image element.
Image chainImage = new Image();
chainImage.Width = 200;
chainImage.Margin = new Thickness(5);

// Create the cropped image based on previous CroppedBitmap.
CroppedBitmap chained = new CroppedBitmap(cb,
   new Int32Rect(30, 0, (int)cb.Width-30, (int)cb.Height)); 
// Set the image's source.
chainImage.Source = chained;
' Create an Image element.
Dim chainImage As New Image()
chainImage.Width = 200
chainImage.Margin = New Thickness(5)

' Create the cropped image based on previous CroppedBitmap.
Dim chained As New CroppedBitmap(cb, New Int32Rect(30, 0, CType(cb.Width, Integer) - 30, CType(cb.Height, Integer)))
' Set the image's source.
chainImage.Source = chained

Kommentarer

CroppedBitmap objekt som skapas med den här konstruktorn initieras automatiskt. Efter initieringen ignoreras egenskapsändringar.

Gäller för