当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 一个图形分割问题[答网友]

ASP.NET
ASP.NET入门教程:ArrayList对象
ASP.NET入门教程:Hashtable对象
ASP.NET入门教程:SortedList对象
ASP.NET入门教程:把XML文件绑定到列表控件
ASP.NET入门教程:Repeater控件
ASP.NET入门教程:DataList控件
ASP.NET入门教程:数据库连接
ASP.NET入门教程:ASP.NET 2.0新特性
ASP.NET入门教程:ASP.NET 2.0母版页
ASP.NET入门教程:ASP.NET 2.0导航
ASP.NET入门教程:HTML服务器控件
ASP.NET入门教程:Web服务器控件
ASP.NET入门教程:Validation服务器控件
HTML服务器控件介绍:HtmlAnchor控件
HTML服务器控件介绍:HtmlButton控件
HTML服务器控件介绍:HtmlForm控件
HTML服务器控件介绍:HtmlGeneric控件
HTML服务器控件介绍:HtmlImage控件
HTML服务器控件介绍:HtmlInputButton控件
HTML服务器控件介绍:HtmlInputCheckBox控件

ASP.NET 中的 一个图形分割问题[答网友]


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 150 ::
收藏到网摘: n/a


新建工程,点“工程”->“部件”,在列表中找到并勾选“Microsoft PictureClip Control 6.0”将其添加到工具箱。
在窗体中添加一个PictureClip控件,设置它的Picture属性装载一副图像,设置PictureClip控件的Col属性为3(3列),Row属性为3(3行)。
然后添加一个CommandButton控件Command1,设置其Style为1(图形按钮),再复制8个Command1,提示是否创建控件数组时点“是”,再添加一个CommandButton控件Command2,将Caption属性设为“转换”如下图:在窗体中添加以下代码:Option Explicit
Private Sub Command2_Click()Dim i As Integer, j As Integer For i = 0 To 8 Command1(i).Caption = "" '去掉文字 Command1(i).Picture = PictureClip1.GraphicCell(i) Command1(i).Width = PictureClip1.CellWidth * 15 Command1(i).Height = PictureClip1.CellHeight * 15 If i Mod 3 = 0 Then j = j + 1 End If If i Mod 3 <> 0 Then Command1(i).Move Command1(i - 1).Left + Command1(i - 1).Width, Command1(0).Top + (j - 1) * Command1(0).Height Else If i <> 0 Then Command1(i).Move Command1(0).Left, Command1(i - 1).Top + Command1(i - 1).Height End If End If NextEnd Sub

运行:点击“转换”实际应用中可能将图片分成的块数不一定,所以按钮可以只创建一个(index设为0),然后通过程序动态创建其它按钮。