private void CreateMonochromeBitmap() { if (m_originalBitmap == null || m_doNotUpdateMonochrome) { return; } using (var scaledImage = BitmapProcessor.FitToSize(m_originalBitmap, new Size(m_width, m_height))) { if (m_monochromeBitmap != null) { m_monochromeBitmap.Dispose(); m_monochromeBitmap = null; } var mode = (NamedItemContainer <MonochromeConversionMode>)ConversionTypeComboBox.SelectedItem; switch (mode.Data) { case MonochromeConversionMode.ThresholdBased: { m_monochromeBitmap = BitmapProcessor.ConvertTo1Bit(scaledImage, MonochromeConversionMode.ThresholdBased, (int)ThresholdUpDown.Value); break; } case MonochromeConversionMode.FloydSteinbergDithering: { m_monochromeBitmap = BitmapProcessor.ConvertTo1Bit(scaledImage); break; } default: throw new ArgumentOutOfRangeException(); } } }