Lm th? no ? s? d?ng t? ?ng ha ? t?o ra v cho th?y m?t PowerPoint tr?nh by b?ng cch s? d?ng Visual Basic.NET 2002 ho?c Visual Basic.NET 2003

D?ch tiu ? D?ch tiu ?
ID c?a bi: 303717 - Xem s?n ph?m m bi ny p d?ng vo.
?i v?i m?t Microsoft Visual C#.NET Phin b?n ny vi?t, xem 303718.
?i v?i m?t Microsoft Visual C++.NET Phin b?n ny vi?t, xem 308336.
Bung t?t c? | Thu g?n t?t c?

? Trang ny

TM T?T

Bi vi?t ny m t? cch s? d?ng t? ?ng ha ? t?o v ? hi?n th? m?t b?n tr?nh by Microsoft PowerPoint b?ng cch s? d?ng Microsoft Visual Basic.NET 2002 ho?c Visual Basic.NET 2003.

THNG TIN THM

T?o ra m?t khch hng t? ?ng ha cho Microsoft PowerPoint

  1. B?t ?u Microsoft Visual Studio.NET 2002 ho?c Visual Studio .NET 2003. Trn cc Tp tr?nh n, nh?p vo M?i sau b?m D an. Ch?n ?ng d?ng Windows t? cc lo?i d? n Visual Basic. Form1 ?c t?o ra b?ng m?c ?nh.
  2. Thm m?t tham chi?u ?n cc Microsoft PowerPoint ?i t?ng th vi?n v cc ? th? Microsoft ?i t?ng th vi?n. thc hin vic nay, hay lam theo nhng bc sau:
    1. Trn cc D an tr?nh n, nh?p vo Thm Tham kh?o.
    2. Trn cc COM tab, xc ?nh v? tr cc Microsoft PowerPoint ?i t?ng th vi?n, sau b?m Ch?n. C?ng xc ?nh v? tr cc ? th? Microsoft ?i t?ng Th vi?n, sau b?m Ch?n.

      Chu y: Microsoft Office 2003 v phin b?n m?i nh?t c?a Microsoft Office bao g?m chnh h?i ?ng Interop khc nhau (PIAs). Microsoft Office XP khng bao g?m PIAs, nhng h? c th? t?i xu?ng.

      ? bi?t thm thng tin v? Office XP PIAs, nh?p vo s? bi vi?t sau y ? xem bi vi?t trong c s? ki?n th?c Microsoft:
      328912Microsoft Office XP PIAs c s?n ? t?i v?
    3. Nh?p vo Ok trong cc Thm Tham khao h?p tho?i ? ch?p nh?n c?a b?n l?a ch?n.
  3. Trn cc Xem tr?nh n, ch?nH?p cng c? hi?n th? h?p cng c? v thm m?t nt ? Form1.
  4. B?m p Button1. C?a s? m? cho cc h?nh th?c xu?t hi?n.
  5. Trong c?a s? m?, xc ?nh v? tr m? sau
        Private Sub Button1_Click(ByVal sender As System.Object, _
            ByVal e As System.EventArgs) Handles Button1.Click
    
        End Sub
    					
    Thay th? v?i o?n m? sau:
        Private Sub Button1_Click(ByVal sender As System.Object, _
            ByVal e As System.EventArgs) Handles Button1.Click
    
            Const sTemplate = _
               "C:\Program Files\Microsoft Office\Templates\Presentation Designs\Blends.pot"
            Const sPic = "C:\WINNT\Soap Bubbles.bmp"
    
            Dim oApp As PowerPoint.Application
            Dim oPres As PowerPoint.Presentation
            Dim oSlide As PowerPoint.Slide
            Dim bAssistantOn As Boolean
    
            'Start Powerpoint and make its window visible but minimized.
            oApp = New PowerPoint.Application()
            oApp.Visible = True
            oApp.WindowState = PowerPoint.PpWindowState.ppWindowMinimized
    
            'Create a new presentation based on the specified template.
            oPres = oApp.Presentations.Open(sTemplate, , , True)
    
            'Build Slide #1:
            'Add text to the slide, change the font and insert/position a 
            'picture on the first slide.
            oSlide = oPres.Slides.Add(1, PowerPoint.PpSlideLayout.ppLayoutTitleOnly)
            With oSlide.Shapes.Item(1).TextFrame.TextRange
                .Text = "My Sample Presentation"
                .Font.Name = "Comic Sans MS"
                .Font.Size = 48
            End With
            oSlide.Shapes.AddPicture(sPic, False, True, 150, 150, 500, 350)
            oSlide = Nothing
    
            'Build Slide #2:
            'Add text to the slide title, format the text. Also add a chart to the
            'slide and change the chart type to a 3D pie chart.
            oSlide = oPres.Slides.Add(2, PowerPoint.PpSlideLayout.ppLayoutTitleOnly)
            With oSlide.Shapes.Item(1).TextFrame.TextRange
                .Text = "My Chart"
                .Font.Name = "Comic Sans MS"
                .Font.Size = 48
            End With
            Dim oChart As Graph.Chart
            oChart = oSlide.Shapes.AddOLEObject(150, 150, 480, 320, _
                        "MSGraph.Chart.8").OLEFormat.Object
            oChart.ChartType = Graph.XlChartType.xl3DPie
            oChart = Nothing
            oSlide = Nothing
    
            'Build Slide #3:
            'Add a text effect to the slide and apply shadows to the text effect.
            oSlide = oPres.Slides.Add(3, PowerPoint.PpSlideLayout.ppLayoutBlank)
            oSlide.FollowMasterBackground = False
            Dim oShape As PowerPoint.Shape
            oShape = oSlide.Shapes.AddTextEffect(Office.MsoPresetTextEffect.msoTextEffect27, _
                "The End", "Impact", 96, False, False, 230, 200)
            oShape.Shadow.ForeColor.SchemeColor = PowerPoint.PpColorSchemeIndex.ppForeground
            oShape.Shadow.Visible = True
            oShape.Shadow.OffsetX = 3
            oShape.Shadow.OffsetY = 3
            oShape = Nothing
            oSlide = Nothing
    
            'Modify the slide show transition settings for all 3 slides in
            'the presentation.
            Dim SlideIdx(3) As Integer
            SlideIdx(0) = 1
            SlideIdx(1) = 2
            SlideIdx(2) = 3
            With oPres.Slides.Range(SlideIdx).SlideShowTransition
                .AdvanceOnTime = True
                .AdvanceTime = 3
                .EntryEffect = PowerPoint.PpEntryEffect.ppEffectBoxOut
            End With
            Dim oSettings As PowerPoint.SlideShowSettings
            oSettings = oPres.SlideShowSettings
            oSettings.StartingSlide = 1
            oSettings.EndingSlide = 3
    
            'Prevent Office Assistant from displaying alert messages.
            bAssistantOn = oApp.Assistant.On
            oApp.Assistant.On = False
    
            'Run the slide show and wait for the slide show to end.
            oSettings.Run()
            Do While oApp.SlideShowWindows.Count >= 1
                System.Windows.Forms.Application.DoEvents()
            Loop
            oSettings = Nothing
    
            'Reenable Office Assisant, if it was on.
            If bAssistantOn Then
                oApp.Assistant.On = True
                oApp.Assistant.Visible = False
            End If
    
            'Close the presentation without saving changes and quit PowerPoint.
            oPres.Saved = True
            oPres.Close()
            oPres = Nothing
            oApp.Quit()
            oApp = Nothing
            GC.Collect()
        End Sub
    					
    Chu y Trong m? ny, cc sTemplate v sPic h?ng s? ?i di?n cho ?ng d?n ?y ? v tn t?p ? m?t PowerPoint tiu b?n v m?t b?c tranh, tng ?ng. S?a ?i cc ?ng d?n nh c?n thi?t ? s? d?ng m?t m?u ho?c h?nh ?nh ?c ci ?t trn h? th?ng c?a b?n.
  6. Thm m? sau vo pha trn c?a Form1.vb:
    Imports Office = Microsoft.Office.Core
    Imports Graph = Microsoft.Office.Interop.Graph
    Imports PowerPoint = Microsoft.Office.Interop.PowerPoint
    					
  7. Nh?n F5 ? xy d?ng v sau ch?y chng tr?nh.
  8. Nh?p vo Button1 v? h?nh th?c ? t?o ra v sau cho th?y m?t PowerPoint tr?nh by.

