//加载 private void PictureForm_Load(object sender, EventArgs e) { string imageFileName = PictureName + "img.jpg"; FileStream fs; try { fs = new FileStream(imageFileName, FileMode.Open, FileAccess.Read); int byteLength = (int)fs.Length; byte[] fileBytes = new byte[byteLength]; fs.Read(fileBytes, 0, byteLength); //文件流关閉,文件解除锁定 fs.Close(); pictureBox1.Image = Image.FromStream(new MemoryStream(fileBytes)); } catch (Exception) { } ucLabel1.UcText = "经度: "; ucLabel2.UcText = "纬度: "; ucLabel5.UcText = "海拔: "; ucLabel3.UcText = "测线名称: " + PictureName; Task.Run(new Action(async() => { ucLabel4.UcText = "地点: " + await getInfoSite(PictureName); PointNum = await getPointCount(PictureName); string sql = "select gears from info where name = '" + PictureName + "'"; DataTable dt = SQLiteHelper.ExecuteDataTable(sql, null); if (dt.Rows.Count == 0) { return; } string gears = dt.Rows[0].ItemArray[0].ToString(); if (gears.Contains("wt")) { gears = gears.Split(new char[] { 'w', 't', 'a' })[2]; } else if (gears.Contains("g")) { gears = gears.Split(new char[] { 'g', 'p' })[1]; } Rate = Percentage.GetPerc(PictureName, PointNum, gears); Origin = (1 - Rate) * pictureBox1.Height; })); Task.Run(new Action(async() => { ucLabel6.UcText = "点距: " + await getDistance(PictureName) + "米"; })); }