Пример #1
0
 /// <summary>
 /// 删除
 /// </summary>
 private void Delete()
 {
     Try(() =>
     {
         string fn = files[index];
         var sfs   = new ShfileOpStruct
         {
             hwnd   = this.Handle,
             wFunc  = WindowsAPI.FO_DELETE,
             pFrom  = fn + "\0\0",
             pTo    = null,
             fFlags = WindowsAPI.FOF_ALLOWUNDO
         };
         int result = WindowsAPI.SHFileOperation(sfs);
         if (result != 0)
         {
             return;
         }
         files.Remove(fn);
         ShowDirection(0);
     });
 }
Пример #2
0
 /// <summary>
 /// 另存为
 /// </summary>
 private void SaveAs()
 {
     Try(() =>
     {
         var dlgSave = new SaveFileDialog
         {
             InitialDirectory = dirPath,
             Filter           = @"GIF格式图片|*.gif",
             FileName         = SimplePath(files[index])
         };
         if (dlgSave.ShowDialog() == DialogResult.OK)
         {
             var sfs = new ShfileOpStruct
             {
                 hwnd   = this.Handle,
                 wFunc  = WindowsAPI.FO_COPY,
                 pFrom  = files[index] + "\0\0",
                 pTo    = dlgSave.FileName + "\0\0",
                 fFlags = WindowsAPI.FOF_ALLOWUNDO
             };
             WindowsAPI.SHFileOperation(sfs);
         }
     });
 }
Пример #3
0
 public static extern int SHFileOperation(ShfileOpStruct str);