Assembly assembly = GetType().GetTypeInfo().Assembly;
string resource = "BlackCat.Texts.TheBlackCat.txt";
using (Stream stream = assembly.GetManifestResourceStream (resource))
{
using (StreamReader reader = new StreamReader (stream))
{
bool gotTitle = false;
string line;
// Read in a line (which is actually a paragraph).
while (null != (line = reader.ReadLine()))
{
Label label = new Label
{
Text = line,
// Black text for ebooks!
TextColor = Color.Black
};
if (!gotTitle)
{
// Add first label (the title) to mainStack.
label.HorizontalOptions = LayoutOptions.Center;
label.FontSize = Device.GetNamedSize(NamedSize.Medium, label);
label.FontAttributes = FontAttributes.Bold;
mainStack.Children.Add(label);
gotTitle = true;
}
else
{
// Add subsequent labels to textStack.
textStack.Children.Add(label);
}
}
}
}
文件
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 有个需求,即想表达一个目录结构,但又不想截图用图片的方式。有些同学可能在一些技术博客中看到这样的表达: blog├...
- 如果遇到类似于Unable to run command 'StripNIB XLsn0wPickerView.n...
- Linux下查看当前目录下文件的个数ls -l | grep “^-” | wc -l 查看当前目录下文件的个数,...