C# DateTimePicker DataBinding Parse event not working

I have a datetimepicker that I am binding with nullable Date/Time column in dataset. I applied Format event successfully for null and not null object value. But, when I uncheck dtp control it does not get set to null in the dataset. This is my code: dtpBirthdate.DataBindings.Add(new Binding("Value", bsStaff, "birthDate", true)); dtpBirthdate.DataBindings["Value"].Format += new ConvertEventHan

C#DateTimePicker DataBinding解析事件不起作用

我有一个datetimepicker,我绑定数据集中的可空日期/时间列。 我成功应用格式事件为空和非空对象值。 但是,当我取消选中dtp控件时,它不会在数据集中设置为null。 这是我的代码: dtpBirthdate.DataBindings.Add(new Binding("Value", bsStaff, "birthDate", true)); dtpBirthdate.DataBindings["Value"].Format += new ConvertEventHandler(dtpFormat); dtpBirthdate.DataBindings["Value"].Parse += new ConvertEventHandl

How to save single quote with different languages in sql server

I am Inserting Malaysian/Korean/Japaneese language in sql server, i am able to save it successfully but my code broken if any word has a single quote (Apostrophe). I tried following way but unable to save it. I am using SQL Server 2014. My saving word (Address1) is: 早'上好 My saving word (Address2) is: 早上好' SQL Query is following "Insert into Employee (CountryCode, Address1

如何在sql server中用不同的语言保存单引号

我在sql server中插入马来西亚/韩国/ Japaneese语言,我可以成功保存它,但是如果任何单词有单引号(撇号),我的代码就会被破坏。 我尝试了下面的方式,但无法保存它。 我正在使用SQL Server 2014。 我的保存字(Address1)是: 早'上好 我的保存字(Address2)是: 早上好' SQL查询如下 "Insert into Employee (CountryCode, Address1, Address2)values('" + Program.CountryCode + "',N'" + Address1.Text

Creating instance of class from System.Type variable

I'm trying to build up a simple game engine in XNA much inspired by Unity. What I'm currently working on is Components that can be attached to gameobjects. I have classes like "PlayerController" and "Collider" that are components and therefor inherits from the Component class. I'm trying to create methods than can add a new component depending on a Type argumen

从System.Type变量创建类的实例

