Ben's Random Mumbles

February 2003 - Posts

System.Drawing.Color.What?

I have started using the TallPDF.NET component to create a dynamic PDF report and bumped into a little problem when I had to specify the background colors for various parts of my report. I could use the VS.NET intellisense to give me a list of all the avalible colors, but who knows what Chartreuse looks like?

So I put together a simple Windows Form that has a comboBox and a panel, and added some code to add all the colors to the comboBox, and on SelectedIndexChanged modify the background color of the panel.

To add the colors to the comboBox:

foreach (string colourName in Enum.GetNames(typeof(KnownColor)))
{
        comboBox1.Items.Add(colourName);
}

And then add an SelectedIndexChanged event to the comboBox with the following code:

string cName = (comboBox1.SelectedItem as string);
Color newColour = Color.FromName(cName);
panel1.BackColor = newColour;

Posted: Feb 28 2003, 08:59 AM by benricho | with 19 comment(s)
Filed under:
ADO.NET tips

Top 10 ADO.NET tips from Visual Studio.NET magazine.

Posted: Feb 25 2003, 03:08 PM by benricho | with 1 comment(s)
Filed under:
Reporting options in .NET

Chad has written about an interesting technique for integrating HTML reports into a WinForms application that was of particular interest to me. I have been working on a WinForms app that required a basic report, and I looked at the option of creating it in HTML but decided not to for a few reasons. Problems with printing was the main issue, such as the inability to display the column headings at the top of each page and the extra header/footer IE puts in by default when printing (page title in header, URL in footer).

In the end we used Crystal Reports.NET, which I had very limited experience in but managed to get things working. There were a few problems we bumped into with CR.NET, such as having to store images as BLOBS if we wanted to pull them out in the report dynamically. There was also no option of printing the report in landscape by default;the user has to manually change the properties in the print dialog.

I was planning on using CR.NET on another project coming up soon which requires a PDF to be created from data sitting on a remote web server, and then upload the file up to the server, which would then be accessed from the web site. But it looks like there might be a much better solution. Scott gave some praise to the Tall PDF.NET component, which would allow me to create the PDF on the server. I just hope they have improved the documentation with Version 2.

Posted: Feb 12 2003, 06:28 PM by benricho | with no comments
Filed under:
More Posts