0
我有一個圖像。我在我創建的圖像查看器中打開它。現在我想編輯這個圖像。所以我打開這個圖像的油漆,當我點擊保存按鈕後,改變它給我。訪問時發生共享衝突的一些錯誤。使用塗料訪問時發生共享違規
我在畫圖中打開圖像之前從圖像查看器中刪除文件名。
這裏是我的代碼..
private void btnEditImage_Click(object sender, RoutedEventArgs e)
{
if (File.Exists(Helper.DefaultPath + listImages[count].Path))
{
SetNullImage();
string editPath = Helper.DefaultPath + listImages[count].Path;
if (File.Exists(editPath))
{
Process my = new Process();
my.StartInfo.FileName = "mspaint.exe";
my.StartInfo.Arguments = "\"" + editPath + "\"";
my.StartInfo.CreateNoWindow = true;
my.EnableRaisingEvents = true;
my.Exited += new EventHandler(myProcess_Exited);
my.Start();
}
}
}
private void myProcess_Exited(object sender, System.EventArgs e)
{
Dispatcher.Invoke(new Action(() =>
{
SetImage();
}));
}
看到的影像
感謝...
您是否嘗試使用您正在使用的圖像保存該文件的副本?對我來說,聽起來像油漆不能保存你的文件,因爲它是寫保護或文件仍在使用中(可能是你的程序流?) – Mat
你會給任何其他建議。我必須在同一個文件上工作。或者如果您有任何示例,請分享它。 –
我剛剛做出了一個有根據的猜測。你也不提供[mcve]。另請參閱[問]。無論如何:你得到這個錯誤,因爲該文件正在使用中,或者你沒有寫權限。 – Mat