當前位置:首頁 » 課程大全 » 課程設計記事本

課程設計記事本

發布時間: 2021-03-07 15:31:36

㈠ 跪求大學vb課程設計里的記事本程序 在線等!

'窗體代碼

Option Explicit
Dim filename As String
Dim FileType As String
Dim FiType As String
Dim sFind As String
Dim result As String
Dim bWrap As Boolean
Dim ask As Boolean
Dim msgtext As String
Dim Flag As String

Private Sub Form_Load()
ask = False
RichText.Text = ""
filename = "無標題-記事本"
Form1.Caption = "無標題-記事本"
RichText.Height = Form1.ScaleHeight
RichText.Width = Form1.ScaleWidth
StatusBar1.Visible = False
StatusBar1.Panels(1).Text = Time
mnu.Enabled = False
mnucut.Enabled = False
mnufound.Enabled = False
mnufoundnext.Enabled = False
mnudel.Enabled = False
mnucancel.Enabled = False
mnuwordwrap.Checked = True
mnugoto.Enabled = False
If Clipboard.GetText <> "" Then
mnuplaster.Enabled = True
Else
mnuplaster.Enabled = False
End If
App.HelpFile = App.Path & "\notepad.chm"
End Sub

Private Sub Form_Resize()
RichText.Height = Form1.ScaleHeight
RichText.Width = Form1.ScaleWidth
End Sub

Private Sub Form_Unload(Cancel As Integer)
msgtext = "文件" & filename & "的文字已經改變。" & Chr(10) & Chr(13) & "想保存文件嗎?"
If ask = True Then
Flag = MsgBox(msgtext, 35, "記事本") ' 35=32+3
If Flag = vbYes Then mnusave_Click '選擇了確定則保存之
If Flag = vbCancel Then Cancel = True
If Flag = vbNo Then Unload Me
End If

End Sub

Private Sub mnuabout_Click()
MsgBox "記事本", vbOKOnly, "關於"
End Sub

Private Sub mnuall_Click()
RichText.SelStart = 0
RichText.SelLength = Len(RichText.Text)
End Sub

Private Sub mnucancel_Click()
MsgBox "請點擊滑鼠右鍵撤銷!", vbOKOnly, "提示"
End Sub

Private Sub mnu_Click()
Clipboard.Clear
Clipboard.SetText RichText.SelText
End Sub

Private Sub mnucut_Click()
Clipboard.Clear
Clipboard.SetText RichText.SelText
RichText.SelText = ""

End Sub

Private Sub mnudel_Click()
RichText.SelText = ""
End Sub

Private Sub mnuedit_Click()
If RichText.SelText <> "" Then
mnuopen.Enabled = True
mnucut.Enabled = True
mnudel.Enabled = True
mnu.Enabled = True
End If
If Len(RichText.Text) <> 0 Then
mnufound.Enabled = True
mnufoundnext.Enabled = True
End If
If ask = True Then mnucancel.Enabled = True
End Sub

Private Sub mnuexit_Click()
Unload Me
End Sub

Private Sub mnufont_Click()
On Error Resume Next
CommonDialog1.flags = &H3 Or &H1 Or &H2 Or &H100
CommonDialog1.Action = 4
RichText.Font.Name = CommonDialog1.FontName
RichText.Font.Size = CommonDialog1.FontSize
RichText.Font.Bold = CommonDialog1.FontBold
RichText.Font.Italic = CommonDialog1.FontItalic
RichText.Font.Underline = CommonDialog1.FontUnderline
RichText.SelColor = CommonDialog1.Color

End Sub

Private Sub mnufound_Click()
sFind = InputBox("請輸入要查找的字、詞:", "查找內容", sFind)
RichText.Find sFind
End Sub

Private Sub mnufoundnext_Click()
RichText.SelStart = RichText.SelStart + RichText.SelLength + 1
RichText.Find sFind, , Len(RichText)

End Sub

Private Sub mnuhelptopic_Click()
SendKeys "{F1}"
End Sub

