دائما في الخدمه ،،
بحث مخصص

مواقع بكل اللغات يسرد سيره الرسول صلى الله عليه وس ... (للكاتب: abouali ) (الردود: 12) ( أخر رد بواسطة: abouali )          »         


العودة   منتديات الحاسب في حياتنا > :: الـمنتـديـات الـتـقــنيـــة Technical forums:: > :: ملتقى المبرمجيـن دروس البرمجـة Programmers ::

:: ملتقى المبرمجيـن دروس البرمجـة Programmers :: دروس ، أمثلة ، فيجوال بيسك ، دوت نت، جافا ، سي ++، اوراكل ، أسمبلي و بقيه لغات البرمجه .

رد
 
أدوات الموضوع طرق مشاهدة الموضوع
قديم 29-5-1427هـ, 07:05 مساء   رقم المشاركة : [1]
الخبير
الصورة الرمزية الخبير
 

معدل تقييم المستوى: 0 الخبير is on a distinguished road
إرسال رسالة عبر مراسل MSN إلى الخبير

افتراضي

السلام عليكم
ها أنا قد عدت لكم مع مجموعة جديدة من الأوامر المفيدة في الفيجوال بيسك :D
ولكن قبل أن نبدأ الأوامر (نصيحة) أطفئوا الشبكة لأن الأوامر طويلة ـ في بعض الحالات طبعا ـ <marquee direction=right>:D :D :D :D :D :D :D :D :D :D :D</marquee>
------------------------------ فلنبدأ ----------------------------- ----------------------------- :
رسالة تأكيد الخروج من البرنامج:

<div align="left">Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim Answer As Integer
Answer = MsgBox("Are you sure you want to exit this program?", _
vbQuestion + vbYesNo, "Confirmation")
If Answer = vbNo Then Cancel = -1
End Sub</div>
-----------------------------------------------------------------------------
لمعرفة مسار برنامجك:

<div align="left">Private Sub Command1_Click()
Label1.Caption = CurDir$
mydrive$ = Left$(CurDir$, 1)
a$ = App.Path
End Sub</div>
-----------------------------------------------------------------------------
مكعب ثلاثي الأبعاد يدور حول نفسه:

<div align="left">'Add 1 Picture Box and 1 Timer Control to your form.
'At Run-Time, Move the mouse to change the rotation speed and direction..
'Insert the following code to your form:

Private X(8) As Integer
Private y(8) As Integer
'Integer arrays that hold the actual 2D coordinates of the
'8 corners of the cube.These are the values used to plot
'the cube on the form after the X,Y,Z coordinates of each cube
'corner have been converted to 2 dimensinal X and Y coordinates.
Private Const Pi = 3.14159265358979
'Constant used to convert degrees to radians
Private CenterX As Integer
Private CenterY As Integer
'The center of the 3 dimensional plane,where it's
'X=0 , Y=0 , Z=0
Private Const SIZE = 250
'The length of the cube achmes,therefore also adjusts the overall size.
Private Radius As Integer
'The radius of the rotation.Each one of the 8 corners of the cube
'rotates around the vertical Y axis with the same angular speed and radius
'of rotation.
Private Angle As Integer
'The value of this variable loops from 0 to 360 and it is passed
'as an argument to the COS and SIN functions (sine and cosine)
'that return the changing Z and X coordinates of each corner
'as the cube rotates around the Y axis
Private CurX As Integer
Private CurY As Integer
'Variables that hold the current mouse position on the form.
Private CubeCorners(1 To 8, 1 To 3) As Integer
'The array that holds the X,Y and Z coordinates of the 8 corners
'The center of the 3D plane is right on the center of the cube.
'So ,if SIZE the length of one achmes,it's:
'CenterCube(1,1) = SIZE/2 ' X coordinate of 1st corner
'CenterCube(1,2) = SIZE/2 ' Y coordinate
'CenterCube(1,3) = SIZE/2 ' Z coordinate
'Actually,we only need to give a value for the Y coordinates
'of each corner since that will never change during the rotation
'as all corners rotate around the Y axis ,with only their Z and X
'coordinates changing periodically.
Private Sub Form_Load()
Me.ScaleMode = 3
Picture1.ScaleMode = 3
Timer1.Interval = 1
'Set here the cube Width and color.
Me.ForeColor = vbBlue
Me.DrawWidth = 3
Picture1.AutoRedraw = True
Show
Picture1.Height = Picture1.Width
Picture1.Move ScaleWidth / 2 - Picture1.ScaleWidth / 2, Picture1.Height
CenterX = ScaleWidth / 2
CenterY = ScaleHeight / 2
'Set the center of the 3D plane to reflect the center of the form.
Angle = 0
Radius = Sqr(2 * (SIZE / 2) ^ 2)
'Give a value to the radius of the rotation.This is
'the Pythagorean theorem that returns the length of the
'hypotenuse of a right triangle as the square root
'of the sum of the other two sides raised to the 2nd power.
CubeCorners(1, 2) = SIZE / 2
CubeCorners(2, 2) = SIZE / 2
CubeCorners(3, 2) = -SIZE / 2
CubeCorners(4, 2) = -SIZE / 2
CubeCorners(5, 2) = SIZE / 2
CubeCorners(6, 2) = SIZE / 2
CubeCorners(7, 2) = -SIZE / 2
CubeCorners(8, 2) = -SIZE / 2
'Assign a value to the Y coordinates of each cube.This
'will never change through out the rotation since the cube
'rotates around the Y axis.Play around with these if you like
'but the 3D prism will no longer resemble a cube...
End Sub

