您可以找到访问的设置:
WinForms应用程序属性 - >应用程序 - >程序集信息 - >中性语言
我有一个WinForm应用程序,其他子窗体(不是mdi).如果用户按下"Esc",即使没有焦点,也应关闭最上面的表格.
我可以使用键盘钩来全局捕捉Escape但我还需要关闭表单的句柄.
我想有一种方法可以使用Win32 API,但有一个使用托管代码的解决方案?
鉴于此 MSDN文章,我们了解到.Net 中的Common Type System具有以下引用类型分类:
"引用类型可以是自描述类型,指针类型或接口类型.引用类型的类型可以从自描述类型的值确定.自描述类型进一步分为数组和类类型."
我创造了一个改装的Pacman,但是我想在Pacman的口中添加一个火弩射击.我的代码是:
namespace TestingPacman
{
class Firebolt
{
Bitmap firebolt0 = null;
Bitmap firebolt1 = null;
public Point fireboltposition;
int fireboltwidth = 0;
int fireboltheight = 0;
public Firebolt(int x, int y)
{
fireboltposition.X = x;
fireboltposition.Y = y;
if (firebolt0 == null)
firebolt0 = new Bitmap("firebolt0.gif");
if (firebolt1 == null)
firebolt1 = new Bitmap("firebolt1.gif");
int fireboltwidth = firebolt0.Width;
int fireboltheight = firebolt0.Height;
}
public Rectangle GetFrame()
{
Rectangle Labelrec = new Rectangle(fireboltposition.X, fireboltposition.Y, fireboltwidth, fireboltheight);
return Labelrec;
}
public void …Run Code Online (Sandbox Code Playgroud) 所以我在C#中编写了一个mergesort作为练习,虽然它有效,但回顾代码,还有改进的余地.
基本上,算法的第二部分需要例程来合并两个排序列表.
这是我太长的实现,可以使用一些重构:
private static List<int> MergeSortedLists(List<int> sLeft, List<int> sRight)
{
if (sLeft.Count == 0 || sRight.Count == 0)
{
sLeft.AddRange(sRight);
return sLeft;
}
else if (sLeft.Count == 1 && sRight.Count == 1)
{
if (sLeft[0] <= sRight[0])
sLeft.Add(sRight[0]);
else
sLeft.Insert(0, sRight[0]);
return sLeft;
}
else if (sLeft.Count == 1 && sRight.Count > 1)
{
for (int i=0; i<sRight.Count; i++)
{
if (sLeft[0] <= sRight[i])
{
sRight.Insert(i, sLeft[0]);
return sRight;
}
} …Run Code Online (Sandbox Code Playgroud)