Retrieve image, font and color settings from Database in C# windows application

Unknown | 1:56 AM |

private void btnpreview_Click(object sender, EventArgs e)
        {
            try
            {
                dt = cs.getTable("select * from [View] where hall='Receiption'", con.con.ConnectionString.ToString());
                if (dt.Rows.Count > 0)
                {
                    Image im = Bitmap.FromFile(dt.Rows[0]["image"].ToString());
                    gbLabels.BackgroundImage = im;

                    TypeConverter converter = TypeDescriptor.GetConverter(typeof(Font));
                    // Saving Font object as a string
                    string fontString = dt.Rows[0]["font"].ToString();
                    string scrollfontString = dt.Rows[0]["scrollfont"].ToString();
                    // Load an instance of Font from a string
                    Font fon = (Font)converter.ConvertFromString(fontString);
                    Font scrollfon = (Font)converter.ConvertFromString(fontString);
                    string color = dt.Rows[0]["color"].ToString();
                    string scrollcolor = dt.Rows[0]["scrollcolor"].ToString();
                    Color col = System.Drawing.ColorTranslator.FromHtml("#" + color);
                    Color scrollcol = System.Drawing.ColorTranslator.FromHtml("#" + scrollcolor);

                    lblEventName.Font = fon;
                    lblEventName.ForeColor = col;
                    lblnotes.Font = fon;
                    lbltime.Font = fon;
                    label2.Font = fon;
                    label1.Font = fon;
                    lblnotes.ForeColor = col;
                    lbltime.ForeColor = col;
                    label2.ForeColor = col;
                    label1.ForeColor = col;
                    dougScrollingTextCtrl1.DougScrollingTextColor1 = scrollcol;
                    dougScrollingTextCtrl1.Font = scrollfon;
                    gbLabels.Visible = true;

                }
            }
            catch (Exception ex)
            {
                Utils.LogHandler.HandleError(ex);
            }
        }

Category:

About http://dotnetvisual.blogspot.in/:
DOT NET TO ASP.NET is a web application framework marketed by Microsoft that programmers can use to build dynamic web sites, web applications and web services. It is part of Microsoft's .NET platform and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime, allowing programmers to write ASP.NET code using any Microsoft .NET language. create an application very easily ....