一個圖形分割問題[答網友]

來源:互聯網
上載者:User

建立工程,點“工程”->“組件”,在列表中找到並勾選“Microsoft PictureClip Control 6.0”將其添加到工具箱。

在表單中添加一個PictureClip控制項,設定它的Picture屬性裝載一副映像,設定PictureClip控制項的Col屬性為3(3列),Row屬性為3(3行)。

然後添加一個CommandButton控制項Command1,設定其Style為1(圖形按鈕),再複製8個Command1,提示是否建立控制項數組時點“是”,再添加一個CommandButton控制項Command2,將Caption屬性設為“轉換”

如:

{
function anonymous()
{
function anonymous()
{
function anonymous()
{
function anonymous()
{
if(this.width>screen.width-500)this.style.width=screen.width-500;
}
}
}
}
}" border="0">

在表單中添加以下代碼:
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
    Next
End Sub

運行:

{
function anonymous()
{
function anonymous()
{
function anonymous()
{
function anonymous()
{
if(this.width>screen.width-500)this.style.width=screen.width-500;
}
}
}
}
}" border="0">

點擊“轉換”

{
function anonymous()
{
function anonymous()
{
function anonymous()
{
function anonymous()
{
if(this.width>screen.width-500)this.style.width=screen.width-500;
}
}
}
}
}" border="0">

實際應用中可能將圖片分成的塊數不一定,所以按鈕可以只建立一個(index設為0),然後通過程式動態建立其它按鈕。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.