[英]c#: Access a file image when a combobox index is selected
每当选择组合框索引时,我都必须访问文件中的照片。 照片和与之相关的信息需要显示在表单上。 我不确定如何使用路径名访问文件照片。
下面有一部分代码。 组合框包含城市名称。
private void cmbHouseList_SelectedIndexChanged(object sender, EventArgs e)
{
if(cmbHouseList.SelectedIndex.ToString() == ofdHouse.FileName)
{
txtAddress.Text = house.Street;
txtCity.Text = house.City;
txtZip.Text = house.Postal;
txtPrice.Text = house.Price.ToString();
}
}
我假设您的问题是如何使用路径名访问文件照片 。
答案是
string Pathname; //Whatever pathname.
Bitmap bmp = new Bitmap(Pathname);
砰! 瞧! 祝好运!!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.