public void SavePic() { HObject retpic = engine.GetGlobalIconicVarObject("Image"); SaveFileDialog sfd = new SaveFileDialog(); string di = new DirectoryInfo(string.Format("{0}../../../../", Application.StartupPath)).FullName; string aa = di + "SavePic"; if (!Directory.Exists(aa)) { Directory.CreateDirectory(aa); } sfd.InitialDirectory = aa; //设置初始路径 sfd.Filter = "BMP文件(*.bmp)|*.bmp|JPG文件(*.jpg)|*.jpg|TTIF文件(*.tif)|*.tif|所有文件(*.*)|*.*"; //设置“另存为文件类型”或“文件类型”框中出现的选择内容 sfd.FilterIndex = 0; //设置默认显示文件类型 sfd.Title = "保存图片"; //获取或设置文件对话框标题 sfd.RestoreDirectory = true; //设置对话框是否记忆上次打开的目录 sfd.AddExtension = true; sfd.OverwritePrompt = true; //sfd.FileName = ""; sfd.CheckPathExists = true; if (sfd.ShowDialog() == DialogResult.OK) { string localFilePath = sfd.FileName.ToString(); //获得文件路径 HOperatorSet.WriteImage(retpic, "bmp", 0, localFilePath); } }
public void GetContempPic() { Image = engine.GetGlobalIconicVarObject("ContempPic"); }