Beispiel #1
0
        public void UpdateMouse()
        {
            MouseState mouseState = Mouse.GetState();
            SelectedCompany = null;
            foreach (StockIcon icon in Icons)
            {
                if (icon.DestRect.Contains(mouseState.X, mouseState.Y))
                {
                    SelectedCompany = icon.Company;
                    break;
                }
            }

            if (SelectedCompany != null)
            {
                ToolTip = SelectedCompany.Name + " (" + SelectedCompany.TickerName + ")\n" +
                    " Share Price: " + SelectedCompany.StockPrice.ToString("C") + "\n" +
                    " Industry: " + SelectedCompany.Industry.ToString() +"\n" +
                    " Motto: " + SelectedCompany.Motto;
                if (FilteredCompanies.Contains(SelectedCompany))
                {
                    FilteredCompanies.Remove(SelectedCompany);
                    FilteredCompanies.Add(SelectedCompany);
                }
            }
            else
            {
                ToolTip = "";
            }
        }