[英]c#: Access a file image when a combobox index is selected
I have to access photos from a file whenever I select a Combobox Index. 每当选择组合框索引时,我都必须访问文件中的照片。 the photo and information related to it needs to be displayed on the form.
照片和与之相关的信息需要显示在表单上。 I am unsure how to access the file photo using a pathname.
我不确定如何使用路径名访问文件照片。
Below I have a portion of my code. 下面有一部分代码。 The combobox contains city names.
组合框包含城市名称。
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();
}
}
I assume your question is How to access the file photo using a pathname . 我假设您的问题是如何使用路径名访问文件照片 。
The answer is 答案是
string Pathname; //Whatever pathname.
Bitmap bmp = new Bitmap(Pathname);
Bang! 砰! Voila!
瞧! Good luck!!!
祝好运!!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.