Ejemplo n.º 1
0
 private void c1FlexGrid1_MouseDown(object sender, MouseEventArgs e)
 {
     //Handle Hyperlink click
     if (Cursor == Cursors.Hand)
     {
         HitTestInfo ht = c1FlexGrid1.HitTest(e.X, e.Y);
         if (ht.Type == HitTestTypeEnum.Cell)
         {
             FlexHyperlink link = c1FlexGrid1[ht.Row, ht.Column] as FlexHyperlink;
             if (link != null)
             {
                 link.Activate();
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void c1FlexGrid1_MouseMove(object sender, MouseEventArgs e)
        {
            //Handle Hyperlink cursor
            HitTestInfo ht = c1FlexGrid1.HitTest(e.X, e.Y);

            if (ht.Column == _hyperlinkCol)
            {
                bool hand = false;
                if (ht.Type == HitTestTypeEnum.Cell)
                {
                    FlexHyperlink link = c1FlexGrid1[ht.Row, ht.Column] as FlexHyperlink;
                    if (link != null)
                    {
                        using (Graphics g = c1FlexGrid1.CreateGraphics())
                        {
                            Rectangle rc    = c1FlexGrid1.GetCellRect(ht.Row, ht.Column, false);
                            int       width = (int)g.MeasureString(link.ToString(), c1FlexGrid1.Font).Width;
                            if (e.X - rc.Left <= width)
                            {
                                hand = true;
                            }
                        }
                        //set Tooltip
                        c1SuperTooltip1.SetToolTip(c1FlexGrid1, link.Url);
                    }
                }
                Cursor = (hand) ? Cursors.Hand : Cursors.Default;
            }
            else
            {
                if (Cursor == Cursors.Hand)
                {
                    Cursor = Cursors.Default;
                    c1SuperTooltip1.RemoveAll();
                }
            }
        }
Ejemplo n.º 3
0
        private void c1FlexGrid1_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
        {
            if (e.Row <= 0)
            {
                return;
            }

            //Handle Hyperlinks
            if (e.Col == _hyperlinkCol)
            {
                FlexHyperlink link = c1FlexGrid1[e.Row, e.Col] as FlexHyperlink;
                if (link != null)
                {
                    e.Style = c1FlexGrid1.Styles[link.Visited ? "OldLink" : "NewLink"];
                }
            }

            //Handle Progress Bars
            else if (e.Col == _progressBarCol && e.Row > 0 && e.Row < c1FlexGrid1.Rows.Count - 1)
            {
                //Get underlying value
                int value = 0;
                if (c1FlexGrid1[e.Row, e.Col] == null)
                {
                    c1FlexGrid1[e.Row, e.Col] = value;
                }
                else
                {
                    value = (int)c1FlexGrid1[e.Row, e.Col];
                }
                if (value < 0)
                {
                    value = 0;
                }
                if (value > 100)
                {
                    value = 100;
                }

                // draw background
                //e.Style = c1FlexGrid1.Styles.Highlight;
                e.DrawCell(DrawCellFlags.Background);

                // draw progress bar background from actual ProgressBar control
                Rectangle rc = e.Bounds;
                rc.Inflate(-2, -2);
                _bmp    = new Bitmap(e.Bounds.Size.Width, e.Bounds.Size.Height);
                pb.Size = e.Bounds.Size;
                pb.DrawToBitmap(_bmp, new Rectangle(new Point(0, 0), e.Bounds.Size));
                e.Graphics.DrawImage(_bmp, rc);

                //Draw Green Progress image over top of background
                rc.Width = rc.Width * value / 100;
                rc.Inflate(-1, -1);
                e.Graphics.DrawImage(imageList1.Images["progress.png"], rc);

                // draw text
                e.Text = value.ToString() + "%";
                e.DrawCell(DrawCellFlags.Content);
                e.Handled = true;
            }
        }
Ejemplo n.º 4
0
        private void LoadData()
        {
            c1FlexGrid1.Rows.Count = 21;
            Random rnd = new Random();

            string countries  = "Argentina|Austria|Belgium|Brazil|Canada|Denmark|Finland|France|Germany|Ireland|Italy|Mexico|Norway|Poland|Portugal|Spain|Sweden|Switzerland|UK|USA";
            string currencies = "ARS|EUR|EUR|BRL|CAD|DKK|EUR|EUR|EUR|EUR|EUR|MXN|NOK|PLK|EUR|EUR|SEK|CHF|EUR|USD";
            string govs       = "Republic|Federal Republic|Other|Federal Republic|Other|Constitutional Monarchy|Republic|Republic|Federal Republic|Republic|Republic|Federal Republic|Constitutional Monarchy|Republic|Republic|Parliamentary Monarchy|Constitutional Monarchy|Other|Constitutional Monarchy|Federal Republic";
            string times      = "GMT-3:00|GMT+2:00|GMT+2:00|GMT-3:00|GMT-3:30|GMT+2:00|GMT+3:00|GMT+2:00|GMT+1:00|GMT+1:00|GMT+1:00|GMT-6:00|GMT+1:00|GMT+1:00|GMT+1:00|GMT+1:00|GMT+1:00|GMT+1:00|GMT+0:00|GMT-6:00";
            string languages  = "Spanish|German|Dutch, French, German|Portuguese|English, French|Danish|Finnish, Swedish|French|German|English|Italian|Spanish|Finnish, Norwegian|Polish|Portuguese|Spanish|Swedish|French, German, Italian|English|English";

            for (int i = 1; i < c1FlexGrid1.Rows.Count; i++)
            {
                //Load image data
                c1FlexGrid1[i, _imageCol] = imageList1.Images[i - 1];
                //Load text data
                c1FlexGrid1[i, _textCol] = countries.Split('|')[i - 1];
                //Load combos data
                c1FlexGrid1[i, _multiComboCol] = currencies.Split('|')[i - 1];
                //Load multi-column combos data
                c1FlexGrid1[i, _comboCol] = govs.Split('|')[i - 1];
                //Load input mask data
                c1FlexGrid1[i, _editMaskCol] = times.Split('|')[i - 1];
                //Load checkbox list data
                c1FlexGrid1[i, _checkListCol] = languages.Split('|')[i - 1];
            }

            //Load Dates column
            for (int i = 1; i < c1FlexGrid1.Rows.Count; i++)
            {
                c1FlexGrid1[i, _dateCol] = DateTime.Now.AddDays(rnd.Next(1, 100));
            }

            //Load Checkbox column
            for (int i = 1; i < c1FlexGrid1.Rows.Count; i++)
            {
                c1FlexGrid1[i, _checkboxCol] = countries.Split('|')[i - 1].Length % 2;
            }

            //Load numeric column
            for (int i = 1; i < c1FlexGrid1.Rows.Count; i++)
            {
                c1FlexGrid1[i, _numericCol] = rnd.Next(1, 1500);
            }

            //Load hyperlink column
            c1FlexGrid1[1, _hyperlinkCol]  = new FlexHyperlink("Secretariat of Tourism", "http://www.turismo.gov.ar/eng/menu.htm");
            c1FlexGrid1[2, _hyperlinkCol]  = new FlexHyperlink("Embassy of Austria", "http://www.austria.org/");
            c1FlexGrid1[3, _hyperlinkCol]  = new FlexHyperlink("Visit Belgium", "http://www.visitbelgium.com/");
            c1FlexGrid1[4, _hyperlinkCol]  = new FlexHyperlink("Brazil - Wikipedia", "http://en.wikipedia.org/wiki/Brazil");
            c1FlexGrid1[5, _hyperlinkCol]  = new FlexHyperlink("Canada.com", "http://www.canada.com/");
            c1FlexGrid1[6, _hyperlinkCol]  = new FlexHyperlink("Official website of Denmark", "http://www.denmark.dk/");
            c1FlexGrid1[7, _hyperlinkCol]  = new FlexHyperlink("Breaking News from Finland", "http://finland.fi/");
            c1FlexGrid1[8, _hyperlinkCol]  = new FlexHyperlink("France Guide.com", "http://www.franceguide.com/");
            c1FlexGrid1[9, _hyperlinkCol]  = new FlexHyperlink("Germany.info", "http://www.germany.info/");
            c1FlexGrid1[10, _hyperlinkCol] = new FlexHyperlink("Discover Ireland", "http://www.discoverireland.ie/");
            c1FlexGrid1[11, _hyperlinkCol] = new FlexHyperlink("Facts About Italy", "http://www.state.gov/r/pa/ei/bgn/4033.htm");
            c1FlexGrid1[12, _hyperlinkCol] = new FlexHyperlink("Visit Mexico", "http://www.visitmexico.com/");
            c1FlexGrid1[13, _hyperlinkCol] = new FlexHyperlink("Official Norwegian website", "http://www.norway.org/");
            c1FlexGrid1[14, _hyperlinkCol] = new FlexHyperlink("Poland.pl", "http://www.poland.pl/");
            c1FlexGrid1[15, _hyperlinkCol] = new FlexHyperlink("Portugal Maps", "http://www.portugal-info.net/maps/");
            c1FlexGrid1[16, _hyperlinkCol] = new FlexHyperlink("Spain Tourism", "http://www.spain.info/");
            c1FlexGrid1[17, _hyperlinkCol] = new FlexHyperlink("Visit Sweden", "http://www.visitsweden.com/");
            c1FlexGrid1[18, _hyperlinkCol] = new FlexHyperlink("Info About Switzerland", "http://www.about.ch/");
            c1FlexGrid1[19, _hyperlinkCol] = new FlexHyperlink("Google UK", "http://www.google.co.uk/");
            c1FlexGrid1[20, _hyperlinkCol] = new FlexHyperlink("The United States - Wikipedia", "http://en.wikipedia.org/wiki/United_States");

            //Load large text column
            c1FlexGrid1[1, _largeTextCol]  = "Argentina is the eighth largest country in the world by land area and the largest among Spanish-speaking nations, though Mexico, Colombia and Spain are more populous.";
            c1FlexGrid1[2, _largeTextCol]  = "The origins of Austria date back to the time of the Roman Empire when a Celtic kingdom was conquered by the Romans in approximately 15 BC, and later became Noricum, a Roman province, in the mid 1st century AD—an area which mostly encloses today's Austria.";
            c1FlexGrid1[3, _largeTextCol]  = "Straddling the cultural boundary between Germanic and Latin Europe, Belgium is home to two main linguistic groups, the Flemish and the French-speakers, mostly Walloons, plus a small group of German-speakers.";
            c1FlexGrid1[4, _largeTextCol]  = "Brazil is the world's tenth largest economy at market exchange rates and the ninth largest by purchasing power parity.";
            c1FlexGrid1[9, _largeTextCol]  = "The territory of Germany covers 357,021 square kilometers (137,847 sq mi) and is influenced by a temperate seasonal climate. With 82 million inhabitants, it accounts for the largest population among the member states of the European Union and is home to the third-largest number of international migrants worldwide.";
            c1FlexGrid1[10, _largeTextCol] = "Traditionally, the island of Ireland is subdivided into four provinces: Connacht, Leinster, Munster and Ulster; and, in a system developed between the 13th and 17th centuries, thirty-two counties.";
            c1FlexGrid1[12, _largeTextCol] = "Mexico is crossed from north to south by two mountain ranges known as Sierra Madre Oriental and Sierra Madre Occidental, which are the extension of the Rocky Mountains from northern North America.";
            c1FlexGrid1[16, _largeTextCol] = "Because of its location, the territory of Spain was subject to many external influences, often simultaneously, since prehistoric times and through the dawn of the new era.";
            c1FlexGrid1[17, _largeTextCol] = "Sweden emerged as an independent and unified country during the Middle Ages. In the 17th century the country expanded its territories to form the Swedish empire.";
            c1FlexGrid1[18, _largeTextCol] = "Switzerland is a landlocked country whose territory is geographically divided between the Jura, the Central Plateau and the Alps; adding together an area of 41,285 km².";
            c1FlexGrid1[19, _largeTextCol] = "The UK is a developed country, with the world's sixth largest economy by nominal GDP and the seventh largest by purchasing power parity.";
            c1FlexGrid1[20, _largeTextCol] = "The country is situated mostly in central North America, where its 48 contiguous states and Washington, D.C., the capital district, lie between the Pacific and Atlantic Oceans, bordered by Canada to the north and Mexico to the south.";

            //Load progressbar column
            for (int i = 1; i < c1FlexGrid1.Rows.Count; i++)
            {
                c1FlexGrid1[i, _progressBarCol] = rnd.Next(0, 100);
            }
        }