vb.net开发全套源码 vbnet web编程( 二 )


Call saveAsMenu_Click
Form1.Caption = "vb.net开发全套源码我的记事本""--""未命名"
sFileName = "未命名"
Text1.FontSize = 15
Text1.FontName = "宋体"
Text1.Text = ""
End If
End Sub
Private Sub openMenu_Click()'打开文件代码
If Len(Trim(Text1.Text)) = 0 Then
Form1.Caption = "我的记事本"
Form1.CommonDialog1.Filter = "文本文件|*.txt"
Form1.CommonDialog1.Flags = 4096
Form1.CommonDialog1.Action = 1
If Len(Form1.CommonDialog1.FileName)0 Then
sFileName = Form1.CommonDialog1.FileName
Form1.Caption = Form1.Caption"--"Form1.CommonDialog1.FileTitle
Open sFileName For Input As #1
Text1.FontSize = 15
Text1.FontName = "宋体"
Do While Not EOF(1)
Line Input #1, Text$
All$ = All$ + Text$ + Chr(13) + Chr(10)
Loop
Text1.Text = All
Close #1
End If
Else
Call saveAsMenu_Click
Form1.Caption = "我的记事本"
Form1.CommonDialog1.Filter = "文本文件|*.txt"
Form1.CommonDialog1.Flags = 4096
Form1.CommonDialog1.Action = 1
If Len(Form1.CommonDialog1.FileName)0 Then
sFileName = Form1.CommonDialog1.FileName
Form1.Caption = Form1.Caption"--"Form1.CommonDialog1.FileTitle
Open sFileName For Input As #1
Text1.FontSize = 15
Text1.FontName = "宋体"
Do While Not EOF(1)
Line Input #1, Text$
All$ = All$ + Text$ + Chr(13) + Chr(10)
Loop
Text1.Text = All
Close #1
End If
End If
End Sub
Private Sub pasteMenu_Click()'粘贴菜单代码
Text1.Text = Left(Text1.Text, Text1.SelStart) + Clipboard.GetText() + Mid(Text1.Text, Text1.SelStart + Text1.SelLength + 1)
End Sub
Private Sub printMenu_Click()
Form1.CommonDialog1.ShowPrinter
For i = 1 To CommonDialog1.Copies
Printer.Print Text1.Text
Printer.Print Text1.Text
Next
Printer.EndDoc
End Sub
Private Sub saveAsMenu_Click()'另存为菜单代码
If Len(Trim(Text1.Text))0 Then
Form1.CommonDialog1.DialogTitle = "保存文件"
Form1.CommonDialog1.InitDir = "D:\"
Form1.CommonDialog1.Filter = "文本文件|*.txt"
Form1.CommonDialog1.Flags = 2
Form1.CommonDialog1.ShowSave
If Len(Form1.CommonDialog1.FileName)0 Then
sFileName = Form1.CommonDialog1.FileName
Open sFileName For Output As #1
whole$ = Text1.Text
Print #1, whole
Close #1
End If
End If
End Sub
Private Sub saveMenu_Click()
If Len(Trim(Text1.Text))0 Then
Form1.CommonDialog1.DialogTitle = "保存文件"
Form1.CommonDialog1.InitDir = "D:\"
Form1.CommonDialog1.FileName = "新建文本"
Form1.CommonDialog1.Filter = "文本文件|*.txt"
Form1.CommonDialog1.Flags = 2
Form1.CommonDialog1.ShowSave
If Len(Form1.CommonDialog1.FileName)0 Then
sFileName = Form1.CommonDialog1.FileName
Open sFileName For Output As #1
whole$ = Text1.Text
Print #1, whole
Close #1
End If
End If
End Sub
Private Sub statusMenu_Click()
End Sub
求助一个vb.net开发的闹铃源代码,要能自定义铃声的那种添加一个timer控件,隔一秒(Interval = 1000)对照一次本地时间和指定的时间,如果相同就执行铃声,并停止对照 。或者启动时取得本地时间,没一秒把这时间加1秒,直到加到指定的时间执行铃声,并停止加 。播放mp3的代码 System.Runtime.InteropServices.DllImport("winmm.dll", _CharSet:=System.Runtime.InteropServices.CharSet.Auto) _Private Shared Function mciSendString(ByVal command As String, _ByVal buffer As System.Text.StringBuilder, _ByVal bufferSize As Integer, ByVal hwndCallback As IntPtr) As IntegerEnd FunctionPrivate aliasName As String = "MediaFile"'点击Button1(变成到指定时间就可以Private Sub Button1_Click(ByVal sender As Object, _ByVal e As EventArgs) Handles Button1.Click'要播放的文件比如在C:\music.mp3Dim fileName As String = "C:\music.mp3"Dim cmd As String'打开文件代码cmd = "open """ + fileName + """ type mpegvideo alias " + aliasNameIf mciSendString(cmd, Nothing, 0, IntPtr.Zero)0 ThenReturnEnd If '播放cmd = "play " + aliasNamemciSendString(cmd, Nothing, 0, IntPtr.Zero)End Sub'点击Button2停止播放(根据你自己的情况,比如建一个停止的按钮Private Sub Button2_Click(ByVal sender As Object, _ByVal e As System.EventArgs) Handles Button2.ClickDim cmd As String'播放中音乐停止cmd = "stop " + aliasNamemciSendString(cmd, Nothing, 0, IntPtr.Zero)'关闭cmd = "close " + aliasNamemciSendString(cmd, Nothing, 0, IntPtr.Zero)End Sub

推荐阅读