【问题标题】:Retrieving images from ssms Database using relative path and showing image in picture box in C# visual studio 2012?使用相对路径从 ssms 数据库中检索图像并在 C# Visual Studio 2012 的图片框中显示图像?
【发布时间】:2013-07-25 13:47:41
【问题描述】:

我正在 C# Visual Studio 中制作一个 win-forms 程序。我有存储在数据库中的所有图像的相对路径。我想要做的是,当从组合框中选择一个项目时,执行一个存储的过程,它返回数据表并将所有内容放在相关的文本框中。

但是,一列是 .JPEG 图像的相对路径。我需要获取相对路径并以某种方式对其进行转换,以便程序获取实际图像并将其显示在 PictureBox 中。

private void cmbEOselect_SelectionChangeCommitted(object sender, EventArgs e)
{
    DataTable SO = new DataTable();

    txtbEOname.Text = (String)SO.Rows[cmbEOselect.SelectedIndex]["Name"];

    String folder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) 
    + @"\........\.jpeg      pBoxOils.Load(folder);
    txtbEObottn = (String)SO.Rows[cmbEOselect.SelectedIndex]["BottanicalName"];
    txtbEOext.Text = (String)SO.Rows[cmbEOselect.SelectedIndex]["Extraction"];

}

【问题讨论】:

    标签: c# image visual-studio relative-path


    【解决方案1】:
    txtbEOname.Text = (String)PEO.Rows[cmbEOselect.SelectedIndex]["Name"];
                String folder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) +   @"" + PEO.Rows[cmbEOselect.SelectedIndex]["IMAGE"];
                pBoxOils.Load(folder);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-03-05
      • 1970-01-01
      • 2014-02-28
      • 2018-11-08
      • 1970-01-01
      • 2015-11-23
      • 2018-10-27
      相关资源
      最近更新 更多