C#如何在 运行时生成的PictureBox中 显示图标文件(.ico) 快被搞死了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
各位路过的兄弟 请帮帮忙!!

解决方案 »

  1.   

    要再加一個頁面
    private void Page_Load(object sender, System.EventArgs e)
    {
    string aquaNo = Request["aquaNo"];
    try
    {
    //得到數據庫中是否有資料,如果數據庫無資料,直接退出該過程,否則讀取圖片
    L3_PIC_UPLOADLogic logic = new L3_PIC_UPLOADLogic();
    DataTable dt = logic.SelectPictureData(aquaNo);

    if (dt.Rows.Count <= 0) return;
    if (dt.Rows[0]["PIC"] == DBNull.Value) return;

    //讀取圖片資料
    byte[] picData = (byte[])(dt.Rows[0]["PIC"]);
    Response.BinaryWrite(picData);
    }
    catch (Exception ex)
    {
    throw ex;
    }
    }然後在主頁面下:private void QueryPictureData(string aquaNo, bool checkNullPic)
    {
    try
    {
    if (checkNullPic)
    {
    //得到數據庫中是否有資料,如果數據庫無資料,直接退出該過程,否則讀取圖片
    DataTable dt = new DataTable();
    dt = logic.SelectPictureData(aquaNo); if (dt.Rows.Count <= 0 ||dt.Rows[0]["PIC"] == DBNull.Value)
    {
    this.imgPerson.ImageUrl = "";
    return;
    }
    } //讀取圖片資料
    string url =  "L3_PIC_UPLOADPicture.aspx?aquaNo=" + aquaNo;
    this.imgPerson.ImageUrl = url;
    }
    catch (Exception ex)
    {
    throw ex;
    }
    }差不多是這樣子