THAM KH?O

? bi?t thm chi ti?t, xem cc nh pht tri?n Microsoft sau y Trang Web m?ng (MSDN):
http://msdn2.Microsoft.com/en-us/Library/aa167948 (office.11) .aspx
? bi?t thm chi ti?t v? t? ?ng ha PowerPoint, b?m vo bi vi?t sau y cc con s? ? xem cc bi vi?t trong c s? ki?n th?c Microsoft:
180616Lm th? no ? s? d?ng MFC t?o v hi?n th? m?t b?n tr?nh by PowerPoint
222929 Lm th? no ? t? ?ng ho PowerPoint s? d?ng Visual Basic

Thu?c tnh

ID c?a bi: 303717 - L?n xem xt sau cng: 06 Thang Mi 2011 - Xem xt l?i: 3.0
p d?ng
  • Microsoft Office PowerPoint 2007
  • Microsoft Office PowerPoint 2003
  • Microsoft PowerPoint 2002 Standard Edition
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft Visual Studio .NET 2002 Academic Edition
  • Microsoft Visual Studio .NET 2002 Enterprise Architect
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
  • Microsoft Visual Studio .NET 2003 Academic Edition
  • Microsoft Visual Studio .NET 2003 Enterprise Architect
  • Microsoft Visual Studio .NET 2003 Enterprise Developer
  • Microsoft Visual Studio .NET 2003 Professional Edition
T? kha:
kbexpertiseinter kbautomation kbhowto kbmt KB303717 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny:303717

Cung cp Phan hi

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com