PictureBoxExtensions
Namespace: Wisej.Web.Markup
Assembly: Wisej.Framework (4.1.0.0)
Adds fluent markup extension methods to the PictureBox class.
- C#
- VB.NET
public class PictureBoxExtensions
Public Class PictureBoxExtensions
Methods
BorderStyle<TPictureBox>(pictureBox, borderStyle)
Sets the BorderStyle property of the specified PictureBox.
| Parameter | Type | Description |
|---|---|---|
| TPictureBox | The type of the picture box, must inherit from PictureBox. | |
| pictureBox | TPictureBox | The picture box for which to set the BorderStyle property. |
| borderStyle | BorderStyle | The BorderStyle to set for the picture box. |
Returns: TPictureBox. The modified picture box with the updated BorderStyle property.
This method allows you to specify the border style for the picture box.
myPictureBox.BorderStyle(BorderStyle.FixedSingle);
OnLoadCompleted<TPictureBox>(pictureBox, action)
Attaches an event handler for the LoadCompleted event of the specified PictureBox.
| Parameter | Type | Description |
|---|---|---|
| TPictureBox | The type of the picture box, must inherit from PictureBox. | |
| pictureBox | TPictureBox | The picture box to attach the event handler to. |
| action | Action<TPictureBox> | An action to execute when the image load is completed. |
Returns: TPictureBox. The modified picture box with the attached LoadCompleted event handler.
This method allows you to execute a custom action whenever the image loading process of the picture box is completed.
myPictureBox.OnLoadCompleted(pb =>
{
AlertBox.Show("Image load completed!");
});
OnSizeModeChanged<TPictureBox>(pictureBox, action)
Attaches an event handler for the SizeModeChanged event of the specified PictureBox.
| Parameter | Type | Description |
|---|---|---|
| TPictureBox | The type of the picture box, must inherit from PictureBox. | |
| pictureBox | TPictureBox | The picture box to attach the event handler to. |
| action | Action<TPictureBox> | An action to execute when the size mode changes. |
Returns: TPictureBox. The modified picture box with the attached SizeModeChanged event handler.
This method allows you to execute a custom action whenever the size mode of the picture box changes.
myPictureBox.OnSizeModeChanged(pb =>
{
AlertBox.Show("Size mode changed!");
});
SizeMode<TPictureBox>(pictureBox, sizeMode)
Sets the SizeMode property of the specified PictureBox.
| Parameter | Type | Description |
|---|---|---|
| TPictureBox | The type of the picture box, must inherit from PictureBox. | |
| pictureBox | TPictureBox | The picture box for which to set the SizeMode property. |
| sizeMode | PictureBoxSizeMode | The PictureBoxSizeMode to set for the picture box. |
Returns: TPictureBox. The modified picture box with the updated SizeMode property.
This method allows you to specify the size mode for the picture box, which determines how the image is displayed.
myPictureBox.SizeMode(PictureBoxSizeMode.StretchImage);