https://barnamenevis.org/showpo...2&postcount=47
مثال: یک تکست باکس به فرم اضافه میکند:
کد:
Dim myText As TextBox = New TextBox()
myText.Location = New Point(25, 25)
Me.Controls.Add(myText)
https://barnamenevis.org/showpo...2&postcount=47
مثال: یک تکست باکس به فرم اضافه میکند:
کد:
Dim myText As TextBox = New TextBox()
myText.Location = New Point(25, 25)
Me.Controls.Add(myText)
https://barnamenevis.org/showpo...3&postcount=49
ابتدا System.Management رو به References پروژه بیفزایید و سپس :
کد:
Imports System.Management
Private Sub GetMACAddress()
Dim searcher As ManagementObjectSearcher
Dim qry As String = "select * FROM Win32_NetworkAdapter"
searcher = New ManagementObjectSearcher(qry)
For Each wmi_HD As ManagementObject In searcher.Get()
If Not wmi_HD("MacAddress") Is Nothing Then
MessageBox.Show(wmi_HD("MacAddress").ToString())
End If
Next
End Sub
https://barnamenevis.org/showpo...0&postcount=50
کد:
' //Open with the 'Windows picture and fax viewer':
System.Diagnostics.Process.Start("C:\Windows\syste m32\rundll32.exe ", _
"C:\Windows\system32\shimgvw.dll,ImageView_Fullscr een " + "filename")
اینهم که آسونه اما شاید واسه دوستانی مفید باشه :
کد:
'//Open with the 'Microsoft Paint':
System.Diagnostics.Process.Start("C:\Windows\syste m32\MSPaint.exe ", " filename")
https://barnamenevis.org/showpo...3&postcount=51
مثال - برای آخرین آیتم :
کد:
'// Set the TopIndex property of the ListBox to ensure the
'// most recently added items are visible.
ListBox1.TopIndex = ListBox1.Items.Count - 1
ListBox1.SelectedIndex = ListBox1.Items.Count - 1
https://barnamenevis.org/showpo...5&postcount=52
کد:
Private dragging As Boolean
Private pointClicked As Point
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
If (e.Button = MouseButtons.Left) Then
'// Turn drag mode on and store the point clicked.
dragging = True
pointClicked = New Point(e.X, e.Y)
Else
dragging = False
End If
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If dragging Then
Dim pointMoveTo As Point
'// Find the current mouse position in screen coordinates.
pointMoveTo = Me.PointToScreen(New Point(e.X, e.Y))
'// Compensate for the position the control was clicked.
pointMoveTo.Offset(-pointClicked.X, -pointClicked.Y)
'// Move the form.
Me.Location = pointMoveTo
End If
End Sub
Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
dragging = False
End Sub
کد:
ابتدا خاصیت allow drop را true کنید
Private Sub TextBox1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseDown
TextBox1.SelectAll()
TextBox1.DoDragDrop(TextBox1.Text, DragDropEffects.Copy)
End Sub
Private Sub TextBox2_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox2.DragEnter
If (e.Data.GetDataPresent(DataFormats.Text)) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
Private Sub TextBox2_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox2.DragDrop
TextBox2.Text = CType(e.Data.GetData(DataFormats.Text), String)
End Sub
کد:
https://barnamenevis.org/showpo...8&postcount=54
Private Function CaptureScreen() As Image
Dim screen As Bitmap = New Bitmap(Windows.Forms.Screen.PrimaryScreen.Bounds.W idth, Windows.Forms.Screen.PrimaryScreen.Bounds.Height)
Dim g As Graphics = Graphics.FromImage(screen)
Using (g)
g.CopyFromScreen(0, 0, 0, 0, screen.Size)
End Using
Return screen
End Function