示例#1
0
        private void DisplaySamples()
        {
            var x      = 0;
            var y      = 0;
            var width  = 38;
            var height = 50;
            var space  = 2;

            // list of keys in the right order
            var sampleList = new SampleList();

            this.groupBoxKeys.Controls.Clear();

            sampleList.OrderBy(c => c.Position).ToList().ForEach(p =>
            {
                var sample = _samples
                             .Where(c => c.NoteName == p.NoteName && c.NoteType == p.KeyType && c.Octave == p.Octave)
                             .First();

                if (sample.NoteType == KeyType.Natural)
                {
                    AddSample(
                        sample,
                        new Point(x += (width + space), y + 30 + space),
                        new Size(width, height),
                        Color.White,
                        Color.Black);
                }
                else
                {
                    AddSample(sample,
                              new Point(x += (width + space), y),
                              new Size(width, height),
                              Color.Black,
                              Color.White);
                }
            });
        }