使用C#编程时WM6仿真器出现问题 [英] Problem with WM6 emulator while programing in C#

查看:79
本文介绍了使用C#编程时WM6仿真器出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hy,

我正在尝试用C#为PocketPc制作一个小游戏我正在使用visual studio 2005,当我在windows mobile 6经典模拟器上运行游戏时,它运行5分钟和它关闭没有任何错误。

有没有人知道这种行为的原因是什么?

这是代码:


使用System;
使用System.Collections.Generic;
使用System.ComponentModel;
使用System.Data;
使用System.Drawing;
使用System.Drawing.Drawing2D;
使用System.Text;
使用System.Windows.Forms;
使用System.Collections;
使用System.Drawing.Imaging;


命名空间游戏3
{
公共部分类Form1:表格




TextureBrush brushPapers;

私人int varPer;

public Form1()
{
InitializeComponent();

System.Reflection.Assembly execAssem =
System.Reflection.Assembly.GetExecutingAssembly();

新的System.Drawing.Bitmap(
execAssem.GetManifestResourceStream(@"game3) .js.png")
);

brushPapers = new TextureBrush(js);

varPer = 16;

计时器1。 Enabled = true;



private void timer1_Tick(object sender,EventArgs e)
{
updatePositions();
Invalidate();
}
私有位图backBuffer = null;

private void Form1_Paint(object sender,System.Windows.Forms.PaintEventArgs e)
{

if(backBuffer == null)
{
backBuffer = new Bitmap(this.ClientSize.Width,this.ClientSize.Height);
}使用(Graphics g = Graphics.FromImage(backBuffer))
{

g.Clear(Color.White);

Point [] ptp = {
new Point(ClientSize.Width / 2-varPer,ClientSize.Height / 2-varPer),新点(ClientSize.Width / 2 + varPer,ClientSize.Height / 2-varPer),新点( ClientSize.Width / 2 + varPer,ClientSize.Height / 2 + varPer),
新点(ClientSize.Width / 2-varPer,ClientSize.Height / 2 + varPer)
};

g.FillPolygon(brushPapers,ptp);
}
e.Graphics.DrawImage(backBuffer,0,0);
}

private void updatePositions()
{

if(varPer< ClientSize.Height / 2)varPer + = 3;
否则varPer = 16;




保护覆盖void OnPaintBackground(PaintEventArgs pevent)
{
/ /不要让背景画画。




新增了一个

Hy ,

I'm trying to make a little game in C# for pocketPc I'm using visual studio 2005 and when I run the game on the windows mobile 6 classic emulator it run for 5 minute and the it close without any errors.

Does anybody know what can be the cause of this behavior ?

Here is the code  :


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Drawing.Imaging;


namespace game3
{
    public partial class Form1 : Form
    {
    
        TextureBrush brushPapers;

        private int varPer;

        public Form1()
        {
            InitializeComponent();

            System.Reflection.Assembly execAssem =
                System.Reflection.Assembly.GetExecutingAssembly();

            js = new System.Drawing.Bitmap(
               execAssem.GetManifestResourceStream(@"game3.js.png")
               );
    
            brushPapers = new TextureBrush(js);
            
            varPer = 16;

            timer1.Enabled = true;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            updatePositions();
            Invalidate();
        }

        private Bitmap backBuffer = null;
    
        private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
          
            if (backBuffer == null)
            {
                backBuffer = new Bitmap(this.ClientSize.Width, this.ClientSize.Height);
            }
            using (Graphics g = Graphics.FromImage(backBuffer))
            {

            g.Clear(Color.White);

                          Point[] ptp = {
            new Point(ClientSize.Width/2-varPer,ClientSize.Height/2-varPer),
            new Point(ClientSize.Width/2+varPer, ClientSize.Height/2-varPer),
            new Point(ClientSize.Width/2+varPer,ClientSize.Height/2+varPer),
            new Point(ClientSize.Width/2-varPer, ClientSize.Height/2+varPer)
            };

                g.FillPolygon(brushPapers,ptp);
              
            }
            e.Graphics.DrawImage(backBuffer, 0, 0);
        }

        private void updatePositions()
        {
                  
            if (varPer < ClientSize.Height/2) varPer+=3;
            else varPer = 16;
      
        }
        protected override void OnPaintBackground(PaintEventArgs pevent)
        {
            // Don't allow the background to paint.
        }

    }





推荐答案

Hy,

我没有。

我只在模拟器上运行。

Hy,

 I didn't have one .

 I run it only on emulator.


这篇关于使用C#编程时WM6仿真器出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