Private Sub mnunewfile_Click()
On Error Resume Next
Dim n As Integer
msgtext = "文件" & filename & "的文字已經改變。" & Chr(10) & Chr(13) & "想保存文件嗎?"
If Len(RichText.Text) <> 0 Then
If filename = "無標題-記事本" Then
Flag = MsgBox(msgtext, 35, "記事本") '給予提示
If Flag = vbYes Then
mnusaveas_Click
RichText.Text = ""
Form1.Caption = "無標題-記事本"
filename = "無標題-記事本"
End If
If Flag = vbCancel Then Exit Sub
If Flag = vbNo Then
RichText.Text = ""
Form1.Caption = "無標題-記事本"
filename = "無標題-記事本"
End If
End If
End If
End Sub

Private Sub mnuopen_Click()
msgtext = "文件" & filename & "的文字已經改變。" & Chr(10) & Chr(13) & "想保存文件嗎?"
On Error Resume Next
If ask = True Then
Flag = MsgBox(msgtext, 35, "記事本") '給予提示
If Flag = vbYes Then mnusave_Click '選擇了確定則保存之
If Flag = vbCancel Then Exit Sub
If Flag = vbNo Then GoTo L1
End If
ask = False

L1: CommonDialog1.Filter = "文本文檔(*.txt)|*.txt|RTF文檔(*.rtf)|*.rtf|所有文件(*.*)|*.*"
CommonDialog1.ShowOpen
RichText.Text = "" '清空文本框
filename = CommonDialog1.filename
RichText.LoadFile filename
result = GetFileTitle(filename)
Me.Caption = "" & result & "-記事本"

End Sub

Private Sub mnupagesetup_Click()
psdlg.lStructSize = Len(psdlg)
psdlg.hwndOwner = hwnd
PageSetupDlg psdlg
End Sub

Private Sub mnuplaster_Click()
RichText.SelText = Clipboard.GetText(1)
End Sub

Private Sub mnuprint_Click()
Dim f As Integer, t As Integer
Dim i As Integer
CommonDialog1.CancelError = True
CommonDialog1.Max = 1000
CommonDialog1.Min = 1
On Error Resume Next
CommonDialog1.ShowPrinter

For f = CommonDialog1.FromPage To t = CommonDialog1.ToPage
Do While i < CommonDialog1.Copies + 1
Printer.Print RichText.Text
i = i + 1
Loop
Next
Printer.EndDoc
Cancel:
If Err.Number = 32755 Then
Exit Sub
End If
End Sub

Private Sub mnusave_Click()
CommonDialog1.Filter = "文本文檔(*.txt)|所有文件(*.*)|*.*"
On Error Resume Next
filename = CommonDialog1.filename '保存文件
If filename <> "" Then
RichText.SaveFile filename, rtfText
Else
mnusaveas_Click
End If
ask = False
End Sub

Private Sub mnusaveas_Click()
CommonDialog1.Filter = "文本文檔(*.txt)|所有文件(*.*)|*.*"
On Error Resume Next

CommonDialog1.ShowSave
filename = CommonDialog1.filename
RichText.SaveFile filename, rtfText

result = GetFileTitle(filename)
Me.Caption = "" & result & "-記事本"
ask = False
End Sub

Private Sub mnustatusbar_Click()
If mnustatusbar.Checked Then
StatusBar1.Visible = False
mnustatusbar.Checked = False
Else
StatusBar1.Visible = True
mnustatusbar.Checked = True
End If

End Sub

Private Sub mnutimedate_Click()
RichText.SelText = Format(Now, "h:mm ddddd")
End Sub

Private Sub mnuwordwrap_Click()
WrapTextLine RichText, bWrap
bWrap = Not bWrap
If mnuwordwrap.Checked = False Then
HScroll1.Enabled = True
mnuwordwrap.Checked = True

Else
HScroll1.Enabled = False
mnuwordwrap.Checked = False

End If

End Sub

Private Sub RichText_Change()
ask = True
End Sub

