private void sldZoomLevel_Scroll(object sender, EventArgs e) { lblZoomInfo.Text = String.Format("{0}%", sldZoomLevel.Value * ZOOM_STEP_VALUE); int oldPosX = _state.WindowSizeToRoom(bufferedPanel1.HorizontalScroll.Value); int oldPosY = _state.WindowSizeToRoom(bufferedPanel1.VerticalScroll.Value); _state.Scale = sldZoomLevel.Value * ZOOM_STEP_VALUE * 0.01f; UpdateScrollableWindowSize(); bufferedPanel1.HorizontalScroll.Value = _state.RoomSizeToWindow(oldPosX); bufferedPanel1.VerticalScroll.Value = _state.RoomSizeToWindow(oldPosY); bufferedPanel1.Invalidate(); }