Private Sub DrawCube()
Cls
For i = 1 To 8
X(i) = CenterX + CubeCorners(i, 1) + CubeCorners(i, 3) / 8
y(i) = CenterY + CubeCorners(i, 2) + Sgn(CubeCorners(i, 2)) * CubeCorners(i, 3) / 8
'These two lines contain the algorith that converts the
'coordinates of a point on the 3D plane (x,y,z) ,into 2
'dimensional X and Y coordinates that can be used to plot
'a point on the form.Play around with the 8's and see what happens...
Next
Line (X(3), y(3))-(X(4), y(4))
Line (X(4), y(4))-(X(8), y(8))
Line (X(3), y(3))-(X(7), y(7))
Line (X(7), y(7))-(X(8), y(8))
Line (X(1), y(1))-(X(3), y(3))
Line (X(1), y(1))-(X(2), y(2))
Line (X(5), y(5))-(X(6), y(6))
Line (X(5), y(5))-(X(1), y(1))
Line (X(5), y(5))-(X(7), y(7))
Line (X(6), y(6))-(X(8), y(8))
Line (X(2), y(2))-(X(4), y(4))
Line (X(2), y(2))-(X(6), y(6))
Line (X(1), y(1))-(X(4), y(4))
Line (X(2), y(2))-(X(3), y(3))
Line (X(4), y(4))-(X(8), y(8))
Line (X(3), y(3))-(X(7), y(7))
'The plotting of the cube onto the form.
'We have to draw each achmes seperately and then
' "connect" the bottom square with the top square.
DoEvents
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single)
CurX = X
CurY = y
'Store the current position of the mouse cursor into
'the variable CurX,CurY.
End Sub

Private Sub Timer1_Timer()
Select Case CurX
Case Is > ScaleWidth / 2
Angle = Angle + Abs(CurX - ScaleWidth / 2) / 20
If Angle = 360 Then Angle = 0
Case Else
Angle = Angle - Abs(CurX - ScaleWidth / 2) / 20
If Angle = 0 Then Angle = 360
End Select
'Change the direction and the angular speed of the rotation
'according to the position of the mouse cursor.If it's near
'the left edge of the form then the rotation will be
'anti-clockwise ,it's near the right edge it will be
'clockwise. The closer to the center of the form the
'cursor is,the slower the cube rotates.
'The angular speed of the rotation is controlled by the
'pace at which 'Angle' (the value that we pass to the
'(COS and SIN functions) increases or decreases (increases
'for anti-clockwise rotation and decreases for clockwise rotation).
For i = 1 To 3 Step 2
CubeCorners(i, 3) = Radius * Cos((Angle) * Pi / 180)
CubeCorners(i, 1) = Radius * Sin((Angle) * Pi / 180)
Next
For i = 2 To 4 Step 2
CubeCorners(i, 3) = Radius * Cos((Angle + 2 * 45) * Pi / 180)
CubeCorners(i, 1) = Radius * Sin((Angle + 2 * 45) * Pi / 180)
Next
For i = 5 To 7 Step 2
CubeCorners(i, 3) = Radius * Cos((Angle + 6 * 45) * Pi / 180)
CubeCorners(i, 1) = Radius * Sin((Angle + 6 * 45) * Pi / 180)
Next
For i = 6 To 8 Step 2
CubeCorners(i, 3) = Radius * Cos((Angle + 4 * 45) * Pi / 180)
CubeCorners(i, 1) = Radius * Sin((Angle + 4 * 45) * Pi / 180)
Next
'Give the new values to the X and Z coordinates of each one
'of the 8 cube corners by using the COS and SIN mathematical
'functions.Notice that corners 1 and 3 always have the same
'X and Z coordinates, as well as 2 and 4, 5 and 7,6 & 8.
'Take a look at the little scetch on the top of the form
'to see how this is explained (imagine the cube rotating
'around the Y axis)
DrawCube
End Sub</div>
----------------------------------------------------------------------------------------
بخصوص الطباعة:

