コード例 #1
0
        static public void DoVKeys(this WidgetMidiList widget, FloatRect grid, Graphics g)
        {
            var gs = g.Save();

            // Vertical
            using (var linePen = new Pen(Color.Blue, 1)) foreach (var row in widget.GetVLines(widget.LineOffset))
                {
                    var r = new FloatRect(widget.Container.X + 12, row.Top, widget.WidthGutter, widget.LineHeight);

                    if (row.CanDo)
                    {
                        // Note-Number + Piano-KeyName
                        var str = string.Format("{0:00#} {1,-3}", row.RowIndex, MKeys[row.RowIndex]);

                        // create rect, then move x/y and shrinks w/h by one pixel.
                        var rc = new FloatRect(grid.Left, row.Top, grid.Width, widget.LineHeight).Shrink(1);

                        using (var sb = new SolidBrush(Color.FromArgb(24, row.IsIvory ? Color.White : Color.Black)))
                            if (row.IsIvory)
                            {
                                g.FillRectangle(sb, rc);
                            }

                        var r2 = r.Clone();
                        r2.Location = r2.Location.NegX(10);
                        g.DrawText(str, Color.White, widget.Font, r2, StringAlignment.Near);
                    }
                }
            g.Restore(gs);
        }
コード例 #2
0
        public override void Design()
        {
            Gap    = 0;
            Dock   = DockStyle.Left;
            Bounds = new FloatRect(4, 48, 48, 48);
            var DefaultBounds = new FloatRect(4, 48, 32, 32);
            var DPadding      = new Padding(4);
            var awesome       = Parent.FontIndex.GetFont("awesome", 19f, FontStyle.Regular, GraphicsUnit.Pixel);

            Widgets = new Widget[]
            {
                new WidgetButton(Parent)
                {
                    Text = FontAwesome.Bars, Bounds = DefaultBounds, Padding = DPadding, Font = awesome, Smoother = true
                },                                                                                                                                     // bars
                BtnLoadMidi = new WidgetButton(Parent)
                {
                    Text = FontAwesome.Music, Bounds = DefaultBounds.Clone(), Padding = DPadding, Font = awesome, Smoother = true
                },                                                                                                                                          // h-bars
                new WidgetButton(Parent)
                {
                    Text = FontAwesome.EllipsisV, Bounds = DefaultBounds.Clone(), Padding = DPadding, Font = awesome, Smoother = true
                },                                                                                                                                                  // v-bars
                new WidgetButton(Parent)
                {
                    Text = FontAwesome.Play, Bounds = DefaultBounds.Clone(), Padding = DPadding, Font = awesome, Smoother = true
                },                                                                                                                                             // fore
                new WidgetButton(Parent)
                {
                    Text = FontAwesome.Backward, Bounds = DefaultBounds.Clone(), Padding = DPadding, Font = awesome, Smoother = true
                },                                                                                                                                                 // back
                new WidgetButton(Parent)
                {
                    Text = FontAwesome.FolderOpen, Bounds = DefaultBounds.Clone(), Padding = DPadding, Font = awesome, Smoother = true
                },                                                                                                                                                   // folder-open
                new WidgetButton(Parent)
                {
                    Text = FontAwesome.FolderOpenO, Bounds = DefaultBounds.Clone(), Padding = DPadding, Font = awesome, Smoother = true
                },                                                                                                                                                    // folder-open
                new WidgetButton(Parent)
                {
                    Text = FontAwesome.Save, Bounds = DefaultBounds.Clone(), Padding = DPadding, Font = awesome, Smoother = true
                },                                                                                                                                             // font
            };
        }