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 readonly FrmLogConsole _console = FrmLogConsole.GetStaticInstance;
|
||||
private int _lazyPageCounter;
|
||||
private bool isDebug;
|
||||
|
||||
public FrmMain(bool isDebug)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.isDebug = isDebug;
|
||||
isDebug = true;
|
||||
debugMainMenu.Visible = isDebug;
|
||||
var db = new AdvertisingProfitControlModel();
|
||||
}
|
||||
|
||||
private void frmMain_Load(object sender, EventArgs e)
|
||||
@@ -182,7 +178,7 @@ namespace AdvertsingProfitControl
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
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;
|
||||
|
||||
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
|
||||
{
|
||||
rect.Height = (int) ((double) bitMap.Height/(double) bitMap.Width*(double) rect.Width);
|
||||
rect.Height = (int) (bitMap.Height/(double) bitMap.Width* rect.Width);
|
||||
}
|
||||
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)
|
||||
@@ -879,16 +875,16 @@ namespace AdvertsingProfitControl
|
||||
[DllImport("user32.dll")]
|
||||
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)
|
||||
{
|
||||
SendMessage(parent.Handle, WM_SETREDRAW, false, 0);
|
||||
SendMessage(parent.Handle, WmSetredraw, false, 0);
|
||||
}
|
||||
|
||||
public static void ResumeDrawing(Control parent)
|
||||
{
|
||||
SendMessage(parent.Handle, WM_SETREDRAW, true, 0);
|
||||
SendMessage(parent.Handle, WmSetredraw, true, 0);
|
||||
parent.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user