1. طباعة صفحة اختبار:

<div align="left">Private Sub Form_Load()
Shell "rundll32 msprint2.dll,RUNDLL_PrintTestPage"
End Sub</div>

2. طباعة صورة:

<div align="left">Private Sub Command1_Click()
' أنشأ صندوق الصور Picture Box .
' ثم ضع أي صورة من جهازك.
' ضع Common Button وضع هذا الكود فيه.
Printer.PaintPicture Picture1.Picture, 0, 0, _
Picture1.Width, Picture1.Height
' use the EndDoc command if the picture is the last item you want
' to print on the paper
Printer.EndDoc
End Sub</div>

3. طباعة نص:

<div align="left">Private Sub Command1_Click()
' the following example will print hello on the form
Printer.Print "hello"
' use the EndDoc command if this text is the last thing you want
' to print on the paper
Printer.EndDoc
End Sub</div>

4. طباعة النموذج:

<div align="left">Private Sub Form_Load()
' replace the "Form1" below with the name of the
' form you want to print
Form1.PrintForm
End Sub</div>
--------------------------------------------------------
إفراغ سلة المحذوفات:
<div align="left">Const SHERB_NOCONFIRMATION = &H1
Const SHERB_NOPROGRESSUI = &H2
Const SHERB_NOSOUND = &H4
Private Type ULARGE_INTEGER
LowPart As Long
HighPart As Long
End Type
Private Type SHQUERYRBINFO
cbSize As Long
i64Size As ULARGE_INTEGER
i64NumItems As ULARGE_INTEGER
End Type
Private Declare Function SHEmptyRecycleBin Lib "shell32.dll" Alias "SHEmptyRecycleBinA" (ByVal hwnd As Long, ByVal pszRootPath As String, ByVal dwFlags As Long) As Long
Private Declare Function SHUpdateRecycleBinIcon Lib "shell32.dll" () As Long
Private Declare Function SHQueryRecycleBin Lib "shell32.dll" Alias "SHQueryRecycleBinA" (ByVal pszRootPath As String, pSHQueryRBInfo As SHQUERYRBINFO) As Long
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
Dim RBinInfo As SHQUERYRBINFO, Msg As VbMsgBoxResult
RBinInfo.cbSize = Len(RBinInfo)
SHQueryRecycleBin vbNullString, RBinInfo
If (RBinInfo.i64Size.LowPart And &H80000000) = &H80000000 Or RBinInfo.i64Size.HighPart > 0 Then
Msg = MsgBox("Your Recycle Bin consumes over 2 gigabytes right now!" + vbCrLf + "Do you want to empty it?", vbYesNo + vbQuestion)
Else
Msg = MsgBox("Your Recycle Bin consumes" + Str$(RBinInfo.i64Size.LowPart) + " bytes right now." + vbCrLf + "Do you want to empty it?", vbYesNo + vbQuestion)
End If
If Msg = vbYes Then
SHEmptyRecycleBin Me.hwnd, vbNullString, 0
SHUpdateRecycleBinIcon
End If
End Sub</div>
-------------------------------------------------
تحديد مسار سطح المكتب:
<div align="left">'Insert this code to your form:

Private Const ERROR_SUCCESS = 0&
Private Const HKEY_CURRENT_USER = &H80000001
Private Const SYNCHRONIZE = &H100000
Private Const READ_CONTROL = &H20000
Private Const STANDARD_RIGHTS_READ = READ_CONTROL
Private Const KEY_QUERY_VALUE = &H1
Private Const KEY_ENUMERATE_SUB_KEYS = &H8
Private Const KEY_NOTIFY = &H10
Private Const KEY_READ = ((STANDARD_RIGHTS_READ Or _
KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or _
KEY_NOTIFY) And (Not SYNCHRONIZE))
Private Const REG_SZ = 1
Private Declare Function RegCloseKey& Lib "ADVAPI32.DLL" (ByVal hKey&)
Private Declare Function RegOpenKeyExA& Lib "ADVAPI32.DLL" _
(ByVal hKey&, ByVal lpSubKey$, ByVal ulOptions&, _
ByVal samDesired&, phkResult&)
Private Declare Function RegQueryValueExA& Lib "ADVAPI32.DLL" (ByVal _
hKey&, ByVal lpValueName$, ByVal lpReserved&, lpType&, lpData As Any, _
lpcbData&)

