如何使用垂直滚动条显示图像 [英] how to dsplay images using verticle scroll bar
本文介绍了如何使用垂直滚动条显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的所有
使用此代码,如果我拖动滚动条,图像会显示到结尾,但会卡在结尾
请帮帮我
nitin
dear all
using this code , if i drag scroll bar images appear till end , but it get stuck at end
please help me out
nitin
private void vScrollBar1_ValueChanged(object sender, EventArgs e)
{
if (icount < objclsvrb.objds.Tables[0].Rows.Count)
{
if (icount == 0)
{
axDicomViewer1.Images.ReadFile("D:/FilmPlus_MSAccess/bin/Debug/Images/" + objclsvrb.objds.Tables[0].Rows[icount][0].ToString() + ".dcm");
icount++;
}
else
{
axDicomViewer1.Images.ReadFile("D:/FilmPlus_MSAccess/bin/Debug/Images/" + objclsvrb.objds.Tables[0].Rows[icount][0].ToString() + ".dcm");
icount++;
}
}
else
{
MessageBox.Show("not found");
vScrollBar1.Value = 0;
}
}
推荐答案
在滚动向后移动时,条件尚未减少"icount"
为此,请声明页面级变量&保持滚动条的previousValue.
如果currentvalue小于先前的值,则将其与current-value进行比较,然后
icount-
的代码 祝您编码愉快!
:)
you haven''t decremented ''icount'' for condition when scroll move reverse
for that declare a page-level variable & maintain previousValue of scrollbar.
compare it with current-value if currentvalue is less than previous then
code for icount--
Happy Coding!
:)
我进行的一些更改
int icount = 1;
some changes I made
int icount=1;
private void vScrollBar1_ValueChanged(object sender, EventArgs e)
{
sbvalue = vScrollBar1.Value;
vScrollBar1.Maximum = num ;
if (icount < objclsvrb.objds.Tables[0].Rows.Count) //
{
if (icount == 0)
{
axDicomViewer1.Images.ReadFile("D:/FilmPlus_MSAccess/bin/Debug/Images/" + objclsvrb.objds.Tables[0].Rows[icount][0].ToString() + ".dcm");
icount++;
}
else
{
axDicomViewer1.Images.ReadFile("D:/FilmPlus_MSAccess/bin/Debug/Images/" + objclsvrb.objds.Tables[0].Rows[icount][0].ToString() + ".dcm");
icount++;
}
}
else
{
//MessageBox.Show("not found");
icount = 0;
vScrollBar1.Value = 1;
}
}
这篇关于如何使用垂直滚动条显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文