G
Guest
Hi
I have some code to create an ownerdrawn listbox (derived), and when I add
an item to it, the bold text of the first item (the title, 'Collections and
Maturities') mysteriously seems to get bunched up at the right, i.e. squashed
up! any idea why?
The main bit of the code is as such
// (in progressReporter.cs)
protected struct LBRow //a row of the listbox, whether it be the title or a
table listing
{
public string Text;
public int Rows;
public bool IsTitle;
public LBRow(string text, int rows, bool istitle)
{
Text = text;
Rows = rows;
IsTitle = istitle;
}
}
public void AddReport(ProgressReport p)
{
Items.Add(new LBRow(p.JobName, 0, true));
foreach(ProgressReport.ProgressReportItem pi in p.TablesCopied)
Items.Add(new LBRow(pi.TableName, pi.Rows, false));
}
public struct ProgressReport
{
public string JobName;
public ProgressReportItem[] TablesCopied;
public struct ProgressReportItem
{
public string TableName;
public int Rows;
public ProgressReportItem(string tablename, int rows)
{
TableName = tablename;
Rows = rows;
}
}
public ProgressReport(string jobname, params ProgressReportItem[]
tablescopied)
{
JobName = jobname;
TablesCopied = tablescopied;
}
}
// (in frmMain)
private void Form1_Load(object sender, System.EventArgs e)
{
listBox2.AddReport(new ProgressReporter.ProgressReport(
"Collections and Maturities",
new ProgressReporter.ProgressReport.ProgressReportItem("Table1", 100000),
new ProgressReporter.ProgressReport.ProgressReportItem("Table2", 500000)));
}
I have some code to create an ownerdrawn listbox (derived), and when I add
an item to it, the bold text of the first item (the title, 'Collections and
Maturities') mysteriously seems to get bunched up at the right, i.e. squashed
up! any idea why?
The main bit of the code is as such
// (in progressReporter.cs)
protected struct LBRow //a row of the listbox, whether it be the title or a
table listing
{
public string Text;
public int Rows;
public bool IsTitle;
public LBRow(string text, int rows, bool istitle)
{
Text = text;
Rows = rows;
IsTitle = istitle;
}
}
public void AddReport(ProgressReport p)
{
Items.Add(new LBRow(p.JobName, 0, true));
foreach(ProgressReport.ProgressReportItem pi in p.TablesCopied)
Items.Add(new LBRow(pi.TableName, pi.Rows, false));
}
public struct ProgressReport
{
public string JobName;
public ProgressReportItem[] TablesCopied;
public struct ProgressReportItem
{
public string TableName;
public int Rows;
public ProgressReportItem(string tablename, int rows)
{
TableName = tablename;
Rows = rows;
}
}
public ProgressReport(string jobname, params ProgressReportItem[]
tablescopied)
{
JobName = jobname;
TablesCopied = tablescopied;
}
}
// (in frmMain)
private void Form1_Load(object sender, System.EventArgs e)
{
listBox2.AddReport(new ProgressReporter.ProgressReport(
"Collections and Maturities",
new ProgressReporter.ProgressReport.ProgressReportItem("Table1", 100000),
new ProgressReporter.ProgressReport.ProgressReportItem("Table2", 500000)));
}