Skip to content

Instantly share code, notes, and snippets.

@jongalloway
Created June 19, 2013 11:11
Show Gist options
  • Save jongalloway/5813533 to your computer and use it in GitHub Desktop.
Save jongalloway/5813533 to your computer and use it in GitHub Desktop.
Sample Emulator - Original
protected override void OnPaint(PaintEventArgs e)
{
// Paint the LCD control. Use the contents of the LCD if available;
// otherwise call through to the base class.
if (_bitmap != null)
{
// Synchonize access to the bitmap with the .NET Micro Framework
// thread.
lock (_bitmap)
{
// Draw the LCD contents.
e.Graphics.DrawImage(_bitmap, 0, 0);
if (m_currentGesture == TouchGesture.Rotate &&
(flags & (TouchSampleValidFlag | TouchSampleDownFlag)) == (TouchSampleValidFlag | TouchSampleDownFlag))
{
e.Graphics.DrawEllipse(Pens.Red, _lastMouseDownX - c_GestureRotateXOffset, _lastMouseDownY, 3, 3);
}
}
}
else
// We have no private LCD bitmap, because the .NET Micro Framework
// hasn't called OnDevicePaint yet.
{
base.OnPaintBackground(e);
}
if (this.DesignMode)
{
// At design time, paint a dotted outline around the control.
OnPaintDesignMode(e);
}
base.OnPaint(e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment