问题:
我创建了一个工具来帮助为游戏创建关卡,当我单击图片框时出现问题,绝对没有任何反应,我放置了一个断点并且它永远不会运行。
图片框事件设置:
http://postimg.org/image/hllv4vwjz/
代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Level_Editor
{
public partial class tileWindow : Form
{
LevelControls myLevelControls;
public float myStartIndex_X;
public float myStartIndex_Y;
public float myEndIndex_X;
public float myEndIndex_Y;
public tileWindow()
{
InitializeComponent();
CPPFuncs.CreateNewWindow(displayWindow.Handle, 20, 20);
CPPFuncs.AddTileSprite("Data/Tiles/blank.dds", "blank");
Application.Idle += AppIdle;
myLevelControls = new LevelControls();
myLevelControls.AddParent(this);
myLevelControls.Show();
}
private void AppIdle(object Sender, EventArgs e)
{
CPPFuncs.Render();
this.Invalidate();
}
private void quitButton_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void displayWindow_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
CPPFuncs.Input((short)e.KeyCode);
}
private void displayWindow_MouseDown(object sender, MouseEventArgs e)
{
myStartIndex_X = e.X;
myStartIndex_Y = e.Y;
}
private void displayWindow_MouseUp(object sender, MouseEventArgs e)
{
myEndIndex_X = e.X;
myEndIndex_Y = e.Y;
if (myLevelControls.myCurrentSelectedTile != "")
{
CPPFuncs.SetTiles(myStartIndex_X, myStartIndex_Y, myEndIndex_X, myEndIndex_Y, myLevelControls.myCurrentSelectedTile);
}
}
}
static class CPPFuncs
{
const string EngineDLLName = "HGE Handle.dll";
[DllImport(EngineDLLName, CallingConvention = CallingConvention.Cdecl)]
public extern static unsafe int CreateNewWindow(IntPtr aHwnd, int aTileWidthCount, int aTileHeightCount);
[DllImport(EngineDLLName, CallingConvention = CallingConvention.Cdecl)]
public extern static unsafe int AddTileSprite(string aSprite, string aFileName);
[DllImport(EngineDLLName, CallingConvention = CallingConvention.Cdecl)]
public extern static unsafe int LoadLevel(string aDir);
[DllImport(EngineDLLName, CallingConvention = CallingConvention.Cdecl)]
public extern static unsafe int MoveCamera(float x, float y);
[DllImport(EngineDLLName, CallingConvention = CallingConvention.Cdecl)]
public extern static unsafe int Input(short aKey);
[DllImport(EngineDLLName, CallingConvention = CallingConvention.Cdecl)]
public extern static unsafe int SetTiles(float aStartX, float aStartY, float anEndX, float anEndY, string aTileSprite);
[DllImport(EngineDLLName, CallingConvention = CallingConvention.Cdecl)]
public extern static unsafe int Render();
[DllImport(EngineDLLName, CallingConvention = CallingConvention.Cdecl)]
public extern static unsafe int ScrollTiles(bool aMoveUpFlag);
}
}
自动生成的代码:
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.displayWindow = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.displayWindow)).BeginInit();
this.SuspendLayout();
//
// displayWindow
//
this.displayWindow.Location = new System.Drawing.Point(-6, -2);
this.displayWindow.Name = "displayWindow";
this.displayWindow.Size = new System.Drawing.Size(1020, 788);
this.displayWindow.TabIndex = 0;
this.displayWindow.TabStop = false;
this.displayWindow.MouseDown += new System.Windows.Forms.MouseEventHandler(this.displayWindow_MouseDown);
this.displayWindow.MouseUp += new System.Windows.Forms.MouseEventHandler(this.displayWindow_MouseUp);
this.displayWindow.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.displayWindow_PreviewKeyDown);
//
// tileWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Lavender;
this.ClientSize = new System.Drawing.Size(1011, 783);
this.Controls.Add(this.displayWindow);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "tileWindow";
this.Text = "TBS Level Editor";
((System.ComponentModel.ISupportInitialize)(this.displayWindow)).EndInit();
this.ResumeLayout(false);
}
#endregion
请询问任何其他信息