Exemple #1
0
		private void tracker_ValueChanged(ValueControl sender, ValueChangedEventArgs e)
		{
			_zoom = ScaleFactor.CommonZooms[sender.Value];
			this.ToolTipText = _zoom.ToString();
			this.Invalidate();
			//
			if (ZoomChanged != null)
				ZoomChanged(this, new EventArgs());
		}
Exemple #2
0
		/// <summary>
		/// gets the nearestcommon zoom index
		/// </summary>
		/// <returns></returns>
		public static int GetNearestCommonZoom(ScaleFactor value)
		{
			//search nearest tracker value
			int win = 5;
			double dist = double.MaxValue;
			for (int i = 0; i < ScaleFactor.CommonZooms.Length; i++) {
				//squared distance
				double d = CommonZooms[i] - value;
				d = d*d;
				if (d < dist) {
					dist = d;
					win = i;
				}
			}
			return win;
		}