Also ich habe mal schnell ein textverarbeitungsprogramm gemacht kann mir da jemand helfen wie ich beim drucken button im menü eine funktion einbauen also in de while schleife oder so wie dies geht so dass man denn text nicht nur öffnen und speichern kann sondern auch drucken
Drucken option
-
- [ offen ]
-
simon -
5. März 2009 um 16:48 -
Geschlossen -
Erledigt
-
-
dein quelltext?
wir sind keine hellseher -
- Offizieller Beitrag
Noch ein Tipp: Satzzeichen und Grammatik helfen sehr, den Text lesbar zu gestalten.
-
_FilePrint
dies vieleicht?
-
Hier ist der Quellcode:
Spoiler anzeigen
[autoit]#include <array.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiStatusBar.au3>Global $names = _ArrayCreate("","") ;# Benutzernamen
[/autoit] [autoit][/autoit] [autoit]
Global $pws = _ArrayCreate("","") ;# Passwörter$bp_login = Login("SB Word 1.5 - Login",$names,$pws)
[/autoit] [autoit][/autoit] [autoit]
Switch @error
Case 0
msgbox(64,"","Willkommen " & $bp_login)
Case 1
Exit
Case 2
msgbox(49,"","Falsches Passwort oder falscher Username!")
Exit
Case 3
msgbox(49,"","Array - System Fehler ")
Exit
EndSwitch;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[/autoit] [autoit][/autoit] [autoit]
; Hier dein Programm hin!
$gui = GUICreate("SB Schulword",1270,750,0,0)$filemenu = GUICtrlCreateMenu ("&Datei")
[/autoit] [autoit][/autoit] [autoit]
$open = GUICtrlCreateMenuitem ("Öffnen",$filemenu)
;GUICtrlSetState(-1,$GUI_DEFBUTTON)
$helpmenu = GUICtrlCreateMenu ("Info")
$saveitem = GUICtrlCreateMenuitem ("Speichern",$filemenu)
;GUICtrlSetState(-1,$GUI_DISABLE)
$infoitem = GUICtrlCreateMenuitem ("?",$helpmenu)
$frageitem = GUICtrlCreateMenuItem ("Fragen",$helpmenu)
$hpitem1 = GUICtrlCreateMenuItem("Homepage",$helpmenu)
$hpitem2 = GUICtrlCreateMenuItem ("2. Homepage",$helpmenu)$helpmenu = GUICtrlCreateMenu("Fragen",$helpmenu)
[/autoit] [autoit][/autoit] [autoit]
$frageitem2 = GUICtrlCreateMenuItem("Fragen",$helpmenu)$helpitem = GUICtrlCreateMenuitem ("Hilfe",$helpmenu)
[/autoit] [autoit][/autoit] [autoit]
$exititem = GUICtrlCreateMenuitem ("Beenden",$filemenu)
$recentfilesmenu = GUICtrlCreateMenu ("Dateien",$filemenu,1)$separator1 = GUICtrlCreateMenuitem ("",$filemenu,2); Erstellt eine Trennlinie (hier: leere Zeile)
[/autoit] [autoit][/autoit] [autoit]$viewmenu = GUICtrlCreateMenu("Ansicht",-1,1) ; wird vor dem "?" Menü erstellt
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$viewstatusitem = GUICtrlCreateMenuitem ("Statusleiste",$viewmenu)
GUICtrlSetState(-1,$GUI_CHECKED)
GUICtrlSetState(-1,$GUI_FOCUS)
;$cancelbutton = GUICtrlCreateButton ("Abbrechen",1000,660,100,30)GUICtrlCreatePic(@WorkingDir & "/kjkj.bmp",0,0,1270,750)
[/autoit] [autoit][/autoit] [autoit]
GUICtrlCreatePic(@WorkingDir & "/SB Word.jpg",10,10,450,150)$text_input = GUICtrlCreateEdit("",20,170,1230,520)
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetFont (-1, "15",400,2+4)
GUICtrlSetColor(-1,"0xCCFF66")
GUICtrlSetBkColor(-1,"0x000033")GUICtrlCreateLabel("Hallo und Herzlich Willkommen zu meinem neuen Word 1.5",470,70,1000,30)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
GUICtrlSetFont(-1,16,400,2+4,"Luciada Handwriting")
GUICtrlSetColor(-1,"0x66FF33")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetColor(-1,"0xFFFFFF");# Statusbar:
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$hStatus = _GUICtrlStatusBar_Create($gui)
_GUICtrlStatusBar_SetText($hStatus,"Bereit.")
;# Statusbar ENDEGUISetState ()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]While 1
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$msg = GUIGetMsg()
$wait = 1000
If $msg = $open Then
$file = FileOpenDialog("Wählen Sie eine Datei aus...",@WorkingDir,"Alle (*.txt) , (*.html")
$file_open = FileOpen($file,0)
$read_open = FileRead($file_open)
GUICtrlSetData($text_input,$read_open)
FileClose($file_open)
_GUICtrlStatusBar_SetText($hStatus,"Datei öffnen...")
Sleep($wait)
_GUICtrlStatusBar_SetText($hStatus,"Bereit.")
EndIf
If $msg = $viewstatusitem Then
If BitAnd(GUICtrlRead($viewstatusitem),$GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($viewstatusitem,$GUI_UNCHECKED)
_GUICtrlStatusBar_ShowHide ($hStatus, @SW_HIDE)
Else
GUICtrlSetState($viewstatusitem,$GUI_CHECKED)
_GUICtrlStatusBar_ShowHide ($hStatus, @SW_SHOW)
EndIf
EndIf
If $msg = $saveitem Then
$text_read = GUICtrlRead($text_input)
$save_pfad = FileSaveDialog("Bitte wähle den Speicherpfad",@WorkingDir,"Textdatei (*.txt)") ; Textdatei Filter
$file = FileOpen($save_pfad&".txt", 2) ; TEXTDATEI festlegen
If $file = -1 Then
MsgBox(0, "Fehler", "Die Datei konnte nicht geöffnet werden.")
Exit
EndIf
FileWriteLine($file,$text_read)
FileClose($file)
_GUICtrlStatusBar_SetText($hStatus,"Datei speichern...")
Sleep($wait)
_GUICtrlStatusBar_SetText($hStatus,"Bereit.")
EndIf
If $msg = $GUI_EVENT_CLOSE Or $msg = $exititem Then ExitLoop
If $msg = $infoitem Then Msgbox(64,"Info","Hallo wenn du fragen zu diesem Programm hast, dann schicke bitte eine e-mail an [email='simon-buchner1@gmx.de'][/email]. Vielen Dank für das Downloaden")
If $msg = $helpitem Then MsgBox(0,"Hilfe","Zur Hilfe bitte sende eine e-mail an [email='simon-buchner1@gmx.de'][/email] oder an simon-buchner2@gmx.de")
If $msg = $frageitem Then MsgBox (0,"Fragen","Bei Fragen E-Mail an simon-buchner1@gmx.de")
If $msg = $hpitem1 Then ShellExecute("http://www.simon-buchner.npage.de")
If $msg = $hpitem2 Then ShellExecute("http://www.simon-buchner.de.tl")
If $msg = $frageitem2 Then MsgBox(0,"Fragen","Zur beantwortung der Fragen wendet euch bitte mit einer e-mail an [email='simon-buchner1@gmx.de'][/email] .Danke!!!")
WEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Func Login($sTitle,$sUsername,$sPassword,$BgColor = 0x000000,$TxtColor = 0xFFFFFF,$BtnColor = 0x000000)
[/autoit] [autoit][/autoit] [autoit]
$LoginGui = GuiCreate($sTitle,250,140)
$NameLabel = GuiCtrlCreateLabel("Username",12,11)
$Name = GuiCtrlCreateInput("",70,10,165)
$PwLabel = GuiCtrlCreateLabel("Passwort",12,40)
$Pw = GuiCtrlCreateInput("",70,38,165,-1,0x0020)
$Login = GuiCtrlCreateButton("Login",75,67,100,Default,0x0001)
$load = GUICtrlCreateProgress(76,100,100,15)
GUICtrlSetState(-1,$GUI_HIDE)
$loading_label = GUICtrlCreateLabel("",90,120,100)
GuiCtrlSetColor(-1,$TxtColor)GuiSetBkColor($BgColor,$LoginGui)
[/autoit] [autoit][/autoit] [autoit]
GuiCtrlSetColor($NameLabel,$TxtColor)
GuiCtrlSetColor($PwLabel,$TxtColor)
GuiCtrlSetBkColor($Login,$BtnColor)
GuiCtrlSetColor($Login,$TxtColor)
GuiSetState()While 1
[/autoit]
Switch GuiGetMsg()
Case $GUI_EVENT_CLOSE
GuiDelete($LoginGui)
SetError(1)
Return 0
Case $Login
GUICtrlSetState($load,$GUI_SHOW)
For $i = 0 To 100
GUICtrlSetData($load, $i)
If $i=40 Then GUICtrlSetData($loading_label,"Überprüfung...")
If $i=90 Then GUICtrlSetData($loading_label,"Start...")
If $i=120 Then GUICtrlSetData($loading_label,"Fertig...")
sleep(150)
$i = $i + 9
Next
If Not IsArray($sUsername) and Not IsArray($sPassword) Then
If GuiCtrlRead($Name) = $sUsername and GuiCtrlRead($Pw) = $sPassword Then
GuiDelete($LoginGui)
Return $sUsername
Else
GuiDelete($LoginGui)
SetError(2)
Return 0
EndIf
ElseIf IsArray($sUsername) and IsArray($sPassword) Then
If (UBound($sUsername,0) <> 1) or (UBound($sPassword,0) <> 1) or (UBound($sUserName,1) <> UBound($sPassword,1)) Then
GuiDelete($LoginGui)
SetError(3)
Return 0
EndIf
$UN = GuiCtrlRead($Name)
$UP = GuiCtrlRead($Pw)
For $i = 0 to UBound($sUsername)-1
If $UN = $sUsername[$i] and $UP = $sPassword[$i] Then
GuiDelete($LoginGui)
Return $sUserName[$i]
EndIf
Next
GuiDelete($LoginGui)
SetError(2)
Return 0
Else
GuiDelete($LoginGui)
SetError(3)
Return 0
EndIf
EndSwitch
WEnd
EndFunc