CamTimer.Controls.WebcamConfigurationPicker.webCamResolution_Scroll C# (CSharp) 메소드

webCamResolution_Scroll() 개인적인 메소드

private webCamResolution_Scroll ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
리턴 void
        private void webCamResolution_Scroll(object sender, EventArgs e)
        {
            // display selected resolution (based on the distinct list of resolutions)
            if ((webCamResolution.Value > -1) && (webCamResolution.Value < m_distinctResolutions.Count)) {
                webCamResolutionLabel.Text = Language.FormatString(Language.LanguageString.MainForm_Configuration_Resolution, m_distinctResolutions[webCamResolution.Value].Width, m_distinctResolutions[webCamResolution.Value].Height);

                // list available bitdepths for the selected resolution
                m_bitDepths.Clear();
                for (int x = 0; x < m_resolutions.Length; x++) {
                    if (m_resolutions[x].Size == m_distinctResolutions[webCamResolution.Value]) {
                        if (!m_bitDepths.Contains(new VisualBitDepth(m_resolutions[x].BPP))) {
                            m_bitDepths.Add(new VisualBitDepth(m_resolutions[x].BPP));
                        }
                    }
                }
                m_bitDepths.Sort((Comparison<VisualBitDepth>)delegate(VisualBitDepth x, VisualBitDepth y) {
                    return x.BBP.CompareTo(y.BBP);
                });

                VisualBitDepth? lastBitDepth = webCamBitDepth.SelectedItem as VisualBitDepth?;
                webCamBitDepth.Items.Clear();
                for (int x = 0; x < m_bitDepths.Count; x++) {
                    webCamBitDepth.Items.Add(m_bitDepths[x]);
                }

                if ((webCamBitDepth.SelectedIndex < 0) && (webCamBitDepth.Items.Count > 0)) {
                    int x = -1;
                    if (lastBitDepth != null) {
                        x = webCamBitDepth.Items.IndexOf(lastBitDepth);
                    }
                    if (x > -1) {
                        webCamBitDepth.SelectedIndex = x;
                    } else {
                        webCamBitDepth.SelectedIndex = webCamBitDepth.Items.Count - 1;
                    }
                }
            }
        }