我正在使用名为DDay ICal的类库.它是在Outlook日历中实现的iCalendar系统的C#包装器,以及许多更多系统.我的问题来源于我在使用这个系统时所做的一些工作.
这里有3个问题
IRecurrencePattern:并非显示所有代码
public interface IRecurrencePattern
{
string Data { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
RecurrencePattern:并非显示所有代码
public class RecurrencePattern : IRecurrencePattern
{
public string Data { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
DbRecurPatt:并非显示所有代码
public class DbRecurPatt
{
public string Name { get; set; }
public string Description { get; set; }
public static implicit operator RecurrencePattern(DbRecurPatt obj)
{
return new RecurrencePattern() { Data = $"{Name} - {Description}" };
}
}
Run Code Online (Sandbox Code Playgroud)
令人困惑的部分:通过DDay.ICal系统,他们使用ILists来包含日历中每个事件的重复模式集合,自定义类用于从数据库中获取信息,然后通过它转换为重复模式.隐式类型转换运算符. …
我试图在Image上写入某些字节,例如:
"་.༉ᵒᵗᵗ͟ᵋ͟͟͟͟͟͟͟͟͟͟͟͟͟͟͟͟͟͟͟͟͟"
当我在图像上显示它但我得到以下代替...
图片:

我已经尝试更改字符串的编码类型,当我收到字节并且没有设置字体但我尝试了所有默认的Microsoft字体以及我在Internet上找到的一些自定义字体.我究竟做错了什么?
编辑:原来正在使用Graphics.DrawString.我试过TextRenderer了,结果几乎相同.
图片:

这是我用来生成图像的代码:
string text = "[rotten4pple] ????????? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?. . .";
var font = new Font("Arial", 8, FontStyle.Regular);
var bitmap = new Bitmap(1, 1);
var size = Graphics.FromImage(bitmap).MeasureString(text, font);
bitmap = new Bitmap((int)size.Width + 4, (int)size.Height + 4);
using (var gfx = Graphics.FromImage(bitmap))
{
gfx.Clear(Color.White);
TextRenderer.DrawText(gfx, cmd.AllArguments, font, new Point(2, …Run Code Online (Sandbox Code Playgroud)