| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 608 人关注过本帖
标题:计数器用图像显示问题
只看楼主 加入收藏
tel1982
Rank: 3Rank: 3
来 自:水星
等 级:新手上路
威 望:8
帖 子:852
专家分:0
注 册:2006-10-21
收藏
 问题点数:0 回复次数:6 
计数器用图像显示问题

'定义一个新的图像控件
Dim thePic1 As New Image
thePic1.Width = "13" '设置图像控件的宽度
thePic1.Height = "21" '设置图像控件的高度
'设置显示图像的路径
thePic1.ImageUrl = "pic/" & Trim(str1) & ".gif"
'在容器控件PlaceHolder中添加图像控件
PlaceHolder1.Controls.Add(thePic1)
上面一段红色代码 当定义一个新的图像控件时Image类后面应该有括号,但是总是不显示请给为指点一下。
所有源代码如下:
If Not IsPostBack Then
Dim StrTxt As String
Dim StrPath As String
Dim IntCount As Integer
Dim i, j, theLen As Integer
Dim str1 As String
'获取存储计数器的值得文件路径
StrPath = Server.MapPath("Count.txt")
'读取此前计数
StrTxt = Trim(ReadText(StrPath))
'计算当前计数
If Trim(StrTxt) = "" Or Not IsNumeric(Trim(StrTxt)) Then
IntCount = 1
Else
IntCount = Convert.ToInt32(Trim(StrTxt)) + 1
'更新存储文件
WriteText(StrPath, Convert.ToString(IntCount))
theLen = Len(Trim(IntCount))
'循环计数值得每一位,将其用图像来代替显示
For i = 1 To theLen
str1 = Mid(Trim(IntCount), i, 1)
'定义一个新的图像控件
Dim thePic1 As New Image
thePic1.Width = "13" '设置图像控件的宽度
thePic1.Height = "21" '设置图像控件的高度
'设置显示图像的路径
thePic1.ImageUrl = "pic/" & Trim(str1) & ".gif"
'在容器控件PlaceHolder中添加图像控件
PlaceHolder1.Controls.Add(thePic1)
Next
End If
End If
'在此处放置初始化页的用户代码
End Sub
'读取文本信息
Sub WriteText(ByVal PathStr As String, ByVal TextStr As String)
Dim WriteStream As StreamWriter = New StreamWriter(PathStr)
WriteStream.WriteLine(TextStr)
WriteStream.Close()
End Sub
'写入文本信息
Function ReadText(ByVal PathStr As String) As String
Dim ReadStream As StreamReader
If File.Exists(PathStr) Then
ReadStream = File.OpenText(PathStr)
ReadText = ReadStream.ReadLine()
ReadStream.Close()
Else
ReadText = ""
End If
End Function

搜索更多相关主题的帖子: 图像 器用 计数 
2007-03-31 08:51
tel1982
Rank: 3Rank: 3
来 自:水星
等 级:新手上路
威 望:8
帖 子:852
专家分:0
注 册:2006-10-21
收藏
得分:0 
是不是没有人懂这个问题呀?

Face up to life with smiles no matter what happens
2007-03-31 10:17
卡洛
Rank: 2
等 级:论坛游民
威 望:2
帖 子:185
专家分:40
注 册:2007-3-23
收藏
得分:0 
是VB的。懒的看。头疼``

2007-03-31 10:20
tel1982
Rank: 3Rank: 3
来 自:水星
等 级:新手上路
威 望:8
帖 子:852
专家分:0
注 册:2006-10-21
收藏
得分:0 

请有能力者帮助解决,先谢谢了。


Face up to life with smiles no matter what happens
2007-03-31 10:39
tuablove
Rank: 1
等 级:新手上路
帖 子:78
专家分:0
注 册:2005-7-11
收藏
得分:0 
主要你这是vb的,看不明白

〖石器时代〗来到现代,不好混啊.... @==)(=======> 为生存而拼搏
2007-03-31 12:03
tel1982
Rank: 3Rank: 3
来 自:水星
等 级:新手上路
威 望:8
帖 子:852
专家分:0
注 册:2006-10-21
收藏
得分:0 

不管怎么说
只要你们能来看一下
说明你们想要帮助我
我还是谢谢你们


Face up to life with smiles no matter what happens
2007-03-31 23:04
tel1982
Rank: 3Rank: 3
来 自:水星
等 级:新手上路
威 望:8
帖 子:852
专家分:0
注 册:2006-10-21
收藏
得分:0 

我恳请有能力之士帮帮我,感激不尽。


Face up to life with smiles no matter what happens
2007-03-31 23:05
快速回复:计数器用图像显示问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019161 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved