void searchAlertInfo()
{
searchAlertTable.Rows.Clear();
DataTable tempTable = AlertConsoleBiz.SearchAlertInfo(maxSearchAlertNum, this.ddtpStartTime.Value, this.ddtpEndTime.Value, searchDspID).Tables[0];
DataRow dr = null;
Image imgSnap1 = null;
Image imgSnap2 = null;
MemoryStream ms1 = null;
MemoryStream ms2 = null;
int alertCount = 0;
if (tempTable.Rows.Count >= this.maxSearchAlertNum)
{
alertCount = maxSearchAlertNum;
}
else
{
alertCount = tempTable.Rows.Count;
}
Invoke(SetTspMaxDelegate, new object[] { alertCount });
for (int i = 0; i < alertCount; i++)
{
Invoke(TspPerformStepDelegate,null);
try
{
ms1 = new MemoryStream((byte[])dr[7]);
imgSnap1 = Image.FromStream(ms1);
ms2 = new MemoryStream((byte[])dr[8]);
imgSnap2 = Image.FromStream(ms2);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
byte[] image1 = (byte[])dr[7];
byte[] image2 = (byte[])dr[8];
//给图片添加规则信息,画线,画图
//画DSP端传过来的矩形
Invoke(bindDataSourceDelegate, new object[] { dgvSearchAlert, searchAlertTable });
Invoke(TspPerformStepDelegate, null);
Invoke(ResizeDataGridViewDelegate, new object[] { dgvSearchAlert, i });
}//end of for loop
ms1.Close();
ms2.Close();
Invoke(FinishSearchDelegate,alertCount);
}
以上是我的查询代码,当分辨率为:1024*768时就好使,没问题,如果分辨率该为1028*768时候,查询就出现死机,就是在查询显示图片时死了,请高手指教
{
searchAlertTable.Rows.Clear();
DataTable tempTable = AlertConsoleBiz.SearchAlertInfo(maxSearchAlertNum, this.ddtpStartTime.Value, this.ddtpEndTime.Value, searchDspID).Tables[0];
DataRow dr = null;
Image imgSnap1 = null;
Image imgSnap2 = null;
MemoryStream ms1 = null;
MemoryStream ms2 = null;
int alertCount = 0;
if (tempTable.Rows.Count >= this.maxSearchAlertNum)
{
alertCount = maxSearchAlertNum;
}
else
{
alertCount = tempTable.Rows.Count;
}
Invoke(SetTspMaxDelegate, new object[] { alertCount });
for (int i = 0; i < alertCount; i++)
{
Invoke(TspPerformStepDelegate,null);
try
{
ms1 = new MemoryStream((byte[])dr[7]);
imgSnap1 = Image.FromStream(ms1);
ms2 = new MemoryStream((byte[])dr[8]);
imgSnap2 = Image.FromStream(ms2);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
byte[] image1 = (byte[])dr[7];
byte[] image2 = (byte[])dr[8];
//给图片添加规则信息,画线,画图
//画DSP端传过来的矩形
Invoke(bindDataSourceDelegate, new object[] { dgvSearchAlert, searchAlertTable });
Invoke(TspPerformStepDelegate, null);
Invoke(ResizeDataGridViewDelegate, new object[] { dgvSearchAlert, i });
}//end of for loop
ms1.Close();
ms2.Close();
Invoke(FinishSearchDelegate,alertCount);
}
以上是我的查询代码,当分辨率为:1024*768时就好使,没问题,如果分辨率该为1028*768时候,查询就出现死机,就是在查询显示图片时死了,请高手指教
解决方案 »
- 想要一个上传图片的源码
- 读取usb接口扫描到的数据
- C#中GDI+画矩形时候右面和下面的边不显示呢
- winfrom 如何在程序运行时,可以让用户调整窗体上控件的大小?
- Windows应用程序中如何显示Oracle数据库Blob类型的图片?
- 散分题:如何在vs2005中实现随意放置控件
- 争求下意见,一般在一个WEB窗体里,数据库连接对象大家是在初始化时建立一个连接对象,还是在相应的函数里再新建.
- 我的vs.net为什么不能打开c#工程啊!!!!!!!!!!
- 数组的长度问题
- 关于数据集合并的问题
- SqlParameterCollection 与 SqlParameter区别
- 继承容器控件,但是又不想在设计器中可以拖放其他控件进去
就是 这行代码:///调用调整datagridview大小的函数
void ResizeDataGridViewFunction(DataGridView dgv,int rowIndex)
{
try
{
//此处问题
dgv.AutoResizeRow(rowIndex);(到此处就死)
dgv.FirstDisplayedScrollingRowIndex = rowIndex;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
如果查询5条记录(即alertCount=5)时,当运行到i=3时候就出现死锁。