我试图在XNA中构建一个非常受Unity启发的简单游戏引擎。 我目前的工作是可以附加到gameobjects的组件。 我有像“PlayerController”和“Collider”这样的类,它们是组件,因此继承自Component类。 我试图创建方法,而不是根据Type参数添加一个新组件,例如在尝试需要组件时: public void RequireComponent(System.Type type) { //Create the component Component comp = new Component(); //Convert the component

XNA Load/Unload logic (contentmanager?)

I am trying to make a point-and-click adventure game with XNA, starting off simple. My experience with XNA is about a month old now, know how the classes and inheritance works (basic stuff). I have a problem where I cannot understand how I should load and unload the textures and game objects in the game, when the player transitions to another level. I've googled this >10 times, but all

XNA加载/卸载逻辑(contentmanager?)

我想用XNA制作一个点击式冒险游戏,从简单的开始。 我对XNA的体验现在大概有一个月了,知道类和继承是如何工作的(基本的东西)。 我遇到了一个问题,那就是当玩家转换到另一个级别时,我无法理解如何在游戏中加载和卸载纹理和游戏对象。 我已经搜索了这个> 10次,但是我发现所有的都是硬编码,而我只理解卸载的基础知识。 我想要的,正在转换到另一个层次(用新的替换所有的精灵)。 提前致谢 内容负载: SpriteBa

The dream to inherit from a struct in c#

There I am making a 2D game in C# XNA 4.0, and run across yet again a petty annoyance of mine; the Rectangle . For those using basic collision, this is almost a necessity. For almost any game object created you need to have a rectangle. Then I go to change the X, check collision, or anything else. And there I begin the never-ending battle of objectName.Rectangle.Whatever . To get around thi

从c#中的结构继承的梦想

在那里,我正在用C#XNA 4.0制作一款2D游戏,并且再次遇到我的一个小小的烦恼; 矩形 。 对于那些使用基本碰撞的人来说,这几乎是必需的。 几乎所有创建的游戏对象都需要有一个矩形。 然后我去改变X,检查碰撞或其他任何事情。 在那里,我开始了无尽的争夺objectName.Rectangle.Whatever 。 为了解决这个问题,我当然要为我提供访问这些对象的objectName属性/方法的类。 然后我敢做梦。 我有伟大的设计,使一个基本的游

How to share derived fields between instances of the same class?

I'm working on a game in C# (XNA) and I can't figure out how to do this. Here's a really simplified version of what I have going on: class GameObject { Protected Sprite mSprite; Protected string filename; public LoadContent(ContentManager theContentManager)//XNA forces you to load content through a Content Manager which belongs to the main game class { mSprite.L

如何在同一类的实例之间共享派生字段?

我正在用C#(XNA)开发一款游戏,但我无法弄清楚如何做到这一点。 以下是我正在进行的一个非常简化的版本: class GameObject { Protected Sprite mSprite; Protected string filename; public LoadContent(ContentManager theContentManager)//XNA forces you to load content through a Content Manager which belongs to the main game class { mSprite.Load(theContentManager, filename);//the Spri

Building a 2D XNA Game Engine

I'd like to build an engine in XNA, primarily for a 2D RPG. At first, I began abstracting out some classes and built a Sprite class which wrapped a Vector2 and a Texture2D, and tried loading in content from the Sprite class' constructor. However, this didn't work. Now, it appears that I have to load all of the sprites within the Game class' LoadContent method. Is there anyway

构建2D XNA游戏引擎

我想在XNA中构建引擎,主要用于2D RPG。 起初,我开始抽象出一些类并构建了一个包装了Vector2和Texture2D的Sprite类,并尝试从Sprite类的构造函数中加载内容。 但是,这并没有奏效。 现在看来,我必须加载Game类的LoadContent方法中的所有精灵。 有没有办法解决? 如果可能,我想将实际的游戏内容与引擎的内部工作分开。 是的,您可以将ContentManager作为参数传递给您的constructor以便您可以在课程中使用它。 例如 pub

Optimizing drawing calls in a basic XNA engine

I want to optimize my basic XNA engine. The structure is somewhat like this: I've a GameWorld instance and more GameObjects attached to it. Now, in every frame I do a loop between GameObjects and I call the draw method inside of them. The con of this implementation is that the GameDevice draw function is called multiple times, one for every object. Now, I want to reduce the drawing calls

在基本的XNA引擎中优化绘图调用

我想优化我的基本XNA引擎。 结构有点像这样:我有一个GameWorld实例和更多的GameObjects附加到它。 现在,在每一帧中,我都会在GameObjects之间做一个循环,然后我在里面调用draw方法。 这个实现的概念是GameDevice绘图函数被多次调用,每个对象一个。 现在,我想减少绘图调用,实现一个结构,在调用绘图方法之前,将大型矢量中的所有几何图形转换为所有顶点数据并执行一次绘图调用以绘制所有顶点数据。 这是一种有效的方

How to translate a sprite and a vertex geometry by the same distance?

I'm trying to build up a 2.5 engine with XNA. Basically, I want to display a 2D sprites (the main hero and other monsters) in a 3D background. The game will be a platform. Now, using a translation matrix on a sprite doesn't yield the same result of translate a vertex geometry in world space. I mean, if I apply Matrix.CreateTranslation(new Vector3(viewportWidth / 2, viewportHeight / 2

如何将Sprite和顶点几何体转换相同的距离?

我正在尝试搭建XNA 2.5引擎。 基本上,我想在3D背景中显示2D精灵(主要英雄和其他怪物)。 游戏将成为一个平台。 现在,在精灵上使用平移矩阵不会产生在世界空间中平移顶点几何的相同结果。 我的意思是,如果我申请 Matrix.CreateTranslation(new Vector3(viewportWidth / 2, viewportHeight / 2, 0)); 精灵将在屏幕中间平移(从显示屏左上角开始)。 但是,如果我将相同的变换应用于世界空间中的立方体,它将转化得很远

Unhandled Exception System.BadImageFormatException

I have two project; a C++ library project and a C# windows application. Both are built in VS2008. Now I have to shift it to VS2012 but when I converted and run it; application crashes. Build Configuration: C++ Project: Win32 C# Project: x86 Call Stack: ntdll.dll!_ZwRaiseException@12() + 0x12 bytes ntdll.dll!KiUserExceptionDispatcher@8() + 0x2a bytes KernelBase.dll!754ab727() [

未处理的异常System.BadImageFormatException

我有两个项目; 一个C ++库项目和一个C#windows应用程序。 两者都是在VS2008中构建的。 现在我必须将它转换到VS2012,但是当我转换并运行它时, 应用程序崩溃。 构建配置: C ++项目:Win32 C#项目:x86 调用堆栈: ntdll.dll!_ZwRaiseException@12()+ 0x12字节 ntdll.dll!KiUserExceptionDispatcher@8()+ 0x2a个字节 KernelBase.dll!754ab727() [下面的框架可能不正确和/或丢失,没有为KernelBase.