Private Sub Timer1_Timer()
If StatusBar1.Panels(1).Text <> CStr(Time) Then
StatusBar1.Panels(1).Text = Time
End If

End Sub

'模塊代碼

Option Explicit
Const WM_USER = &H400
Const EM_SETTARGETDEVICE = (WM_USER + 72)
Type POINTAPI
x As Long
y As Long
End Type
Type RECT
left As Long
right As Long
top As Long
bottom As Long
End Type
Public Type PageSetupDlg
lStructSize As Long
hwndOwner As Long
hDevMode As Long
hDevNames As Long
flags As Long
ptPaperSize As POINTAPI
rtMinMargin As RECT
rtMargin As RECT
hInstance As Long
lCustData As Long
lpfnPageSetupHook As Long
lpfnPagePaintHook As Long
lpPageSetupTemplateName As String
hPageSetupTemplate As Long
End Type
Public psdlg As PageSetupDlg
Declare Function PageSetupDlg Lib "comdlg32.dll" Alias "PageSetupDlgA" (pPagesetupdlg As PageSetupDlg) As Long

Public Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long

Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Dim bWrap As Boolean '// 換行標記'// 自定義一個換行的過程
Public Sub WrapTextLine(ByRef RichText As RichTextBox, ByVal bWrapSwitch As Boolean)
On Error Resume Next
If bWrapSwitch Then '// 設置 RichTextBox 自動換行
SendMessage RichText.hwnd, EM_SETTARGETDEVICE, GetDC(RichText.hwnd), RichText.Width / 15
RichText.RightMargin = IIf(RichText.RightMargin = 0, 1, 0)
Else
'// 設置 RichTextBox 不自動換行
SendMessage RichText.hwnd, EM_SETTARGETDEVICE, 0, 1
End If
End Sub
Function GetFileTitle(OldStr As String) As String

On Error Resume Next
Dim n As Integer, m As Integer '聲明字元串變數
Dim i As String, r As String
Dim p As Integer
i = "\" '要查找的指定字元
For n = 1 To Len(OldStr) '用Len函數計算已知字元串的位元組數
m = InStrRev(OldStr, i, -1) '"\"所在的位置(其中的-1是默認的)
Next n '找下去!

'截取最後一個"\"後面的字元串
r = right(OldStr, Len(OldStr) - m) '獲取Title
p = InStrRev(r, ".", -1) '"."所在位置
GetFileTitle = left(r, p - 1) '去掉後綴

End Function

㈡ 急求 日歷記事本課程設計報告 java編寫

