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

ASP.NET
aspnet_regsql不能在sql2005下使用的解决
.NET发送邮件
让.Net验证控件与自定义验证合作无间
给.Net程序员和WEB程序员建议:.Net篇
给.Net程序员和WEB程序员建议:WEB篇
Server Application Unavailable错误解决方法
ASP.NET AJAX:UpdatePanel控件
ASP.NET教程:Ref和Out关键字异同
组件Newtonsoft.Json实现object2json转换
ASP.NET教程:Control基类清理页面状态
ASP.NET入门教程:认识ASP.NET
ASP.NET入门教程:ASP.NET和ASP区别
ASP.NET入门教程:简单的ASP.NET页面
ASP.NET入门教程:服务器控件
ASP.NET入门教程:事件句柄
ASP.NET入门教程:Web表单
ASP.NET入门教程:Web表单维持对象的ViewState
ASP.NET入门教程:TextBox控件
ASP.NET入门教程:Button控件
ASP.NET入门教程:数据绑定

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 134 ::
收藏到网摘: 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),然后通过程序动态创建其它按钮。