带有字符串值的bitmap.save子文件夹

时间:2016-02-18 12:39:49

标签: c# winforms

我的代码

var appView = Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
appView.titleBar.backgroundColor = Windows.UI.Colors.black; // or {a: 255, r: 0, g: 0, b: 0}
appView.titleBar.inactiveBackgroundColor = Windows.UI.Colors.black;
appView.titleBar.buttonBackgroundColor = Windows.UI.Colors.black;
appView.titleBar.buttonHoverBackgroundColor = Windows.UI.Colors.black;
appView.titleBar.buttonPressedBackgroundColor = Windows.UI.Colors.black;
appView.titleBar.buttonInactiveBackgroundColor = Windows.UI.Colors.black;

获取构建错误!为什么我不能用字符串值名称创建子文件夹并插入图像?仍然无法作为名称userid插入到该crated文件夹。

2 个答案:

答案 0 :(得分:0)

是的,你可以。但您必须首先创建该文件夹,然后保存位图:

string folderName = @"C:\temper\temp\"+userid;
if (!Directory.Exists(folderName) {
    Directory.CreateDirectory(folderName);
}
bitmap.save(folderName + "\\userimage.jpg");  //your original concatenation had an error

答案 1 :(得分:0)

解决!

string folderName = @"C:\temper\temp\"+userid;
if (!Directory.Exists(folderName) {
Directory.CreateDirectory(folderName);
}
bitmap.save(folderName + "\\" +userimage+ ".jpg"); `Create first folder and save Thanks Mnieto`