I am using the following function to set the zoom of multilayer viewer.. In the combobox,it contains the Bestfit,Fittowidth, FittoHeight, 10,25,50,100..... when it select the integer values 10,20..1600. its working well.. when i select the bestfit or fittowidth or fittoheight option ,its remain the same as the value selected from (10,20....). No change with options Bestfit,Fittowidth,fittoheight.
private void ParseComboBoxZoomText()
{
_isTextChanged = false;
if ((_zoomToolStripComboBox.Text == "Best Fit") || (_zoomToolStripComboBox.Text == "Fit to Width") || (_zoomToolStripComboBox.Text == "Fit to Height"))
{
if (_zoomToolStripComboBox.Text == "Best Fit")
{
_multiLayerViewer.ZoomMode = ZoomMode.BestFit;
}
else if (_zoomToolStripComboBox.Text == "Fit to Width")
{
_multiLayerViewer.ZoomMode = ZoomMode.FitToWidth;
}
else if (_zoomToolStripComboBox.Text == "Fit to Height")
{
_multiLayerViewer.ZoomMode = ZoomMode.FitToHeight;
}
return;
}
float zoom;
string strZoom = _zoomToolStripComboBox.Text.Trim(null);
//Zoom can contain % in the end of text
if (strZoom.Length == 0)
{
return;
}
System.Globalization.NumberFormatInfo numberFormat = new System.Globalization.NumberFormatInfo();
if (strZoom[strZoom.Length - 1] == '%')
{
zoom = Convert.ToSingle(float.Parse(strZoom.Substring(0, strZoom.Length - 1), numberFormat) / 100.0F);
}
else
{
zoom = Convert.ToSingle(float.Parse(strZoom, numberFormat) / 100.0F);
}
if ((zoom < _multiLayerViewer.MinZoom) || (zoom > _multiLayerViewer.MaxZoom))
{
throw (new System.FormatException(""));
}
_multiLayerViewer.ZoomMode = ZoomMode.None;
_multiLayerViewer.Zoom = zoom;
}
I have checked sample code "MultiLayerImageEditorCS_NET20" downloaded from your website, its have the same problem in my system
Edited by user 14 years ago
| Reason: Not specified