نمایش نتایج 1 تا 40 از 105

نام تاپیک: نکات، ایده ها و ترفندهای کوچک برنامه نویسی در vb.net

Hybrid View

پست قبلی پست قبلی   پست بعدی پست بعدی
  1. #1
    کاربر دائمی آواتار ghafoori
    تاریخ عضویت
    مرداد 1384
    محل زندگی
    اصفهان-نجف اباد
    پست
    1,111

    Smile تغییر خواص یک فایل

    https://barnamenevis.org/showpo...3&postcount=59

    Imports System.IO

    Dim file As FileInfo = New FileInfo("C:\test.txt")
    file.Attributes = file.Attributes Or FileAttributes.ReadOnly Or FileAttributes.Hidden

  2. #2
    کاربر دائمی آواتار ghafoori
    تاریخ عضویت
    مرداد 1384
    محل زندگی
    اصفهان-نجف اباد
    پست
    1,111

    Smile محاسبه ی حجم کلی یک دایرکتوری

    https://barnamenevis.org/showpo...4&postcount=60

    Imports System.IO


    Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
    MessageBox.Show(CalculateDirectorySize(New DirectoryInfo("C:\WINDOWS\System32"), True).ToString())

    End Sub

    Public Function CalculateDirectorySize(ByVal directory As DirectoryInfo, ByVal includeSubdirectories As Boolean) As Long

    Dim totalSize As Long = 0
    '// Examine all contained files.
    Dim files() As FileInfo = directory.GetFiles()
    For Each file As FileInfo In files

    totalSize += file.Length
    Next
    ' // Examine all contained directories.

    If includeSubdirectories Then

    Dim dirs() As DirectoryInfo = directory.GetDirectories()
    For Each dir As DirectoryInfo In dirs
    totalSize += CalculateDirectorySize(dir, True)
    Next
    End If
    Return totalSize
    End Function


    آخرین ویرایش به وسیله ghafoori : جمعه 09 فروردین 1387 در 10:15 صبح

  3. #3
    کاربر دائمی آواتار ghafoori
    تاریخ عضویت
    مرداد 1384
    محل زندگی
    اصفهان-نجف اباد
    پست
    1,111

    Smile خواندن و نوشتن رنگ یک پیکسل به کمک توابع API

    https://barnamenevis.org/showpo...4&postcount=91

    <DllImport("user32.dll")> _
    Shared Function GetDC(ByVal hWnd As IntPtr) As IntPtr
    End Function
    <DllImport("user32.dll")> _
    Shared Function ReleaseDC(ByVal hWnd As IntPtr, ByVal hDC As IntPtr) As Integer
    End Function
    <DllImport("gdi32.dll")> _
    Shared Function GetPixel(ByVal hDC As IntPtr, ByVal x As Integer, ByVal y As Integer) As Integer
    End Function
    <DllImport("gdi32.dll")> _
    Shared Function SetPixel(ByVal hDC As IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal color As Integer) As Integer
    End Function
    Public Shared Function GetPixel(ByVal control As Control, ByVal x As Integer, ByVal y As Integer) As Color

    Dim color As Color = color.Empty
    If Not control Is Nothing Then

    Dim hDC As IntPtr = GetDC(control.Handle)
    Dim colorRef As IntPtr = GetPixel(hDC, x, y)
    color = color.FromArgb((colorRef.ToInt32 & &HFF) Or (colorRef.ToInt32 & &HFF00 >> 8) Or (colorRef.ToInt32 & &HFF0000 >> 16))
    ReleaseDC(control.Handle, hDC)
    End If
    Return color
    End Function
    Public Shared Sub SetPixel(ByVal control As Control, ByVal x As Integer, ByVal y As Integer, ByVal color As Color)

    If Not control Is Nothing Then

    Dim hDC As IntPtr = GetDC(control.Handle)
    Dim argb As Integer = color.ToArgb()
    Dim colorRef As Integer = ((argb & &HFF0000) >> 16) Or (argb & &HFF00) Or ((argb & &HFF) << 16)
    SetPixel(hDC, x, y, colorRef)
    ReleaseDC(control.Handle, hDC)
    End If
    End Sub


قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •