public ViewReport(IReport report, IskMultiplier valuesShown) { InitializeComponent(); this.valuesShown = valuesShown; this.report = report; allowSort = report.GetAllowSort(); BuildDataTable(); view = new DataView(table); view.RowFilter = "Visible = 'True'"; // Set a few things to improve performance... reportGrid.EnableHeadersVisualStyles = false; reportGrid.CellBorderStyle = DataGridViewCellBorderStyle.None; reportGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells; reportGrid.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None; reportGrid.DataSource = view; reportGrid.VirtualMode = true; // Clear the header text on the row headers column. reportGrid.Columns["RowHeaders"].HeaderText = ""; // Make the row names, visible and expanded columns invisible. reportGrid.Columns["RowNames"].Visible = false; reportGrid.Columns["Visible"].Visible = false; reportGrid.Columns["Expanded"].Visible = false; // Set column header text. foreach (DataGridViewColumn column in reportGrid.Columns) { column.HeaderText = table.Columns[column.Name].Caption; column.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; } // Add a column to hold the expand/collapse icons DataGridViewImageColumn expandersColumn = new DataGridViewImageColumn(); expandersColumn.Name = "Expanders"; expandersColumn.HeaderText = ""; expandersColumn.DisplayIndex = 1; reportGrid.Columns.Add(expandersColumn); reportGrid.CellValueNeeded += new DataGridViewCellValueEventHandler(reportGrid_CellValueNeeded); reportGrid.CellClick += new DataGridViewCellEventHandler(reportGrid_CellClick); reportGrid.KeyDown += new KeyEventHandler(reportGrid_KeyDown); reportGrid.KeyUp += new KeyEventHandler(reportGrid_KeyUp); // Check if a logo is to be used and load it if needed. string logoFile = UserAccount.CurrentGroup.Settings.Rpt_LogoFile; if (!logoFile.Equals("") && File.Exists(logoFile)) { imgLogo.Image = Image.FromFile(logoFile); int sideLength = Math.Min(180, Math.Max(imgLogo.Image.Width, imgLogo.Image.Height)); imgLogo.Width = sideLength; imgLogo.Height = sideLength; imgLogo.Visible = true; } else { imgLogo.Visible = false; } }