Example #1
0
        public void SetText(string text, bool useBgMusicIcon)
        {
            if (this.mLabel.Text == text)
            {
                return;
            }


            if (timer != null)
            {
                timer.Enabled = false;
                timer.Stop();
                Instance.mLabel.Text         = "";
                this.mIconPictureBox.Visible = false;
                this.Visible = false;
                System.Threading.Thread.Sleep(10);
            }

            this.mLabel.Text             = text;
            this.mIconPictureBox.Visible = (text != "");
            if (text != "")
            {
                if (useBgMusicIcon)
                {
                    this.mIconPictureBox.Image = WebServer.GetBitmapFromWebServer(@"playericon\" + SmartVolManagerPackage.BgMusicManager.ActiveBgMusic.Id + ".png");
                }
                else
                {
                    this.mIconPictureBox.Image = _favIconImage;
                }
            }
            // Size and center the panel so that it is centered and fits the text
            Graphics g         = mLabel.CreateGraphics();
            int      textWidth = (int)g.MeasureString(text, mLabel.Font).Width;

            mLabel.Width         = textWidth;
            mIconPictureBox.Left = 13;
            mLabel.Left          = 75;
            panel1.Width         = (mLabel.Width + mLabel.Left);
            mLabel.Left          = 75;
            panel1.Left          = (Screen.PrimaryScreen.WorkingArea.Width - panel1.Width) / 2;
            //panel1.BackColor = Color.Green;
            //mLabel.BackColor = Color.Orange;
            //TODO: this isn't working conistently (but does sometimes)

            this.TopMost = true;
            this.Show();

            if (timer != null)
            {
                timer.Stop();
            }
            timer          = new System.Windows.Forms.Timer();
            timer.Interval = 5000;
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Enabled  = true;
            timer.Start();
        }
Example #2
0
        public static Image GetImage(long musicId, int s)
        {
            Image image = WebServer.GetBitmapFromWebServer(@"playericon\" + musicId + ".png");

            if (image != null)
            {
                image = new Bitmap(image, new Size(s, s));
            }
            else
            {
                image = null;
            }

            return(image);
        }