示例#1
0
        void UpdateHighlight()
        {
            Gdk.Window win = this.GdkWindow;

            Cairo.Context g = Gdk.CairoHelper.Create(win);

            int x, y, w, h, d;

            win.GetGeometry(out x, out y, out w, out h, out d);

            g.Scale(w, h);
            g.LineWidth = (1.0 / freqs.Length) * 0.6;

            if (previousHighlight != -1)
            {
                /*int start=previousHighlight-1;
                 * int end=previousHighlight+1;
                 * if (start<0) start=0;
                 * if (end>=barStart.Length) end=barStart.Length-1;*/
                g.Color = new Color(0.0, 0.0, 0.0);
                //for(int i=start; i<=end; i++)
                DrawBar(g, previousHighlight);
            }

            if (currentHighlight != -1)
            {
                g.Color = new Color(1.0, 0.0, 0.0);
                DrawBar(g, currentHighlight);
            }
        }
示例#2
0
        protected override bool OnExposeEvent(Gdk.EventExpose args)
        {
            Gdk.Window win = args.Window;

            Cairo.Context g = Gdk.CairoHelper.Create(win);

            int x, y, w, h, d;

            win.GetGeometry(out x, out y, out w, out h, out d);
            this.HeightRequest = w / 5;

            Draw(g, w, h);

            return(true);
        }