sách gpt4 ăn đã đi

c# - 系统.UriFormatException

In lại Tác giả: Walker 123 更新时间:2023-11-30 17:39:09 28 4
mua khóa gpt4 giày nike

我在 c# System.URI.FormatExption 中遇到问题

为了清楚起见,我使用的是 Segseuil 的 Matlab 方法,并且它返回一个图片路径 kết quả。我想为其他用户保存此图像,但出现异常。

private void segmenter(object sender, RoutedEventArgs e) {
s.SegSeuil(0, (MWCharArray)name, (MWCharArray)result);
BitmapImage tmp = new BitmapImage(new Uri(result)); // exception here
image.Source = tmp;

}

câu trả lời hay nhất

nếu nhưkết quả是相对路径,例如image.jpg你必须使用UriKind.Relative:

BitmapImage tmp = new BitmapImage(new Uri(result, UriKind.Relative));

hoặcRelativeOrAbsolute:

BitmapImage tmp = new BitmapImage(new Uri(result, UriKind.RelativeOrAbsolute));

确保结果文件存在于您的 .exe 文件中或包含您的 exe 文件的文件夹中。


nếu nhưkết quả是绝对路径,例如: D:\image.jpg可以使用:

BitmapImage tmp = new BitmapImage(new Uri(result));

或:

BitmapImage tmp = new BitmapImage(new Uri(result, UriKind.Absolute));

或:

BitmapImage tmp = new BitmapImage(new Uri(result, UriKind.RelativeOrAbsolute));

关于c# - 系统.UriFormatException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35811743/

28 4 0
Walker 123
Hồ sơ

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá taxi Didi miễn phí
Phiếu giảm giá taxi Didi
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress