private void comboBox1_Format_SelectedIndexChanged(object sender, EventArgs e) { // Update format SapFormatInfo formatInfo = (SapFormatInfo)comboBox1_Format.SelectedItem; m_format = formatInfo.Value; EnableControls(); }
// Initialize format combo private void Initialize_Format_Combo() { int Index = 0; SapFormatInfo formatInfo = new SapFormatInfo(SapFormat.Mono1, "Monochrome 1-bit"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 0; } formatInfo = new SapFormatInfo(SapFormat.Mono8, "Monochrome 8-bit"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 1; } formatInfo = new SapFormatInfo(SapFormat.Mono16, "Monochrome 16-bit"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 2; } formatInfo = new SapFormatInfo(SapFormat.RGB5551, "RGB 5551"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 3; } formatInfo = new SapFormatInfo(SapFormat.RGB565, "RGB 565"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 4; } formatInfo = new SapFormatInfo(SapFormat.RGB888, "RGB 888 (blue first)"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 5; } formatInfo = new SapFormatInfo(SapFormat.RGBR888, "RGBR 888 (red first)"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 6; } formatInfo = new SapFormatInfo(SapFormat.RGB8888, "RGB 8888"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 7; } formatInfo = new SapFormatInfo(SapFormat.RGB101010, "RGB 101010"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 8; } formatInfo = new SapFormatInfo(SapFormat.RGB161616, "RGB 161616"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 9; } formatInfo = new SapFormatInfo(SapFormat.RGB16161616, "RGB 16161616"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 10; } formatInfo = new SapFormatInfo(SapFormat.RGBP8, "RGB Planar 8-bit"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 11; } formatInfo = new SapFormatInfo(SapFormat.RGBP16, "RGB Planar 16-bit"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 12; } formatInfo = new SapFormatInfo(SapFormat.HSI, "HSI"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 13; } formatInfo = new SapFormatInfo(SapFormat.HSIP8, "HSI Planar 8-bit"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 14; } formatInfo = new SapFormatInfo(SapFormat.HSV, "HSV"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 15; } formatInfo = new SapFormatInfo(SapFormat.UYVY, "UYVY"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 16; } formatInfo = new SapFormatInfo(SapFormat.YUY2, "YUY2"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 17; } formatInfo = new SapFormatInfo(SapFormat.YUYV, "YUYV"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 18; } formatInfo = new SapFormatInfo(SapFormat.LAB, "LAB"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 19; } formatInfo = new SapFormatInfo(SapFormat.LABP8, "LAB Planar 8-bit"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 20; } formatInfo = new SapFormatInfo(SapFormat.LAB101010, "LAB 101010"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 21; } formatInfo = new SapFormatInfo(SapFormat.LABP16, "LAB Planar 16-bit"); comboBox1_Format.Items.Add(formatInfo); if (m_format == formatInfo.Value) { Index = 22; } comboBox1_Format.SelectedIndex = Index; }