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

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

Hybrid View

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

    Smile کشیدن نقاشی با توابع ساده گرافیکی و ذخیره خروجی در یک فایل

    منبع:https://barnamenevis.org/showpo...1&postcount=10

    Public Sub Draw2File()

    Dim bmp As Bitmap = New Bitmap(500, 400)
    Dim gr As Graphics = Graphics.FromImage(bmp)
    Dim rect As Rectangle = New Rectangle(20, 20, 450, 350)
    gr.DrawRectangle(Pens.Red, rect)
    gr.FillRectangle(Brushes.Pink, rect)
    gr.DrawString("Salam", New Font("Arial", 10), Brushes.Red, 50, 50)
    gr.DrawArc(Pens.Red, 30, 30, 60, 60, 0, 180)
    gr.DrawEllipse(New Pen(Color.Yellow, 3), New Rectangle(200, 100, 200, 200))
    bmp.Save("C:\1.bmp")
    bmp.Dispose()
    gr.Dispose()
    End Sub

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

    Smile بدست آوردن لیست نمونه های SQL Server موجود در شبکه

    منبع:https://barnamenevis.org/showpo...0&postcount=11


    Imports System.Data.Sql

    Private Sub ShowSQLServerInstances()

    Dim instance As SqlDataSourceEnumerator = SqlDataSourceEnumerator.Instance
    Dim table As System.Data.DataTable = instance.GetDataSources()
    dataGridView1.DataSource = (table)
    End Sub

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

    Smile افزودن و حذف کردن یک برنامه به StartUp ویندوز از طریق کلیدهای رجیستری

    منبع:https://barnamenevis.org/showpo...5&postcount=12

    Private Sub AddStartUpKey(ByVal _name As String, ByVal _path As String)

    Dim key As RegistryKey = Registry.LocalMachine.OpenSubKey("Software\Microso ft\Windows\CurrentVersion\Run", True)
    key.SetValue(_name, _path)
    End Sub

    Private Sub RemoveStartUpKey(ByVal _name As String)

    Dim key As RegistryKey = Registry.LocalMachine.OpenSubKey("Software\Microso ft\Windows\CurrentVersion\Run", True)
    key.DeleteValue(_name, False)
    End Sub


  4. #4
    کاربر دائمی آواتار Dariuosh
    تاریخ عضویت
    مهر 1386
    محل زندگی
    ایران - تهران
    پست
    448

    Smile خوندن و نوشتن MP3 ID3v1 tags

    یه کلاس Add کنید

    Imports System.IO
    PublicClass MP3ID3v1
    ' Constructor
    PublicSubNew(OptionalByVal Filename AsString = "")
    MyBase.New()
    If (Filename <> "") ThenMe.Filename = Filename
    EndSub
    ' Genres
    PublicEnum Genres AsByte
    Blues = 0
    ClassicRock = 1
    Country = 2
    Dance = 3
    Disco = 4
    Funk = 5
    Grunge = 6
    HipHop = 7
    Jazz = 8
    Metal = 9
    NewAge = 10
    Oldies = 11
    Other = 12
    Pop = 13
    RnB = 14
    Rap = 15
    Reggae = 16
    Rock = 17
    Techno = 18
    Industrial = 19
    Alternative = 20
    Ska = 21
    DeathMetal = 22
    Pranks = 23
    Soundtrack = 24
    EuroTechno = 25
    Ambient = 26
    TripHop = 27
    Vocal = 28
    JazzFunk = 29
    Fusion = 30
    Trance = 31
    Classical = 32
    Instrumental = 33
    Acid = 34
    House = 35
    Game = 36
    SoundClip = 37
    Gospel = 38
    Noise = 39
    AlternRock = 40
    Bass = 41
    Soul = 42
    Punk = 43
    Space = 44
    Meditative = 45
    InstrumentalPop = 46
    InstrumentalRock = 47
    Ethnic = 48
    Gothic = 49
    Darkwave = 50
    TechnoIndustrial = 51
    Electronic = 52
    PopFolk = 53
    Eurodance = 54
    Dream = 55
    SouthernRock = 56
    Comedy = 57
    Cult = 58
    Gangsta = 59
    Top40 = 60
    ChristianRap = 61
    PopFunk = 62
    Jungle = 63
    NativeAmerican = 64
    Cabaret = 65
    NewWave = 66
    Psychadelic = 67
    Rave = 68
    Showtunes = 69
    Trailer = 70
    LoFi = 71
    Tribal = 72
    AcidPunk = 73
    AcidJazz = 74
    Polka = 75
    Retro = 76
    Musical = 77
    RocknRoll = 78
    HardRock = 79
    None = 255
    EndEnum
    ' Frame types
    PublicEnum FrameTypes AsByte
    Title = 0
    Artist = 1
    Album = 2
    Year = 3
    Track = 4
    Comment = 5
    Genre = 6
    EndEnum
    ' Filename
    Private mstrFilename AsString
    PublicProperty Filename() AsString
    Get
    Return mstrFilename
    EndGet
    Set(ByVal Value AsString)
    'Dim objFile As File
    If (File.Exists(Value)) Then
    mstrFilename = Value
    Refresh()
    Else
    ThrowNew System.IO.FileLoadException( _
    "The specified file does not exist", Value)
    EndIf
    EndSet
    EndProperty
    ' TagExists
    Private mblnTagExists AsBoolean
    PublicReadOnlyProperty TagExists() AsBoolean
    Get
    Return mblnTagExists
    EndGet
    EndProperty
    ' Frame
    Private mobjFrame(7) AsObject
    PublicProperty Frame(ByVal FrameType As FrameTypes)
    Get
    Return mobjFrame(FrameType)
    EndGet
    Set(ByVal Value)
    mobjFrame(FrameType) = Value
    EndSet
    EndProperty
    ' Refresh (gets all tags from the specified file)
    PublicSub Refresh()
    ' Declarations
    Dim strTag AsNewString(" ", 3)
    Dim strTitle AsNewString(" ", 30)
    Dim strArtist AsNewString(" ", 30)
    Dim strAlbum AsNewString(" ", 30)
    Dim strYear AsNewString(" ", 4)
    Dim strComment AsNewString(" ", 28)
    Dim bytDummy AsByte
    Dim bytTrack AsByte
    Dim bytGenre AsByte
    ' Open the file
    Dim intFile AsInteger = FreeFile()
    FileOpen(intFile, mstrFilename, OpenMode.Binary, _
    OpenAccess.Read, OpenShare.LockWrite)
    ' Gets length of file
    Dim lngLOF AsLong = LOF(intFile)
    If (lngLOF > 128) Then
    ' Check for the ID3v1 tag
    FileGet(intFile, strTag, lngLOF - 127, True)
    If (strTag.ToUpper <> "TAG") Then
    ' No ID3v1 tag found
    mblnTagExists = False
    mobjFrame(0) = ""
    mobjFrame(1) = ""
    mobjFrame(2) = ""
    mobjFrame(3) = ""
    mobjFrame(4) = ""
    mobjFrame(5) = ""
    mobjFrame(6) = ""
    Else
    ' ID3v1 tag found
    mblnTagExists = True
    ' Read all frames from the file
    FileGet(intFile, strTitle)
    FileGet(intFile, strArtist)
    FileGet(intFile, strAlbum)
    FileGet(intFile, strYear)
    FileGet(intFile, strComment)
    FileGet(intFile, bytDummy)
    FileGet(intFile, bytTrack)
    FileGet(intFile, bytGenre)
    ' Assign the frame content to the properties
    mobjFrame(0) = strTitle
    mobjFrame(1) = strArtist
    mobjFrame(2) = strAlbum
    mobjFrame(3) = strYear
    mobjFrame(4) = bytTrack
    mobjFrame(5) = strComment
    mobjFrame(6) = bytGenre
    EndIf
    EndIf
    ' Close the file
    FileClose(intFile)
    EndSub
    ' Update
    PublicSub Update()
    ' Declarations
    Dim strTag AsNewString(" ", 3)
    Dim strTitle AsNewString(" ", 30)
    Dim strArtist AsNewString(" ", 30)
    Dim strAlbum AsNewString(" ", 30)
    Dim strYear AsNewString(" ", 4)
    Dim strComment AsNewString(" ", 28)
    Dim bytDummy AsByte
    Dim bytTrack AsByte
    Dim bytGenre AsByte
    ' Open the file
    Dim intFile AsInteger = FreeFile()
    FileOpen(intFile, mstrFilename, OpenMode.Binary, _
    OpenAccess.ReadWrite, OpenShare.LockWrite)
    ' Gets length of file
    Dim lngLOF AsLong = LOF(intFile)
    If (lngLOF > 0) Then
    If (lngLOF > 128) Then
    ' Check for an existing ID3v1 tag
    FileGet(intFile, strTag, lngLOF - 127)
    If (strTag.ToUpper <> "TAG") Then
    ' No ID3v1 tag found, so just add one
    Seek(intFile, lngLOF)
    strTag = "TAG"
    FilePut(intFile, strTag)
    EndIf
    ' Fix the length of the frames
    strTitle = LSet(mobjFrame(0), Len(strTitle))
    strArtist = LSet(mobjFrame(1), Len(strArtist))
    strAlbum = LSet(mobjFrame(2), Len(strAlbum))
    strYear = LSet(mobjFrame(3), Len(strYear))
    bytTrack = mobjFrame(4)
    strComment = LSet(mobjFrame(5), Len(strComment))
    bytGenre = mobjFrame(6)
    ' Write the frames to the file
    FilePut(intFile, strTitle)
    FilePut(intFile, strArtist)
    FilePut(intFile, strAlbum)
    FilePut(intFile, strYear)
    FilePut(intFile, strComment)
    FilePut(intFile, bytDummy)
    FilePut(intFile, bytTrack)
    FilePut(intFile, bytGenre)
    EndIf
    EndIf
    ' Close the file
    FileClose(intFile)
    EndSub
    EndClass

    اینجوری تعریف میشه

    Dim objMP3V1 AsNew MP3ID3v1("C:\Song.mp3")

    اگه TagExists برابر True بود

    If (objMP3V1.TagExists) Then
    MessageBox.Show(objMP3V1.Frame(MP3ID3v1.FrameTypes .Album))
    MessageBox.Show(objMP3V1.Frame(MP3ID3v1.FrameTypes .Artist))
    EndIf

    برا ست کردن تگ جدید Property اونو ست کنید و Update کنید

    objMP3V1.Frame(MP3ID3v1.FrameTypes.Album) = "Album name"
    objMP3V1.Update()



    منبع
    بیشتر
    آخرین ویرایش به وسیله Dariuosh : جمعه 30 فروردین 1387 در 18:09 عصر

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

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