[]
Gets or sets the maximum zoom factor of the panel.
[TypeConverter(typeof(o))]
public float MaxZoomFactor { get; set; }
Type | Description |
---|---|
float | A float value that represents the maximum zoom factor of the panel. The default is 4f. |
The following code example shows how to set the maxmum value of zoom factor.
This code example is part of a larger example provided for the C1Zoom class.
public class GcZoomDemo : Form
{
private TextBox _maxZoomFactorTextBox;
private GcZoom _gcZoom1 = new GcZoom();
public GcZoomDemo()
{
InitializeComponent();
_gcZoom1.Target = this;
_maxZoomFactorTextBox.TextChanged += maxZoomFactorTextBox_TextChanged;
}
void maxZoomFactorTextBox_TextChanged(object sender, EventArgs e)
{
string value = _maxZoomFactorTextBox.Text.Trim();
try
{
float maxFactor = (float)Convert.ToDouble(value);
_gcZoom1.MaxZoomFactor = maxFactor;
}
catch
{
_gcZoom1.MaxZoomFactor = 2f;
}
}
private void InitializeComponent()
{
_maxZoomFactorTextBox = new TextBox();
_maxZoomFactorTextBox.Location = new Point(160, 80);
this.Controls.Add(_maxZoomFactorTextBox);
}
}
Public Class GcZoomDemo
Inherits Form
Private _maxZoomFactorTextBox As TextBox
Private _gcZoom1 As New GcZoom()
Public Sub New()
InitializeComponent()
_gcZoom1.Target = Me
AddHandler _maxZoomFactorTextBox.TextChanged, AddressOf maxZoomFactorTextBox_TextChanged
End Sub
Private Sub maxZoomFactorTextBox_TextChanged(sender As Object, e As EventArgs)
Dim value As String = _maxZoomFactorTextBox.Text.Trim()
Try
Dim maxFactor As Single = CSng(Convert.ToDouble(value))
_gcZoom1.MaxZoomFactor = maxFactor
Catch
_gcZoom1.MaxZoomFactor = 2.0F
End Try
End Sub
Private Sub InitializeComponent()
_maxZoomFactorTextBox = New TextBox()
_maxZoomFactorTextBox.Location = New Point(160, 80)
Me.Controls.Add(_maxZoomFactorTextBox)
End Sub
End Class
Type | Condition |
---|---|
ArgumentOutOfRangeException | The assigned value less than 1f or more than 4f. |