我试图在c#代码中添加颜色,例如以下颜色代码.
ListTreeView.Background = new SolidColorBrush(Colors.White);
这是工作..但我想将此颜色添加为颜色代码,所以我添加为
System.Windows.Media
有人可以给我一个例子
System.Drawing中
所以我可以做到以下几点:
ListTreeView.Background = ColorTranslator.FromHtml("#FFE7EFF2");
这给了我错误; 有任何想法吗?
我正在使用Linq查询和调用方法.
oPwd = objDecryptor.DecryptIt((c.Password.ToString())
Run Code Online (Sandbox Code Playgroud)
它将返回null值.
意味着这不起作用.
我如何解决这个问题.
谢谢..
var q =
from s in db.User
join c in db.EmailAccount on s.UserId equals c.UserId
join d in db.POPSettings
on c.PopSettingId equals d.POPSettingsId
where s.UserId == UserId && c.EmailId == EmailId
select new
{
oUserId = s.UserId,
oUserName = s.Name,
oEmailId = c.EmailId,
oEmailAccId = c.EmailAccId,
oPwd = objDecryptor.DecryptIt(c.Password.ToString()),
oServerName = d.ServerName,
oServerAdd = d.ServerAddress,
oPOPSettingId = d.POPSettingsId,
};
Run Code Online (Sandbox Code Playgroud) 我使用C#Switch案例如何使用继承替换.case就像1,2,3,4所以我可以如何实现它.
例如:
public Blocks(int code)
{
bool[,] shp1;
switch (code)
{
case 1:
this._Width = 4;
this._Height = 1;
this._Top = 0;
this._Left = 4;
shp1 = new bool[_Width, _Height];
shp1[0, 0] = true;
shp1[1, 0] = true;
shp1[2, 0] = true;
shp1[3, 0] = true;
this.Shape = shp1;
break;
case 2:
this._Width = 2;
this._Height = 2;
this._Top = 0;
this._Left = 4;
shp1 = new bool[_Width, _Height];
shp1[0, 0] = true;
shp1[0, 1] = true;
shp1[1, 0] = …
Run Code Online (Sandbox Code Playgroud)