日歷記事本課程設計報告
java編寫
/*
說明:主程序
*/
import
java.util.Calendar;
import
javax.swing.*;
import
java.awt.*;
import
java.awt.event.*;
import
java.io.*;
import
java.util.Hashtable;
public
class
CalendarPad
extends
JFrame
implements
MouseListener
{
int
year,month,day;
Hashtable
hashtable;
File
file;
JTextField
showDay[];
JLabel
title[];
Calendar
日歷;
int
星期幾;
NotePad
notepad=null;
Month
負責改變月;
Year
負責改變年;
String
星期[]={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
JPanel
leftPanel,rightPanel;
public
CalendarPad(int
year,int
month,int
day)
{
leftPanel=new
JPanel();
//左邊日歷...........
JPanel
leftCenter=new
JPanel();
JPanel
leftNorth=new
JPanel();
leftCenter.setLayout(new
GridLayout(7,7));
rightPanel=new
JPanel();
this.year=year;
this.month=month;
this.day=day;
負責改變年=new
Year(this);
負責改變年.setYear(year);
負責改變月=new
Month(this);
負責改變月.setMonth(month);
title=new
JLabel[7];
showDay=new
JTextField[42];
for(int
j=0;j<7;j++)
{
title[j]=new
JLabel();
title[j].setText(星期[j]);
title[j].setBorder(BorderFactory.createRaisedBevelBorder());
leftCenter.add(title[j]);
}
........
看下是不是收到了啊
額外人提問

㈢ 題目 編寫一個記事本程序 編寫一個Java語言記事本課程設計。設計要求

^import java.awt.*;
import java.awt.event.*;
import java.io.FileReader;
import java.io.FileWriter;
import javax.swing.JFileChooser; import java.awt.*;
import java.awt.event.*;
import java.io.FileReader;
import java.io.FileWriter;
import javax.swing.JFileChooser;
public class TextEditor extends Frame implements ActionListener{
MenuBar mainmenubar=new MenuBar();
Menu file;
MenuItem nw;
MenuItem op;
MenuItem cl;
MenuItem sf;
MenuItem ex;
TextArea tx;
public TextEditor(String title){
super(title);
CloseHandler handler= new CloseHandler();
this.addWindowListener(handler);
setSize(400,400);
setLocationRelativeTo(null);
menuinit();
tx=new TextArea();
this.add(tx);
setVisible(true);
}
void menuinit(){
mainmenubar =new MenuBar();
file=new Menu("File");
nw=new MenuItem("Great");
op=new MenuItem("Open");
cl=new MenuItem("Close");
sf=new MenuItem("save");
ex=new MenuItem("Exit");
file.add(nw);
file.add(op);
file.add(cl);
file.add(sf);
file.add(ex);
mainmenubar.add(file);
setMenuBar(mainmenubar);
nw.addActionListener(this);
op.addActionListener(this);
cl.addActionListener(this);
sf.addActionListener(this);
ex.addActionListener(this);
}
public void actionPerformed(ActionEvent e){
Object ob=e.getSource();
JFileChooser f =new JFileChooser();
if((ob==nw)||(ob==ex)){
tx.setText("write word in here");
}else if(ob==op){
f.showOpenDialog(this);
try{
StringBuffer s=new StringBuffer();
FileReader in=new FileReader(f.getSelectedFile());
while(true){
int b=in.read();
if(b==-1)
break;
s.append((char)b);
}
String myString=s.toString();
char[] mychar=myString.toCharArray();
String unkeyFile =FileEncry(mychar);
tx.setText(unkeyFile.toString());
in.close();
}catch(Exception ee){
}
}else if(ob==sf){
f.showSaveDialog(this);
try{
FileWriter out =new FileWriter(f.getSelectedFile());
String mystr=tx.getText();
char[] strchar=mystr.toCharArray();
String keyFile =FileEncry(strchar);
out.write(keyFile);
out.close();
}catch (Exception ee){
}
}else if(ob==ex)
System.exit(0);
}
public static void main(String[] args){
new TextEditor("Simple TextEdit");
}
public String FileEncry(char[] encry){
StringBuffer str=new StringBuffer();
char[] encry1 =new char[encry.length];
for(int i=0; i<encry.length;i++){
encry1[i]=(char) (encry[i]^'F');
str.append(encry1[i]);
}
return str.toString();
}
}
class CloseHandler extends WindowAdapter{
public void windowClosing(WindowEvent e){
System.exit(0);
}
}

㈣ c語言課程設計——記事本

簡單啊
#include<stdio.h>
main()
{
char c;
FILE *fp,*mp;
fp=("a.txt","w");
mp=("a.txt","r");
while(c='\0')
{
c=getchar();
fputc(c,fp);
}
}

㈤ visual basic 課程設計記事本程序代碼

分太少.......

㈥ vb課程設計記事本程序么,求步驟😔

  1. 新建一工程,添加菜單(打開,保存,關閉,退出....),添加文本編輯控制項;版

  2. 添加代碼(文件權的打開,保存,關閉....程序的退出...),將編輯框里的文本寫入文件;

  3. 保存工程;

  4. 編譯,生成可執行文件(---可用來測試一下);

  5. 打包,發布(製作安裝包)。

㈦ java課程設計----記事本

//package net.src.net;

import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.awt.color.*;
import java.awt.font.*;
import javax.swing.undo.*;

public class Note extends JFrame
{
boolean isChange=false;
boolean wasChange=false;
JMenuBar menuBar=new JMenuBar();

JMenu menuFile=new JMenu("File");
JMenuItem menuFileOpen=new JMenuItem("Open..");
JMenuItem menuFileSave=new JMenuItem("Save..");
JMenuItem menuFileExit=new JMenuItem("Exit");

JMenu menuEdit=new JMenu("Edit");
JMenuItem menuFileCut=new JMenuItem("Cut");
JMenuItem font=new JMenuItem("Font");
JMenuItem menuFilePaste=new JMenuItem("Paste");

JTextArea fileArea=new JTextArea();

public Note()
{
this.setTitle("記事本");
Toolkit tool=this.getToolkit();//窗口圖標!
Image myimage=tool.getImage("戒指.jpg");
this.setIconImage(myimage);
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
exit();
}
});
menuFileOpen.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
fileOpen_actionPerformed(e);
}
});
menuFileSave.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
fileSave_actionPerformed(e);
}
});
menuFileExit.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
fileExit_actionPerformed(e);
}
});
menuFileCut.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
fileCut_actionPerformed(e);
}
});
menuFilePaste.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
filePaste_actionPerformed(e);
}
});
font.addActionListener(new ActionListener ()
{
public void actionPerformed(ActionEvent e)
{
fileColor_actionPerformed(e);
}
});
fileArea.getDocument().addDocumentListener(new DocumentListener()
{
public void insertUpdate(DocumentEvent e)
{
wasChange=isChange;
isChange=true;
}
public void removeUpdate(DocumentEvent e)
{
wasChange=isChange;
isChange=true;
}
public void changedUpdate(DocumentEvent e)
{
wasChange=isChange;
isChange=true;
}
});
setSize(500,450);
menuBar.add(menuFile);
menuFile.setMnemonic('F');
menuBar.add(menuEdit);
menuEdit.setMnemonic('E');
menuFile.add(menuFileOpen);
menuFileOpen.setMnemonic('O');//訪問健;
menuFileOpen.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,InputEvent.CTRL_MASK));//快捷健;
menuFile.add(menuFileSave);
menuFileSave.setMnemonic('S');
menuFileSave.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,InputEvent.CTRL_MASK));
menuFile.addSeparator();
menuFile.add(menuFileExit);
menuFileExit.setMnemonic('E');
menuEdit.add(menuFileCut);
menuFileCut.setMnemonic('C');
menuFileCut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,InputEvent.CTRL_MASK));
menuEdit.add(menuFilePaste);
menuFilePaste.setMnemonic('P');
menuFilePaste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P,InputEvent.CTRL_MASK));
menuEdit.add(font);
font.setMnemonic('N');
font.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,InputEvent.CTRL_MASK));
this.getContentPane().add(new JScrollPane(fileArea));
setJMenuBar(menuBar);
fileArea.setLineWrap(true);
}
public void fileExit_actionPerformed(ActionEvent e)
{
System.exit(0);
}
public void fileOpen_actionPerformed(ActionEvent e)
{
//以下是filter;
JFileChooser fileChooser=new JFileChooser();
//fileChooser.addChoosableFileFilter(new myFilter("*.txt","Files(*.txt)"));
fileChooser.addChoosableFileFilter(fileChooser.getFileFilter());
if(fileChooser.APPROVE_OPTION!=fileChooser.showOpenDialog(this))return;
//以下是文件讀
BufferedReader dataIn=null;
try
{
dataIn=new BufferedReader(new FileReader(fileChooser.getSelectedFile().getPath()));
String c=null;
do
{
c=dataIn.readLine();
if(c!=null)
fileArea.append(c+"\n");
}
while(c!=null);
}
catch(Exception ex)
{
System.out.println("Catch exception:"+ex.toString());
}
}
public void exit()
{
if(isChange==false)
System.exit(1);
else
{
int decision=JOptionPane.showConfirmDialog(this,"The File has Change.\n"+"Do you want to save the change?",
"Notepad",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.WARNING_MESSAGE);
if (decision == JOptionPane.YES_OPTION)
{
//以下是將文件寫入計算機!
try {
JFileChooser fileSave = new JFileChooser();
fileSave.setDialogTitle("保存文件");
//fileSave.addChoosableFileFilter(new myFilter("*.txt","Files(*.txt)"));
fileSave.addChoosableFileFilter(fileSave.getFileFilter());
if (fileSave.APPROVE_OPTION != fileSave.showSaveDialog(this))
return;
BufferedWriter dataOut = new BufferedWriter(new BufferedWriter(new
FileWriter(fileSave.getSelectedFile())));
String c = null;
do {
String str = fileArea.getText();
dataOut.write(str);
dataOut.close();
}
while (c != null);
}
catch (Exception e2) {
System.out.println("Catch exception:有錯誤!" + e2.toString());
}
}
else if (decision == JOptionPane.NO_OPTION)
System.exit(1);
else if (decision == JOptionPane.CANCEL_OPTION);
;
}
//innerclass.fileSave_actionPerformed();
}
public void fileSave_actionPerformed(ActionEvent e1)
{

//以下是將文件寫入計算機!
try
{
JFileChooser fileSave=new JFileChooser();
fileSave.setDialogTitle("保存文件" );
//fileSave.addChoosableFileFilter(new myFilter("*.txt","Files(*.txt)"));
fileSave.addChoosableFileFilter(fileSave.getFileFilter());
if(fileSave.APPROVE_OPTION!=fileSave.showSaveDialog(this))return;
BufferedWriter dataOut=new BufferedWriter(new BufferedWriter(new FileWriter(fileSave.getSelectedFile()+".txt")));
//RandomAccessFile dataOut=new RandomAccessFile(fileSave.getSelectedFile(),"rw");
String c=null;
do
{
String str=fileArea.getText();
dataOut.write(str);
dataOut.close();
}
while(c!=null);
}
catch(Exception e2)
{
System.out.println("Catch exception:有錯誤!"+e2.toString());
}
}
public static void main(String arg[])
{
Note nt=new Note();
nt.show();
}
public void fileCut_actionPerformed(ActionEvent e)
{
fileArea.cut();
}
public void filePaste_actionPerformed(ActionEvent e)
{
fileArea.paste();
}
public void fileColor_actionPerformed(ActionEvent e)
{
JColorChooser fileColor=new JColorChooser();
//fileArea.setForeground(fileColor.showDialog(this,"顏色",Color.red));
//fileArea.setSelectionColor(fileColor.showDialog(this,"顏色",Color.red));
fileArea.setSelectionColor(fileColor.showDialog(this,"顏色",Color.black));
}
}

