转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 软件开发 >> VB.NET程序 >> 正文
用vb.net实现类似写字板程序的部分源代码         ★★★★

用vb.net实现类似写字板程序的部分源代码

作者:闵涛 文章来源:闵涛的学习笔记 点击数:6013 更新时间:2009/4/23 19:01:52
nbsp; ''''
        Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.Panel1.Controls.AddRange(New System.Windows.Forms.Control() {Me.PictureBox1, Me.closepanel, Me.Label1, Me.mpreplace, Me.findnext, Me.find, Me.rpbox, Me.txtbox})
        Me.Panel1.Location = New System.Drawing.Point(192, 160)
        Me.Panel1.Name = "Panel1"
        Me.Panel1.Size = New System.Drawing.Size(272, 96)
        Me.Panel1.TabIndex = 9
        Me.Panel1.Visible = False
        ''''
        ''''PictureBox1
        ''''
        Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Bitmap)
        Me.PictureBox1.Location = New System.Drawing.Point(8, 8)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(16, 16)
        Me.PictureBox1.TabIndex = 7
        Me.PictureBox1.TabStop = False
        ''''
        ''''closepanel
        ''''
        Me.closepanel.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.closepanel.ForeColor = System.Drawing.Color.Black
        Me.closepanel.Location = New System.Drawing.Point(240, 64)
        Me.closepanel.Name = "closepanel"
        Me.closepanel.Size = New System.Drawing.Size(24, 24)
        Me.closepanel.TabIndex = 6
        Me.closepanel.Text = "关"
        ''''
        ''''Label1
        ''''
        Me.Label1.Location = New System.Drawing.Point(24, 8)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(61, 16)
        Me.Label1.TabIndex = 5
        Me.Label1.Text = "查找-可拖"
        ''''
        ''''mpreplace
        ''''
        Me.mpreplace.Location = New System.Drawing.Point(112, 64)
        Me.mpreplace.Name = "mpreplace"
        Me.mpreplace.Size = New System.Drawing.Size(72, 23)
        Me.mpreplace.TabIndex = 4
        Me.mpreplace.Text = "替换"
        ''''
        ''''findnext
        ''''
        Me.findnext.Location = New System.Drawing.Point(192, 32)
        Me.findnext.Name = "findnext"
        Me.findnext.TabIndex = 3
        Me.findnext.Text = "下一个"
        ''''
        ''''find
        ''''
        Me.find.Location = New System.Drawing.Point(112, 32)
        Me.find.Name = "find"
        Me.find.Size = New System.Drawing.Size(72, 23)
        Me.find.TabIndex = 2
        Me.find.Text = "查找"
        ''''
        ''''rpbox
        ''''
        Me.rpbox.Location = New System.Drawing.Point(8, 64)
        Me.rpbox.Name = "rpbox"
        Me.rpbox.TabIndex = 1
        Me.rpbox.Text = ""
        ''''
        ''''txtbox
        ''''
        Me.txtbox.Location = New System.Drawing.Point(8, 32)
        Me.txtbox.Name = "txtbox"
        Me.txtbox.TabIndex = 0
        Me.txtbox.Text = ""
        ''''
        ''''formMain
        ''''
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(688, 489)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Panel1, Me.StatusBar1, Me.comboxSize, Me.comboxFont, Me.ToolBar2, Me.rtbox, Me.ToolBar1})
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Menu = Me.MainMenu1
        Me.Name = "formMain"
        Me.Text = "VB.NET课程设计作业2-写字板:::::By SunnyGroup 2002:::Shanghai Fisheries University:::::"
        Me.Panel1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region


    ''''声明一个全局boolean变量,用来标记richtextbox中文本变化和保存情况
    Dim bSave As Boolean

 

    ''''下面这段程序用于对对话框属性和全局变量进行初始化设置
    Private Sub formMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ''''为bSave首先赋初值
        bSave = True
        ''''为savefiledialog进行初始化
        SaveFileDialog1.FileName = ""
        SaveFileDialog1.DefaultExt = "txt"
        SaveFileDialog1.Filter = "Text files (*.txt) |*.txt|All files (*.*) |*.*"
        SaveFileDialog1.Title = "保存文件.."
        ''''为openfiledialog进行初始化
        OpenFileDialog1.FileName = ""
        OpenFileDialog1.DefaultExt = "txt"
        OpenFileDialog1.Filter = "Text files (*.txt) |*.txt|All files (*.*) |*.*"
        OpenFileDialog1.Title = "打开文件.."
        ''''下面这段代码是加载当地系统中所有字体到Combobox中
        Dim allfonts As FontFamily
        For Each allfonts In System.Drawing.FontFamily.Families
            comboxFont.Items.Add(allfonts.Name)
        Next
    End Sub

    Private Sub rtbox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rtbox.TextChanged
        ''''文本发生了改变,则将变量bSave置为False
        bSave = False
    End Sub

    ''''********************************************************************************************
    ''''字体

    ''''下面这个函数是用来去除用户指定的字体样式,如加粗,下划线等等
    Public Sub RemoveFontStyle(ByVal rtb As RichTextBox, _
    ByVal style As System.Drawing.FontStyle)
        '''' 如果选择文本的长度大于0,将一个一个去除样式。
        '''' 这是十分必要的!因为选择的文本中可能有许多不同的样式,而我们的原意是
        '''' 保持所有原来的样式,除了那个要被去除的样式
        If rtb.SelectionLength > 0 Then
            Dim selStart As Integer = rtb.SelectionStart
            Dim selLength As Integer = rtb.SelectionLength
            Dim currFont As System.Drawing.Font
            Dim currStyle As System.Drawing.FontStyle

            Dim i As Integer
            For i = 0 To selLength - 1
       &

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  下一页


没有相关教程
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · C语言系列  · VB.NET程序
    · JAVA开发  · Delphi程序
    · 脚本语言
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台