void InitializeJournal()
{
// Tool Tips
toolTip = new ToolTip();
// Horizontal ScrollBar
hScrollBar = new HScrollBar();
hScrollBar.Parent = this;
hScrollBar.Dock = DockStyle.Bottom;
hScrollBar.SmallChange = 100;
hScrollBar.LargeChange = 300;
hScrollBar.ValueChanged += new EventHandler(HScrollBar_ValueChanged);
// Vertical ScrollBar
vScrollBar = new VScrollBar();
vScrollBar.Parent = this;
vScrollBar.Dock = DockStyle.Right;
vScrollBar.TabStop = true;
vScrollBar.SmallChange = 1;
vScrollBar.LargeChange = 4;
vScrollBar.ValueChanged += new EventHandler(VScrollBar_ValueChanged);
Graphics g = CreateGraphics();
font = new Font(Font.FontFamily, 9);
string longestDirection = "";
foreach (PosDirection posDir in Enum.GetValues(typeof(PosDirection)))
if (g.MeasureString(Language.T(posDir.ToString()), font).Width >
g.MeasureString(longestDirection, font).Width)
longestDirection = Language.T(posDir.ToString());
string longestTransaction = "";
foreach (Transaction transaction in Enum.GetValues(typeof(Transaction)))
if (g.MeasureString(Language.T(transaction.ToString()), font).Width >
g.MeasureString(longestTransaction, font).Width)
longestTransaction = Language.T(transaction.ToString());
string longestBacktestEval = "";
foreach (BacktestEval eval in Enum.GetValues(typeof(BacktestEval)))
if (g.MeasureString(Language.T(eval.ToString()), font).Width >
g.MeasureString(longestBacktestEval, font).Width)
longestBacktestEval = Language.T(eval.ToString());
asTitlesPips = new string[19]
{
Language.T("Bar"),
Language.T("Date"),
Language.T("Hour"),
Language.T("Open"),
Language.T("High"),
Language.T("Low"),
Language.T("Close"),
Language.T("Volume"),
Language.T("Transaction"),
Language.T("Direction"),
Language.T("Lots"),
Language.T("Price"),
Language.T("Profit Loss"),
Language.T("Floating P/L"),
Language.T("Balance"),
Language.T("Equity"),
Language.T("Required"),
Language.T("Free"),
Language.T("Interpolation")
};
asTitlesMoney = new string[19]
{
Language.T("Bar"),
Language.T("Date"),
Language.T("Hour"),
Language.T("Open"),
Language.T("High"),
Language.T("Low"),
Language.T("Close"),
Language.T("Volume"),
Language.T("Transaction"),
Language.T("Direction"),
Language.T("Amount"),
Language.T("Price"),
Language.T("Profit Loss"),
Language.T("Floating P/L"),
Language.T("Balance"),
Language.T("Equity"),
Language.T("Required"),
Language.T("Free"),
Language.T("Interpolation")
};
string[] asColumContent = new string[19]
{
"99999",
"99/99/99",
"99:99",
"99.99999",
"99.99999",
"99.99999",
"99.99999",
"999999",
longestTransaction,
longestDirection,
"-9999999",
"99.99999",
"-9999999.99",
"-9999999.99",
"-9999999.99",
"-9999999.99",
"-9999999.99",
"-9999999.99",
longestBacktestEval
};
rowHeight = (int)Math.Max(font.Height, 18);
Padding = new Padding(border, 2 * rowHeight, border, border);
columns = 19;
aiColumnX = new int[20];
aiX = new int[20];
aiColumnX[0] = border;
aiColumnX[1] = aiColumnX[0] + (int)Math.Max(g.MeasureString(asColumContent[0], font).Width + 16, g.MeasureString(asTitlesMoney[0], font).Width) + 4;
for (int i = 1; i < columns; i++)
aiColumnX[i + 1] = aiColumnX[i] + (int)Math.Max(g.MeasureString(asColumContent[i], font).Width, g.MeasureString(asTitlesMoney[i], font).Width) + 4;
g.Dispose();
return;
}