Cleaned up the code in the main form but only a little.
This commit is contained in:
@@ -19,15 +19,11 @@ namespace AdvertsingProfitControl
|
|||||||
private DateTime _currentActiveDate;
|
private DateTime _currentActiveDate;
|
||||||
private readonly FrmLogConsole _console = FrmLogConsole.GetStaticInstance;
|
private readonly FrmLogConsole _console = FrmLogConsole.GetStaticInstance;
|
||||||
private int _lazyPageCounter;
|
private int _lazyPageCounter;
|
||||||
private bool isDebug;
|
|
||||||
|
|
||||||
public FrmMain(bool isDebug)
|
public FrmMain(bool isDebug)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.isDebug = isDebug;
|
|
||||||
isDebug = true;
|
|
||||||
debugMainMenu.Visible = isDebug;
|
debugMainMenu.Visible = isDebug;
|
||||||
var db = new AdvertisingProfitControlModel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void frmMain_Load(object sender, EventArgs e)
|
private void frmMain_Load(object sender, EventArgs e)
|
||||||
@@ -182,7 +178,7 @@ namespace AdvertsingProfitControl
|
|||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MessageBox.Show(@"The current database's version is " + version + @".", @"Database Version Number", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show(@"The current database's version is " + version.VersionNumber + @".", @"Database Version Number", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,14 +196,14 @@ namespace AdvertsingProfitControl
|
|||||||
|
|
||||||
var rect = e.MarginBounds;
|
var rect = e.MarginBounds;
|
||||||
|
|
||||||
if ((double) bitMap.Width/(double) bitMap.Height > (double) rect.Width/(double) rect.Height)
|
if (bitMap.Width/(double) bitMap.Height > rect.Width / (double) rect.Height)
|
||||||
// image is wider
|
// image is wider
|
||||||
{
|
{
|
||||||
rect.Height = (int) ((double) bitMap.Height/(double) bitMap.Width*(double) rect.Width);
|
rect.Height = (int) (bitMap.Height/(double) bitMap.Width* rect.Width);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rect.Width = (int) ((double) bitMap.Width/(double) bitMap.Height*(double) rect.Height);
|
rect.Width = (int) (bitMap.Width/(double) bitMap.Height* rect.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_lazyPageCounter == 0)
|
if (_lazyPageCounter == 0)
|
||||||
@@ -879,16 +875,16 @@ namespace AdvertsingProfitControl
|
|||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
public static extern int SendMessage(IntPtr hWnd, Int32 wMsg, bool wParam, Int32 lParam);
|
public static extern int SendMessage(IntPtr hWnd, Int32 wMsg, bool wParam, Int32 lParam);
|
||||||
|
|
||||||
private const int WM_SETREDRAW = 11;
|
private const int WmSetredraw = 11;
|
||||||
|
|
||||||
public static void SuspendDrawing(Control parent)
|
public static void SuspendDrawing(Control parent)
|
||||||
{
|
{
|
||||||
SendMessage(parent.Handle, WM_SETREDRAW, false, 0);
|
SendMessage(parent.Handle, WmSetredraw, false, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ResumeDrawing(Control parent)
|
public static void ResumeDrawing(Control parent)
|
||||||
{
|
{
|
||||||
SendMessage(parent.Handle, WM_SETREDRAW, true, 0);
|
SendMessage(parent.Handle, WmSetredraw, true, 0);
|
||||||
parent.Refresh();
|
parent.Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user