aliila1
Member
يكسري مثال كاربردي براي دلفي كه مورد نيازتون ميشه
PROCEDURE TForm1.BitBtn4Click(Sender: TObject);
BEGIN
Edit1.Text := TimeToStr(Time);
END;
PROCEDURE TForm1.BitBtn5Click(Sender: TObject);
BEGIN
Edit1.Text := DateToStr(Date);
END;
PROCEDURE TForm1.BitBtn6Click(Sender: TObject);
BEGIN
Edit1.Text := InputBox('Input Data', 'InputBox', 'This is a test!');
END;
PROCEDURE TForm1.Button1Click(Sender: TObject);
BEGIN
// avoid to receive a NIL and crash system if do not choose a color....
IF ColorDialog1.Execute THEN
BEGIN
Edit1.Color := ColorDialog1.Color;
Edit2.Color := ColorDialog1.Color;
END;
END;
PROCEDURE TForm1.BitBtn7Click(Sender: TObject);
VAR
x : Integer;
BEGIN
FOR X := 1 TO 10 DO
ShowMessage('Fuck this is awesome' + inttostr(x));
ShowMessage('end loop');
END;
PROCEDURE TForm1.BitBtn8Click(Sender: TObject);
BEGIN
MessageDlg('hello', mtInformation, [mbOk], 0);
END;
PROCEDURE TForm1.BitBtn9Click(Sender: TObject);
BEGIN
OpenDialog1.Filter := 'AllFiles (*.*)|*.*';
IF OpenDialog1.Execute THEN
ShellExecute(0, 'open', PChar(OpenDialog1.filename), 0, 0, SW_Normal);
END;
PROCEDURE TForm1.BitBtn10Click(Sender: TObject);
BEGIN
IF ((Edit2.Text = 'Username') AND (Edit1.Text = 'Password')) THEN
ShowMessage('Correct')
ELSE
ShowMessage('Wrong User Name & Password')
END;
PROCEDURE TForm1.BitBtn11Click(Sender: TObject);
BEGIN
mciSendString('Set CdAudio door Open', NIL, 0, Handle);
mciSendString('Set CdAudio door Closed', NIL, 0, Handle);
END;
PROCEDURE TForm1.BitBtn12Click(Sender: TObject);
BEGIN
SetCursorPos(Random(200), Random(200));
END;
PROCEDURE TForm1.BitBtn13Click(Sender: TObject);
BEGIN
SetWindowPos(Form1.Handle, Hwnd_TopMost, 0, 0, 0, 0, SWP_NoSize);
END;
PROCEDURE TForm1.Timer1Timer(Sender: TObject);
BEGIN
IF StaticText1.Left < -200 THEN
StaticText1.Left := 540
ELSE
StaticText1.Left := StaticText1.Left - 10;
END;
PROCEDURE TForm1.Timer2Timer(Sender: TObject);
VAR
Position : Tpoint;
BEGIN
GetCursorPos(Position);
StaticText2.Caption := ('Cursor Position: ''X: ' + IntToStr(Position.x) + ' ' + 'Y: ' + IntToStr(Position.y));
StaticText1.Font.Color := RGB(Random(250), Random(250), Random(250));
END;
PROCEDURE TForm1.BitBtn14Click(Sender: TObject);
VAR
AddedItem : STRING;
BEGIN
// why to pass by addeditem var ? Just if you need to test sometin has been typed
// instead pass directly in the list..
AddedItem := InputBox('Type in anything you want to add in the listbox',
'Add Item', 'DEFAULT ');
IF addedItem <> '' THEN
ListBox1.Items.add(AddedItem);
END;
PROCEDURE TForm1.BitBtn15Click(Sender: TObject);
BEGIN
// HEI ! WHICH ONE WANNA DELETE FROM DA LIST ? PLS SELECT ONE BEFORE !!!
IF Listbox1.ItemIndex > -1 THEN
Listbox1.Items.Delete(listbox1.ItemIndex)
ELSE
MessageDlg('Please select what to cancel !', mtConfirmation, [mbOK], 0);
END;
PROCEDURE TForm1.BitBtn16Click(Sender: TObject);
BEGIN
Listbox1.Clear;
END;
PROCEDURE TForm1.BitBtn17Click(Sender: TObject);
BEGIN
OpenDialog1.Filter := 'Allfiles (*.*)|*.*';
// protect protect and protect against exeptions !!
IF OpenDialog1.Execute THEN
FileSetAttr(OpenDialog1.FileName, faHidden);
// something should happen if ALL is save (e.g. a nil filename !!)
END;
PROCEDURE TForm1.BitBtn18Click(Sender: TObject);
BEGIN
OpenDialog1.Filter := 'Allfiles (*.*)|*.*';
IF OpenDialog1.Execute THEN
FileSetAttr(OpenDialog1.FileName, faArchive);
END;
PROCEDURE TForm1.BitBtn19Click(Sender: TObject);
BEGIN
IF SwapMouseButton(True) THEN
SwapMouseButton(False)
ELSE IF SwapMouseButton(False) THEN
SwapMouseButton(True);
END;
PROCEDURE TForm1.BitBtn21Click(Sender: TObject);
VAR
MyString : ShortSTRING;
BEGIN
MyString := Edit3.Text;
IF Length(Edit3.Text) >= 2 THEN
BEGIN
MessageBox(0, 'Since you have more then one character. ' +
' You will only get the ascii value of the last character you typed',
'Error', MB_Ok);
Edit4.Text := IntToStr(ord(MyString[Length(MyString)]));
END
ELSE
Edit4.Text := IntToStr(ord(MyString[1]));
END;
PROCEDURE TForm1.BitBtn22Click(Sender: TObject);
BEGIN
ShowWindow(FindWindowEx(FindWindow('shell_traywnd', NIL), 0, 'Button', NIL), 1);
END;
PROCEDURE TForm1.Button2Click(Sender: TObject);
BEGIN
form2.ShowModal;
END;
PROCEDURE TForm1.Button3Click(Sender: TObject);
BEGIN
// PROTECT AGAINST ERRORS !! IF USER DOES NOT SELECT .....KICK ASS !
IF ListBox1.ItemIndex > -1 THEN
MessageBox(0, PChar(ListBox1.Items.Strings
[listbox1.ItemIndex]), 'Selected Text', MB_OK);
END;
PROCEDURE TForm1.Button4Click(Sender: TObject);
BEGIN
ColorDialog1.Execute;
Listbox1.Color := ColorDialog1.Color;
END;
PROCEDURE TForm1.Button5Click(Sender: TObject);
VAR
InputDataStr : STRING;
BEGIN
InputDataStr := InputBox('Enter the data you want to insert in a string',
'String', 'default');
// to insert data in a string can use COPY function
// or ESBN libraries. which let you use objects like STUFF...
{: ESB Routines Collection v1.6
Miscellaneous Routines to enhance your 32-bit Delphi
Programming including: <p>
- 16 & 32-bit Bit Lists <p>
- Block Operations <p>
- various String Routines and Conversions <p>
(c) 1997-1999 ESB Consultancy <p>
These routines are used by ESB Consultancy within the
development of their Customised Application. <p>
ESB Consultancy retains full copyright. <p>
ESB Consultancy grants users of this code royalty free rights
to do with this code as they wish. <p>
ESB Consultancy makes no guarantees nor excepts any liabilities
due to the use of these routines. <p>
We do ask that if this code helps you in you development
that you send as an email mailto:[email protected] or even
a local postcard. It would also be nice if you gave us a
mention in your About Box, Help File or Documentation. <p>
ESB Consultancy Home Page: http://www.esbconsult.com.au <p>
Mail Address: PO Box 2259, Boulder, WA 6449 AUSTRALIA <p>
Check out our new ESB Professional Computation Suite with
1600+ Routines and 50+ Components for Delphi 4 & 5.<p>
http://www.esbpcs.com<p>
Also check out Marcel Martin's HIT at:<p>
http://www.esbconsult.com.au/esbpcs-hit.html<p>
Marcel has been helping out to optimise and improve routines.<p>
History: <p>
v1.6 11 November 1999<p>
- BitList routines optimsed thanks to Marcel Martin.<p>
- ReverseLBits & LBitsSet added to LongBitList routines.<p>
v1.5 18 September 1999<p>
- Added Delphi 5 Support<p>
- AnsiUpCase added<p>
- ESBProperStr Added<p>
v1.4 16 Apr 1999<p>
- GetSubStr for getting delimited substrings Added<p>
- Added routine to get Environment Variable setting<p>
- Added routine to return command line parameter in a StringList<p>
v1.3 12 Feb 1999 <p>
- StripChar Added <p>
- StripThousands Added <p>
- String to Integer/Float routines will now handle Thousands
Separators <p>
- Int2Placing Added <p>
v1.2 2 Sep 1998 <p>
- Delphi 4 Support Added <p>
- Comments changed to be Time2Help compliant <p>
- Help File Added <p>
- Max/Min of Data types removed as High/Low should be used <p>
- Byte2Str removed as LInt2Str can be used in it's place <p>
- Added String To Integer conversions for Smallint,
LongWord (4) and Int64(D4) <p>
<p>
v1.1 14 Nov 1997 <p>
- 32-Bit Bit Lists added <p>
<p>
v1.0 Intial Release <p>
}
END;
procedure TForm1.FormCreate(Sender: TObject);
begin
MessageBox(0,'If you can tell me how to make the Edit boxs calculate on the second form please tell me how thanks','Help',MB_Ok);
end;
دانلود همگي مثال ها
PROCEDURE TForm1.BitBtn4Click(Sender: TObject);
BEGIN
Edit1.Text := TimeToStr(Time);
END;
PROCEDURE TForm1.BitBtn5Click(Sender: TObject);
BEGIN
Edit1.Text := DateToStr(Date);
END;
PROCEDURE TForm1.BitBtn6Click(Sender: TObject);
BEGIN
Edit1.Text := InputBox('Input Data', 'InputBox', 'This is a test!');
END;
PROCEDURE TForm1.Button1Click(Sender: TObject);
BEGIN
// avoid to receive a NIL and crash system if do not choose a color....
IF ColorDialog1.Execute THEN
BEGIN
Edit1.Color := ColorDialog1.Color;
Edit2.Color := ColorDialog1.Color;
END;
END;
PROCEDURE TForm1.BitBtn7Click(Sender: TObject);
VAR
x : Integer;
BEGIN
FOR X := 1 TO 10 DO
ShowMessage('Fuck this is awesome' + inttostr(x));
ShowMessage('end loop');
END;
PROCEDURE TForm1.BitBtn8Click(Sender: TObject);
BEGIN
MessageDlg('hello', mtInformation, [mbOk], 0);
END;
PROCEDURE TForm1.BitBtn9Click(Sender: TObject);
BEGIN
OpenDialog1.Filter := 'AllFiles (*.*)|*.*';
IF OpenDialog1.Execute THEN
ShellExecute(0, 'open', PChar(OpenDialog1.filename), 0, 0, SW_Normal);
END;
PROCEDURE TForm1.BitBtn10Click(Sender: TObject);
BEGIN
IF ((Edit2.Text = 'Username') AND (Edit1.Text = 'Password')) THEN
ShowMessage('Correct')
ELSE
ShowMessage('Wrong User Name & Password')
END;
PROCEDURE TForm1.BitBtn11Click(Sender: TObject);
BEGIN
mciSendString('Set CdAudio door Open', NIL, 0, Handle);
mciSendString('Set CdAudio door Closed', NIL, 0, Handle);
END;
PROCEDURE TForm1.BitBtn12Click(Sender: TObject);
BEGIN
SetCursorPos(Random(200), Random(200));
END;
PROCEDURE TForm1.BitBtn13Click(Sender: TObject);
BEGIN
SetWindowPos(Form1.Handle, Hwnd_TopMost, 0, 0, 0, 0, SWP_NoSize);
END;
PROCEDURE TForm1.Timer1Timer(Sender: TObject);
BEGIN
IF StaticText1.Left < -200 THEN
StaticText1.Left := 540
ELSE
StaticText1.Left := StaticText1.Left - 10;
END;
PROCEDURE TForm1.Timer2Timer(Sender: TObject);
VAR
Position : Tpoint;
BEGIN
GetCursorPos(Position);
StaticText2.Caption := ('Cursor Position: ''X: ' + IntToStr(Position.x) + ' ' + 'Y: ' + IntToStr(Position.y));
StaticText1.Font.Color := RGB(Random(250), Random(250), Random(250));
END;
PROCEDURE TForm1.BitBtn14Click(Sender: TObject);
VAR
AddedItem : STRING;
BEGIN
// why to pass by addeditem var ? Just if you need to test sometin has been typed
// instead pass directly in the list..
AddedItem := InputBox('Type in anything you want to add in the listbox',
'Add Item', 'DEFAULT ');
IF addedItem <> '' THEN
ListBox1.Items.add(AddedItem);
END;
PROCEDURE TForm1.BitBtn15Click(Sender: TObject);
BEGIN
// HEI ! WHICH ONE WANNA DELETE FROM DA LIST ? PLS SELECT ONE BEFORE !!!
IF Listbox1.ItemIndex > -1 THEN
Listbox1.Items.Delete(listbox1.ItemIndex)
ELSE
MessageDlg('Please select what to cancel !', mtConfirmation, [mbOK], 0);
END;
PROCEDURE TForm1.BitBtn16Click(Sender: TObject);
BEGIN
Listbox1.Clear;
END;
PROCEDURE TForm1.BitBtn17Click(Sender: TObject);
BEGIN
OpenDialog1.Filter := 'Allfiles (*.*)|*.*';
// protect protect and protect against exeptions !!
IF OpenDialog1.Execute THEN
FileSetAttr(OpenDialog1.FileName, faHidden);
// something should happen if ALL is save (e.g. a nil filename !!)
END;
PROCEDURE TForm1.BitBtn18Click(Sender: TObject);
BEGIN
OpenDialog1.Filter := 'Allfiles (*.*)|*.*';
IF OpenDialog1.Execute THEN
FileSetAttr(OpenDialog1.FileName, faArchive);
END;
PROCEDURE TForm1.BitBtn19Click(Sender: TObject);
BEGIN
IF SwapMouseButton(True) THEN
SwapMouseButton(False)
ELSE IF SwapMouseButton(False) THEN
SwapMouseButton(True);
END;
PROCEDURE TForm1.BitBtn21Click(Sender: TObject);
VAR
MyString : ShortSTRING;
BEGIN
MyString := Edit3.Text;
IF Length(Edit3.Text) >= 2 THEN
BEGIN
MessageBox(0, 'Since you have more then one character. ' +
' You will only get the ascii value of the last character you typed',
'Error', MB_Ok);
Edit4.Text := IntToStr(ord(MyString[Length(MyString)]));
END
ELSE
Edit4.Text := IntToStr(ord(MyString[1]));
END;
PROCEDURE TForm1.BitBtn22Click(Sender: TObject);
BEGIN
ShowWindow(FindWindowEx(FindWindow('shell_traywnd', NIL), 0, 'Button', NIL), 1);
END;
PROCEDURE TForm1.Button2Click(Sender: TObject);
BEGIN
form2.ShowModal;
END;
PROCEDURE TForm1.Button3Click(Sender: TObject);
BEGIN
// PROTECT AGAINST ERRORS !! IF USER DOES NOT SELECT .....KICK ASS !
IF ListBox1.ItemIndex > -1 THEN
MessageBox(0, PChar(ListBox1.Items.Strings
[listbox1.ItemIndex]), 'Selected Text', MB_OK);
END;
PROCEDURE TForm1.Button4Click(Sender: TObject);
BEGIN
ColorDialog1.Execute;
Listbox1.Color := ColorDialog1.Color;
END;
PROCEDURE TForm1.Button5Click(Sender: TObject);
VAR
InputDataStr : STRING;
BEGIN
InputDataStr := InputBox('Enter the data you want to insert in a string',
'String', 'default');
// to insert data in a string can use COPY function
// or ESBN libraries. which let you use objects like STUFF...
{: ESB Routines Collection v1.6
Miscellaneous Routines to enhance your 32-bit Delphi
Programming including: <p>
- 16 & 32-bit Bit Lists <p>
- Block Operations <p>
- various String Routines and Conversions <p>
(c) 1997-1999 ESB Consultancy <p>
These routines are used by ESB Consultancy within the
development of their Customised Application. <p>
ESB Consultancy retains full copyright. <p>
ESB Consultancy grants users of this code royalty free rights
to do with this code as they wish. <p>
ESB Consultancy makes no guarantees nor excepts any liabilities
due to the use of these routines. <p>
We do ask that if this code helps you in you development
that you send as an email mailto:[email protected] or even
a local postcard. It would also be nice if you gave us a
mention in your About Box, Help File or Documentation. <p>
ESB Consultancy Home Page: http://www.esbconsult.com.au <p>
Mail Address: PO Box 2259, Boulder, WA 6449 AUSTRALIA <p>
Check out our new ESB Professional Computation Suite with
1600+ Routines and 50+ Components for Delphi 4 & 5.<p>
http://www.esbpcs.com<p>
Also check out Marcel Martin's HIT at:<p>
http://www.esbconsult.com.au/esbpcs-hit.html<p>
Marcel has been helping out to optimise and improve routines.<p>
History: <p>
v1.6 11 November 1999<p>
- BitList routines optimsed thanks to Marcel Martin.<p>
- ReverseLBits & LBitsSet added to LongBitList routines.<p>
v1.5 18 September 1999<p>
- Added Delphi 5 Support<p>
- AnsiUpCase added<p>
- ESBProperStr Added<p>
v1.4 16 Apr 1999<p>
- GetSubStr for getting delimited substrings Added<p>
- Added routine to get Environment Variable setting<p>
- Added routine to return command line parameter in a StringList<p>
v1.3 12 Feb 1999 <p>
- StripChar Added <p>
- StripThousands Added <p>
- String to Integer/Float routines will now handle Thousands
Separators <p>
- Int2Placing Added <p>
v1.2 2 Sep 1998 <p>
- Delphi 4 Support Added <p>
- Comments changed to be Time2Help compliant <p>
- Help File Added <p>
- Max/Min of Data types removed as High/Low should be used <p>
- Byte2Str removed as LInt2Str can be used in it's place <p>
- Added String To Integer conversions for Smallint,
LongWord (4) and Int64(D4) <p>
<p>
v1.1 14 Nov 1997 <p>
- 32-Bit Bit Lists added <p>
<p>
v1.0 Intial Release <p>
}
END;
procedure TForm1.FormCreate(Sender: TObject);
begin
MessageBox(0,'If you can tell me how to make the Edit boxs calculate on the second form please tell me how thanks','Help',MB_Ok);
end;
دانلود همگي مثال ها