| 网站首页 | VB.Net实例分析 | .Net技术文摘 | 下载中心 | VB.Net书籍笔记 | .Net源码 | VBS脚本与组件调用 | Windows2008技术文摘 | 给我们留言 | 
最新公告:

  没有公告

您现在的位置: 乐博网 >> VB.Net实例分析 >> 其他 >> 实例分析正文
最新推荐 更多内容
VB.Net在PowerPoint中浏览图像文件
VB.Net在PowerPoint中浏览图像文件
作者:Ilu    来源:乐博网整理     更新时间:2009-9-25

乐博网lob.cn提示:调试环境为 vs2008 +  windows2003 / windows2008 / xp / vista

VB.Net在PowerPoint中浏览图像文件
Imports Office = Microsoft.Office.Core
Imports PowerPoint = Microsoft.Office.Interop.PowerPoint
Imports Microsoft.Office.Core
Imports System
Public Class UserControl1
    Private MyTextbox As PowerPoint.Shape
    '浏览图像文件
    Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
        Me.openFileDialog1.Filter = "所有图像文件(JPeg, Gif, Bmp, etc.)|*.jpg;*.jpeg; *.gif;*.bmp;*.tif; *.tiff; *.png| JPeg 图像文件 (*.jpg;*.jpeg)|*.jpg;*.jpeg |GIF 图像文件(*.gif)|*.gif |BMP 图像文件(*.bmp)|*.bmp|Tiff 图像文件(*.tif;*.tiff) |*.tif; *.tiff|Png 图像文件(*.png)| *.png |所有文件 (*.*)|*.*"
        If (Me.openFileDialog1.ShowDialog() = _
                        System.Windows.Forms.DialogResult.OK) Then
            Dim MyFileName As String = Me.openFileDialog1.FileName
            Dim MySlide As PowerPoint.Slide = _
                Globals.ThisAddIn.Application.ActivePresentation.Slides(1)
            Dim MyTextRng As PowerPoint.TextRange = _
                                    MySlide.Shapes(1).TextFrame.TextRange
            MySlide.Shapes.AddPicture(MyFileName, MsoTriState.msoFalse, _
                                MsoTriState.msoTrue, 55, 160, 610, 300)
        End If
    End Sub
    Private Sub monthCalendar1_DateChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles monthCalendar1.DateChanged
        Try
            If (MyTextbox IsNot Nothing) Then
                MyTextbox.Delete()
            End If
            Dim MySlide As PowerPoint.Slide = _
                    Globals.ThisAddIn.Application.ActivePresentation.Slides(1)
            MyTextbox = MySlide.Shapes.AddTextbox( _
                Office.MsoTextOrientation.msoTextOrientationHorizontal, _
                50, 100, 600, 50)
            MyTextbox.TextFrame.TextRange.Text = "出版印刷日期:" + _
                    e.Start.ToLongDateString()
            MyTextbox.TextFrame.TextRange.Font.Size = 42
            MyTextbox.TextFrame.TextRange.Font.Bold = MsoTriState.msoTrue
            MyTextbox.TextFrame.TextRange.Font.Color.RGB = _
                        System.Drawing.Color.Green.ToArgb()
        Catch ex As Exception
            System.Windows.Forms.MessageBox.Show(ex.ToString(), _
                        "乐博网信息提示", Windows.Forms.MessageBoxButtons.OK, _
                        Windows.Forms.MessageBoxIcon.Error)
        End Try
    End Sub
End Class

  • 上一篇:

  • 下一篇:
  • 【字体: 】【打印此文】【关闭窗口
      相关文章:(只显示最新16条)
    PowerPoint实例(VB2010实例)
    VB.Net为PowerPoint新增数据表格的实例

    | 设为首页 | 加入收藏 | 联系站长 | | 友情链接 | 版权申明 |
    乐博网欢迎各种媒体转载我们的原创作品[转载请注明出处];我们鼓励更多VB.Net开发者一起加入研究与探讨;如发现文章访问错误、内容错误或版权疑问、内容有违相关法律(如涉及政治、色情、反动或散布虚假有害信息)等情况,请及时向我们举报,我们将及时纠正!
    联系邮箱:Shiny#vip.qq.com (#替换为@) QQ交流群: 40797788 [闽ICP备05014267号]