コード例 #1
0
        private void repositoryItemButtonEditimagepath2_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            ButtonEdit btn = (ButtonEdit)sender;
            DataRow Row = (DataRow)gridViewQry.GetFocusedDataRow();

            using (ImgViewerFrm Frm = new ImgViewerFrm())
            {
                if (File.Exists(MyCL.PicPath + btn.EditValue))
                    Frm.Img.Image = Image.FromFile(MyCL.PicPath + btn.EditValue);
                Frm.ShowDialog();
            }
        }
コード例 #2
0
 private void ImgEditimagepath2_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (e.Button.Kind == DevExpress.XtraEditors.Controls.ButtonPredefines.Ellipsis)
     {
         OpenFileDialog dlg = new OpenFileDialog() { CheckFileExists = true, Filter = "Jpg Files|*.jpg|All Files(*)|*.*", Title = "اختار صوره" };
         if (dlg.ShowDialog() == DialogResult.Cancel)
             return;
         try
         {
             Image TmpImg = Image.FromFile(dlg.FileName);
             TmpImg = null;
         }
         catch { return; }
         string NewFileName = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + dlg.SafeFileName;
         File.Copy(dlg.FileName, MyCL.PicPath + NewFileName);
         ImgEditimagepath2.Text = NewFileName;
     }
     else
     {
         using (ImgViewerFrm Frm = new ImgViewerFrm())
         {
             if (File.Exists(MyCL.PicPath + ImgEditimagepath2.Text))
                 Frm.Img.Image = Image.FromFile(MyCL.PicPath + ImgEditimagepath2.Text);
             Frm.ShowDialog();
         }
     }
 }