Private Function sGetDesktop() As String
Const nLG As Long = 256
Dim sValue As String * nLG
Dim hKey As Long
Dim nType As Long
Dim nCR As Long
If (RegOpenKeyExA(HKEY_CURRENT_USER, _
"Software\Microsoft\Windows\CurrentVersion\Explore r\Shell Folders", 0, _
KEY_READ, hKey) = ERROR_SUCCESS) Then
If (RegQueryValueExA(hKey, "Desktop", 0, nType, ByVal sValue, nLG) _
= ERROR_SUCCESS) Then
If (nType = REG_SZ) Then
sGetDesktop = Left(sValue, InStr(sValue, vbNullChar) - 1)
End If
End If
nCR = RegCloseKey(hKey)
End If
End Function

Private Sub Form_Load()
MsgBox "Your desktop path is " & sGetDesktop
End Sub</div>
------------------------------------------------
نافذة شفافة:
<div align="left">'Module Code

Option Explicit
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, _
ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As _
Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal _
nCombineMode As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As _
Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long

Public Sub TransparentForm(frm As Form)
frm.ScaleMode = vbPixels
Const RGN_DIFF = 4
Const RGN_OR = 2

Dim outer_rgn As Long
Dim inner_rgn As Long
Dim wid As Single
Dim hgt As Single
Dim border_width As Single
Dim title_height As Single
Dim ctl_left As Single
Dim ctl_top As Single
Dim ctl_right As Single
Dim ctl_bottom As Single
Dim control_rgn As Long
Dim combined_rgn As Long
Dim ctl As Control

If frm.WindowState = vbMinimized Then Exit Sub

' Create the main form region.
wid = frm.ScaleX(frm.Width, vbTwips, vbPixels)
hgt = frm.ScaleY(frm.Height, vbTwips, vbPixels)
outer_rgn = CreateRectRgn(0, 0, wid, hgt)

border_width = (wid - frm.ScaleWidth) / 2
title_height = hgt - border_width - frm.ScaleHeight
inner_rgn = CreateRectRgn(border_width, title_height, wid - border_width, _
hgt - border_width)

' Subtract the inner region from the outer.
combined_rgn = CreateRectRgn(0, 0, 0, 0)
CombineRgn combined_rgn, outer_rgn, inner_rgn, RGN_DIFF

' Create the control regions.
For Each ctl In frm.Controls
If ctl.Container Is frm Then
ctl_left = frm.ScaleX(ctl.Left, frm.ScaleMode, vbPixels) _
+ border_width
ctl_top = frm.ScaleX(ctl.Top, frm.ScaleMode, vbPixels) + title_height
ctl_right = frm.ScaleX(ctl.Width, frm.ScaleMode, vbPixels) + ctl_left
ctl_bottom = frm.ScaleX(ctl.Height, frm.ScaleMode, vbPixels) + ctl_top
control_rgn = CreateRectRgn(ctl_left, ctl_top, ctl_right, ctl_bottom)
CombineRgn combined_rgn, combined_rgn, control_rgn, RGN_OR
End If
Next ctl

'Restrict the window to the region.
SetWindowRgn frm.hWnd, combined_rgn, True
End Sub

'Form Code

Private Sub Form_Resize()
TransparentForm Me
End Sub</div>


التوقيع:

الله ناظري *~*~* الله معي *~*~* الله مطلع علي
الخبير غير متواجد حالياً   رد مع اقتباس

رد


أدوات الموضوع
طرق مشاهدة الموضوع

الانتقال السريع إلى


الساعة الآن: 12:28 صباحاً

.Powered by vBulletin®, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd
.Powered by vista style, designed by Majeedah. For best browsing, use Mozilla Firefox.
الاتصال بنا - الأرشيف- [ 12   11   10   9   8   7   6   5   4   3   2   1 ] - الأعلى 
منتديات الحاسب في حياتنا Database Error
Database Error Database error
The منتديات الحاسب في حياتنا database has encountered a problem.

Please try the following:
  • Load the page again by clicking the Refresh button in your web browser.
  • Open the www.pcintv.com home page, then try to open another page.
  • Click the Back button to try another link.
The www.pcintv.com forum technical staff have been notified of the error, though you may contact them if the problem persists.
 
We apologise for any inconvenience.