1、打开QT CREATOR,来到并来到设计师designer的编辑界面。
2、在button一栏中,找到push button。
3、拖动到设计界面上面去
4、在属性中,拉到下面,找到styleSheet点击旁边的省略号。
5、看到编辑样式表。
6、点击添加资源旁边的小三角,选择border-image。
7、选择图片资源,确定。
8、回到样式编辑表,再确定,按钮的背景就变了。
新建一个按键或是新建宏,代码如下:
Private Sub CommandButton1_Click()Dim rng As Range
Dim s As String
On Error Resume Next
For Each Shp In ActiveSheet.Shapes
Set rng = Shp.TopLeftCell
If rng.Column = 3 Then
If Shp.Type = msoPicture Then Shp.Delete
End If
Next
For i = 2 To 20
If Cells(i, 2).MergeCells = True Then
h = Cells(i, 2).MergeArea.Rows.Count
Else
h = 1
End If
If Cells(i, 2).MergeArea.Row = i Then
s = ThisWorkbook.Path & "\" & Cells(i, 2).Value & ".jpg"
If Dir(s) <> "" Then
Set rng = Range("c" & i & ":C" & i + h - 1)
rng.Select
Dim MyFile As Object
Set MyFile = CreateObject("Scripting.FileSystemObject")
If MyFile.FileExists(s) = False Then
MsgBox s & "图片不存在"
Else
'在选定的单元格中插入图片
With Sheets(1).Pictures.Insert(s)
.ShapeRange.LockAspectRatio = msoFalse
.Placement = xlMoveAndSize
.ShapeRange.Left = rng.Left
.ShapeRange.Top = rng.Top
.ShapeRange.Height = rng.Height
.ShapeRange.Width = rng.Width
End With
End If
End If
End If
Next
End Sub
中午回答时违规了,有疑问:叁陆要是零八玖救陆。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)