㈧ 用JAVA做課程設計 記事本

&易&額外的聯系方式見個人簡介,
&軟&功能可定製,全面匹配學習版/專業版/企業版等專不同程度的應用,
&科屬&此回復針對所有訪問者和需求者有效
&技&可 Bai Hi / 私信/追問/求助聯系,有償解決此種問題,
課程管理系統

㈨ java 簡易記事本 課程設計 報告書

java
簡易記事本
課程設計
我有新意具有可行性的方案.

熱點內容
武漢大學學生會輔導員寄語 發布:2021-03-16 21:44:16 瀏覽:612
七年級學生作文輔導學案 發布:2021-03-16 21:42:09 瀏覽:1
不屑弟高考成績 發布:2021-03-16 21:40:59 瀏覽:754
大學畢業證會有成績單 發布:2021-03-16 21:40:07 瀏覽:756
2017信陽學院輔導員招聘名單 發布:2021-03-16 21:40:02 瀏覽:800
查詢重慶2018中考成績查詢 發布:2021-03-16 21:39:58 瀏覽:21
結業考試成績怎麼查詢 發布:2021-03-16 21:28:40 瀏覽:679
14中醫醫師資格筆試考試成績查分 發布:2021-03-16 21:28:39 瀏覽:655
名著賞析課程標准 發布:2021-03-16 21:27:57 瀏覽:881
北京大學商業領袖高端培訓課程 發布:2021-03-16 21:27:41 瀏覽:919