从windows移植到wince就不行了?VC#2005

wangmengjun123   2010-3-29 13:55 楼主
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace zhengxianxian
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
double distance = 200.0;
System.Drawing.Graphics g = Graphics.FromHwnd(this.Handle);
g.Clear(this.BackColor);
Pen pn = new Pen(Color.Green, 2);
int maxY = this.Height;//获取窗体的高
int maxX = this.Width;//获取窗体的宽

double n = 2.0 * Math.PI / 200.0;
int lmin = 0;
int rmax = 200;
int count = rmax - lmin;
PointF[] mypoint = new PointF[count + 1];
int x = 0;
for (int i = lmin; i <= rmax; i++)
{

double temp = 0.5 * (maxY - maxY * Math.Sin(n * i));
mypoint[x] = new PointF((float)i, (float)temp);
x++;
}
g.DrawCurve(pn, mypoint);
pn.Dispose();
g.Dispose();

}
}
}

这是一个画正弦线的程序!在windows平台下运行很正常!但是移植到wince平台下时就出了问题!
一个是System.Drawing.Graphics g = Graphics.FromHwnd(this.Handle);系统说不包含FromHwnd的定义!
还有就是找不到PointF的命名空间!
请指教

回复评论 (2)

补充一下!我用的是vs2005 c#的开发环境!
点赞  2010-3-29 13:55
System.Drawing.Graphics g = this.CreateGraphics();

点赞  2010-3-29 13:58
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复