|
本帖最后由 AS850629754 于 2019-11-7 15:06 编辑
里边坑太多,做了一个小时才做出来
- Private Sub CommandButton1_Click()
- Dim MySlideIndex As Integer
- Dim MySlide As Slide
- Dim MaxWidth, MaxHeight As Integer
- Dim PA, PB As Shape
- Dim PAX, PAY, PBX, PBY As Integer
- MySlideIndex = SlideShowWindows(1).View.Slide.SlideIndex
- Set MySlide = ActivePresentation.Slides(MySlideIndex)
- MaxWidth = ActivePresentation.PageSetup.SlideWidth
- MaxHeight = ActivePresentation.PageSetup.SlideHeight
- PAX = Int((MaxWidth * Rnd) + 1)
- PAY = Int((MaxHeight * Rnd) + 1)
- PBX = Int((MaxWidth * Rnd) + 1)
- PBY = Int((MaxHeight * Rnd) + 1)
- Label3.Caption = PAX
- Label7.Caption = PAY
- Label4.Caption = PBX
- Label8.Caption = PBY
- Set PA = MySlide.Shapes.AddShape(msoShapeOval, PAX, PAY, 2, 2)
- Set PB = MySlide.Shapes.AddShape(msoShapeOval, PBX, PBY, 2, 2)
- End Sub
- Private Sub CommandButton2_Click()
- Dim MySlideIndex As Integer
- Dim MySlide As Slide
- Dim MyLine As Shape
- Dim X1, Y1, X2, Y2 As Integer
- MySlideIndex = SlideShowWindows(1).View.Slide.SlideIndex
- Set MySlide = ActivePresentation.Slides(MySlideIndex)
- X1 = Label3.Caption
- Y1 = Label7.Caption
- X2 = Label4.Caption
- Y2 = Label8.Caption
- Set MyLine = MySlide.Shapes.AddLine(X1, Y1, X2, Y2)
- MyLine.Line.DashStyle = msoLineSysDash
- End Sub
- Private Sub CommandButton3_Click()
- Dim MySlideIndex As Integer
- Dim MySlide As Slide
- MySlideIndex = SlideShowWindows(1).View.Slide.SlideIndex
- Set MySlide = ActivePresentation.Slides(MySlideIndex)
- Label3.Caption = ""
- Label7.Caption = ""
- Label4.Caption = ""
- Label8.Caption = ""
- For i = MySlide.Shapes.Count To 1 Step -1
- If MySlide.Shapes(i).Type = 1 Or MySlide.Shapes(i).Type = 9 Then MySlide.Shapes(i).Delete
- Next i
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|