我是XNA的新手,现在我正在使用以下代码绘制一个矩形:
// Calculate particle intensity
intense = (int)((float)part.Life / PARTICLES_MAX_LIFE);
// Generate pen for the particle
pen = new Pen(Color.FromArgb(intense * m_Color.R , intense * m_Color.G, intense * m_Color.B));
// Draw particle
g.DrawRectangle(pen, part.Position.X, part.Position.Y,
Math.Max(1,8 * part.Life / PARTICLES_MAX_LIFE),
Math.Max(1,8 * part.Life / PARTICLES_MAX_LIFE));
pen.Dispose();
Run Code Online (Sandbox Code Playgroud)
使用我在网上找到的颜色填充矩形的所有方法似乎都不适用于我绘制矩形的方式.我怎么能用颜色填充它?
public interface IFoo
public class Foo : IFoo
public interface ILang<T> where T:IFoo
public class Lang : ILang<Foo>
Run Code Online (Sandbox Code Playgroud)
但现在,我想用通配符这样的东西
public class CarroMontadora<T> where T:ILang<?>
Run Code Online (Sandbox Code Playgroud)
因为这不适用于我的界面:
public class MYCLASS<T> where T:ILang<IFoo>
Run Code Online (Sandbox Code Playgroud)
这不是太聪明,因为不是那么泛型:
public class MYCLASS<T,U> where T:ILang<U> where U: IFoo
Run Code Online (Sandbox Code Playgroud) 我有一个大文本。我需要在文本中找到任何单词,然后将包含该单词的短语复制到变量中。我怎样才能用 C# 做到这一点?也许我可以使用一些正则表达式?
我们可以<?php ?>
在javascript中使用该标记吗?如果是,那么我的下一个问题是; 我们可以在此标签中使用会话吗?例:
success:function(data)
{
if(data)
{
<?php
if(isset($_SESSION['UserId']))
{ ?>
window.location.href="coll_delivery_det.php";
}
else
{
?> window.location.href="courier.php"; <?php
}
} ?>
}
Run Code Online (Sandbox Code Playgroud) 我有一个字符串:
set a "alfa beta gama} {alfa} {gama"
Run Code Online (Sandbox Code Playgroud)
我试着这样做:
set b [split $a "} {"]
Run Code Online (Sandbox Code Playgroud)
我希望结果是一个列表b:
element 1 = alfa beta gama
element 2 = alfa
element 3 = gama
Run Code Online (Sandbox Code Playgroud)
但是当我尝试这个时,我没有得到理想的结果,因为tcl正在分裂为""
我正在使用 Visual Studio 2013 进行 Windows Phone 应用程序开发。我必须使用
System.Web.UI.Page
Run Code Online (Sandbox Code Playgroud)
在我的代码中,但是当我尝试将其包含在:
using System.Web.UI;
Run Code Online (Sandbox Code Playgroud)
它给出了此错误: 命名空间 System 中不存在类型或命名空间名称 Web
当我在对象浏览器中搜索它时,它就在那里。我该如何使用它?
我正在尝试将字符串转换为DateTime
:
DateTime newDate = new DateTime();
DateTime.TryParse("20150620 800", out newDate);
Run Code Online (Sandbox Code Playgroud)
1/1/0001 12:00:00 AM
返回默认值(),如何正确转换?
大约两周前我开始编程,我的朋友说如果我需要的话,我可以请求你们帮忙.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int x;
string s;
do
{
Console.WriteLine("input a number in the range of 0 -100");
s = Console.ReadLine();
x = s.ToInt32();
}
while (x < 0 || x > 100);
Console.WriteLine("ok you have chosen");
Console.ReadKey();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我第一次x=s.ToInt32
遇到这个(我读过它int
应该包含一个数字,而不是一个string
或字母..)和错误:
'string' does not contain a definition for 'ToInt32' and no extension method 'ToInt32' …
Run Code Online (Sandbox Code Playgroud)