Arguments of histogram events.
Наследование: System.EventArgs
Пример #1
0
        // Mouse cursor's position has changed within histogram control
        private void histogramControl_PositionChanged(object sender, Accord.Controls.HistogramEventArgs e)
        {
            if (histogram != null)
            {
                int pos = e.Position;

                if (pos != -1)
                {
                    textBox.Text = string.Format("Value: {0}   Count: {1}   Percent: {2:F2}",
                                                 pos, histogram.Values[pos], ((float)histogram.Values[pos] * 100 / histogram.TotalCount));
                }
                else
                {
                    textBox.Text = string.Empty;
                }
            }
        }
Пример #2
0
        // Selection has changed within histogram control
        private void histogramControl_SelectionChanged(object sender, Accord.Controls.HistogramEventArgs e)
        {
            if (histogram != null)
            {
                int min   = e.Min;
                int max   = e.Max;
                int count = 0;

                // count pixels
                for (int i = min; i <= max; i++)
                {
                    count += histogram.Values[i];
                }

                textBox.Text = string.Format("Values: {0}...{1}   Count: {2}   Percent: {3:F2}",
                                             min, max, count, ((float)count * 100 / histogram.TotalCount));
            }
        }