First of all, your code needs some clean up:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using Microsoft.WindowsMobile.Status;
namespace My_Mobile
{
public partial class MainForm : Form
{
Globals _globals = new Globals();
Bitmap backgroundVertical = null;
public MainForm()
{
InitializeComponent();
backgroundVertical = new Bitmap(_globals.ApplicationPath + @"\Resources\wallpaper.bmp");
}
private void MainForm_Load(object sender, EventArgs e)
{
}
protected override void OnPaintBackground(PaintEventArgs e)
{
//base.OnPaintBackground(e);
}
protected override void OnPaint(PaintEventArgs e)
{
using (Bitmap buffer = new Bitmap(this.Width, this.Height))
using (Graphics gfx = Graphics.FromImage(buffer))
{
gfx.Clear(this.BackColor);
gfx.DrawImage(backgroundVertical, 0, 0);
//this.Invalidate(); Don't call Invalidate here, it shouldn't be needed
e.Graphics.DrawImage(buffer, 0, 0);
}
}
}
}
Chris Tacke's classic blog talks about Bitmaps in the CF. You need to be careful:
http://blog.opennetcf.com/ctacke/PermaLink,guid,987041fc-2e13-4bab-930a-f79021225b74.aspx
After all that, I'm not really sure what your question is. Could you be more specific? Like for example, I don't see any P/Invokes, but you said you used some. Where are they?
Bryan
2009-08-27 20:04:22