CroppedBitmap Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the CroppedBitmap class.
Overloads
CroppedBitmap() |
Initializes a new instance of the CroppedBitmap class. |
CroppedBitmap(BitmapSource, Int32Rect) |
Initializes a new instance of the CroppedBitmap class that has the specified Source and SourceRect. |
CroppedBitmap()
Initializes a new instance of the CroppedBitmap class.
public:
CroppedBitmap();
public CroppedBitmap ();
Public Sub New ()
Remarks
CroppedBitmap implements the ISupportInitialize interface to optimize initialization on multiple properties. To initialize a CroppedBitmap created using this constructor, you must perform property initialization between BeginInit and EndInit calls.
Applies to
CroppedBitmap(BitmapSource, Int32Rect)
Initializes a new instance of the CroppedBitmap class that has the specified Source and 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)
Parameters
- source
- BitmapSource
The Source of the new CroppedBitmap instance.
- sourceRect
- Int32Rect
The SourceRect of the new CroppedBitmap instance.
Exceptions
source
is null
.
sourceRect
is outside the boundaries of source
.
Examples
The following example shows how to use CroppedBitmap(BitmapSource, Int32Rect) to initialize a new instance of the CroppedBitmap class.
// 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
Remarks
CroppedBitmap objects created using this constructor are automatically initialized. After initialization, property changes are ignored.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기