那位朋友帮我处理一下有关游戏的地图(如:ra2红警)
问题:
    1.想ra2红警那样地图随鼠标的不同位置而变化,同时游戏的浏览窗用矩形显示当前位置。
    2.怎样解决如采矿车采矿在地图上处理,即动态变化显示地图的处理。
email:[email protected]  如那位高手解决的好可再追加分

解决方案 »

  1.   

    我可以给你一个例子,是我刚写的,当然,图画的效果不是很好,不过实现了你要的。你可以改改的。
    以下代码要说明的是:
    首先,maxPanel与controlPanel的比例是5:1
    其次,minPanel与原图片的比例是1:5以下是代码部分:using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;
    using System.Diagnostics;
    namespace WindowsApplication4
    {
    /// <summary>
    /// Form1 的摘要说明。
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
    private System.Windows.Forms.Panel maxPanel;
    private System.Windows.Forms.Panel minPanel;
    private System.Windows.Forms.Panel controlframe;
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null;
    private Point mousePosition=new Point(0,0); public Form1()
    {
    //
    // Windows 窗体设计器支持所必需的
    //
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if (components != null) 
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows 窗体设计器生成的代码
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    this.maxPanel = new System.Windows.Forms.Panel();
    this.minPanel = new System.Windows.Forms.Panel();
    this.controlframe = new System.Windows.Forms.Panel();
    this.minPanel.SuspendLayout();
    this.SuspendLayout();
    // 
    // maxPanel
    // 
    this.maxPanel.Location = new System.Drawing.Point(16, 0);
    this.maxPanel.Name = "maxPanel";
    this.maxPanel.Size = new System.Drawing.Size(500, 400);
    this.maxPanel.TabIndex = 0;
    // 
    // minPanel
    // 
    this.minPanel.Controls.Add(this.controlframe);
    this.minPanel.Location = new System.Drawing.Point(544, 8);
    this.minPanel.Name = "minPanel";
    this.minPanel.Size = new System.Drawing.Size(262, 350);
    this.minPanel.TabIndex = 1;
    this.minPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.minPanel_Paint);
    this.minPanel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.minPanel_MouseDown);
    // 
    // controlframe
    // 
    this.controlframe.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
    this.controlframe.Location = new System.Drawing.Point(48, 72);
    this.controlframe.Name = "controlframe";
    this.controlframe.Size = new System.Drawing.Size(50, 40);
    this.controlframe.TabIndex = 0;
    this.controlframe.MouseUp += new System.Windows.Forms.MouseEventHandler(this.controlframe_MouseUp);
    this.controlframe.Paint += new System.Windows.Forms.PaintEventHandler(this.controlframe_Paint);
    this.controlframe.MouseMove += new System.Windows.Forms.MouseEventHandler(this.controlframe_MouseMove);
    this.controlframe.MouseDown += new System.Windows.Forms.MouseEventHandler(this.controlframe_MouseDown);
    // 
    // Form1
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.ClientSize = new System.Drawing.Size(824, 485);
    this.Controls.Add(this.minPanel);
    this.Controls.Add(this.maxPanel);
    this.Name = "Form1";
    this.minPanel.ResumeLayout(false);
    this.ResumeLayout(false); }
    #endregion /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main() 
    {
    Application.Run(new Form1());
    } private void minPanel_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
    {
    Graphics g=this.minPanel.CreateGraphics();
    Image img=Image.FromFile(Application.StartupPath+@"\girl.tif");
    g.DrawImage(img,this.minPanel.ClientRectangle,0,0,img.Width,img.Height,System.Drawing.GraphicsUnit.Pixel);

    } private void controlframe_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
    {
    DrawSmall();
    } private void DrawSmall()
    {
    Graphics g=this.controlframe.CreateGraphics();
    Bitmap bmp=new Bitmap((Bitmap)Bitmap.FromFile(Application.StartupPath+@"\girl.tif"),new Size(this.minPanel.Width,this.minPanel.Height));
    g.DrawImage(bmp,this.controlframe.ClientRectangle,this.controlframe.Left,this.controlframe.Top,this.controlframe.ClientRectangle.Width,this.controlframe.ClientRectangle.Height,System.Drawing.GraphicsUnit.Pixel);
    g.Dispose();
    this.controlframe.Update();
    } private void DrawBig()
    {
    Graphics g=this.maxPanel.CreateGraphics();
    Image img=Image.FromFile(Application.StartupPath+@"\girl.tif");
    g.DrawImage(img,this.maxPanel.ClientRectangle,this.controlframe.Left*4,this.controlframe.Top*4,this.maxPanel.ClientRectangle.Width,this.maxPanel.ClientRectangle.Height,System.Drawing.GraphicsUnit.Pixel);
    g.Dispose();
    this.minPanel.Update();
    } private void controlframe_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
    {
    if(e.Button == MouseButtons.Left) 

    this.mousePosition.X = this.controlframe.Left; 
    this.mousePosition.Y =this.controlframe.Top; 
    this.DrawSmall();
    DrawBig();
    }
    } private void controlframe_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
    {

    if(e.Button == MouseButtons.Left) 

    if (e.X>=0 && e.X<=this.minPanel.ClientRectangle.Width && e.Y>=0 && e.Y<=this.minPanel.ClientRectangle.Height)
    {
    this.controlframe.Left=e.X+this.mousePosition.X;
    this.controlframe.Top=e.Y+this.mousePosition.Y;
    DrawSmall();
    DrawBig();
    }

    } private void controlframe_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
    {
    DrawSmall();
    DrawBig();
    } private void minPanel_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
    {

    this.controlframe.Left=e.X;
    this.controlframe.Top=e.Y;
    DrawBig();
    DrawSmall();

    }
    }
    }
      

  2.   

    用GDI+的话,耗CPU,会卡,用DX不会.现在XNA挺流行,可以一试
      

  3.   

    dugupiaoyun(独孤飘云),wawaku(一堆裤衩!) 谢谢啊
      

  4.   

    当然,如果你要画图的话,不能用GDI,像我这个,我只是写出来,告诉你到底怎么实现你的功能的方法,绘图啊这些就得靠你自己了
      

  5.   

    dugupiaoyun(独孤飘云) 
    真的很牛B啊