thongkorn โพสต์ 2018-9-19 14:27:26

[VB.NET] แจกโค้ดฟรีการทำ Tile Layout ของฟรีจากค่าย Syncfusion

http://www.g2gnet.com/webboard/images/vbnet/syncfusion/tilelayout.png


ไม่พูดเยอะ เจ็บคอ ... ศึกษาดูวิธีการทำได้จากโค้ดเลยครับผม ... ดาวน์โหลด Syncfusion Community ได้ฟรีที่ Syncfusion Essential รุ่น Community

มาดูโค้ดกันเถอะ ...
' / --------------------------------------------------------------------------------
' / Developer : Mr.Surapon Yodsanga (Thongkorn Tubtimkrob)
' / eMail : thongkorn@hotmail.com
' / URL: http://www.g2gnet.com/webboard (Khon Kaen - Thailand)
' / Facebook: https://www.facebook.com/g2gnet (For Thailand)
' / Facebook: https://www.facebook.com/CommonIndy (Worldwide)
' / Purpose: Test TileLayout in Syncfusion Community with VB2010
' /
' / This is open source code under @Copyleft by Thongkorn Tubtimkrob.
' / You can modify and/or distribute without to inform the developer.
' / --------------------------------------------------------------------------------

Imports Syncfusion.Windows.Forms

Public Class frmTileLayout
    Dim MyToolTip As ToolTipAdv = Nothing
    Dim MySize As Size

    Public Sub New()
      ' This call is required by the designer.
      InitializeComponent()
      ' Add any initialization after the InitializeComponent() call.
      ' Instantiate a ToolTipAdv
      MyToolTip = New ToolTipAdv(Me)
    End Sub

    ' / --------------------------------------------------------------------------------
    '// Sample Click Event and Driven in Visual Basic.
    Private Sub ImageStreamer1_Click(sender As System.Object, e As System.EventArgs) Handles ImageStreamer1.Click
      System.Diagnostics.Process.Start("C:\\")
    End Sub

    Private Sub frmTileLayout_FormClosed(sender As Object, e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
      Me.Dispose()
      Application.Exit()
    End Sub

    ' / --------------------------------------------------------------------------------
    Private Sub frmTileLayout_Load(sender As Object, e As System.EventArgs) Handles Me.Load
      Me.TileLayout1.Text = "I love Visual Basic"
      Me.TileLayout1.ForeColor = Color.White

      '// imageStremaer1
      With Me.ImageStreamer1
            '// Images for slide
            .Images.Add(Image.FromFile(strPathImages + "\1.png"))
            .Images.Add(Image.FromFile(strPathImages + "\2.png"))
            .Images.Add(Image.FromFile(strPathImages + "\3.png"))
            .AllowDragging = True
            .TabIndex = 0
            .SubText.Text = "Slider Sample"
            .SubText.Location = New Point(0, .Height - (MySize.Height + 15))
            .SubText.Visible = True
            .Text = "Slider Sample"
            '// Open Slide
            .SlideShow = True
            .SliderSpeed = 2000    ' 1000 millisecond = 1 second.
      End With

      '// imageStremaer2
      With Me.ImageStreamer2
            .Images.Add(Image.FromFile(strPathImages + "\c.png"))
            .AllowDragging = True
            .InternalBackColor = System.Drawing.Color.Yellow
            .Location = New System.Drawing.Point(130, 0)
            .Name = "imageStreamer2"
            .Size = New System.Drawing.Size(120, 120)
            .TabIndex = 1
            .Text = "imageStreamer2"
            .TextAnimationDirection = Syncfusion.Windows.Forms.Tools.ImageStreamer.TextStreamDirection.RightToLeft
      End With

      '// imageStreamer3
      With Me.ImageStreamer3
            .Images.Add(Image.FromFile(strPathImages + "\Syncfusion.jpg"))
            .AllowDragging = True
            .InternalBackColor = System.Drawing.Color.Red
            .Location = New System.Drawing.Point(5, 125)
            .Name = "imageStreamer3"
            .Size = New System.Drawing.Size(120, 120)
            .TabIndex = 2
            .Text = "imageStreamer3"
            .TextAnimationDirection = Syncfusion.Windows.Forms.Tools.ImageStreamer.TextStreamDirection.RightToLeft
      End With

      '//imageStreamer4
      With Me.ImageStreamer4
            .Images.Add(Image.FromFile(strPathImages + "\6.png"))
            .SubText.Text = "Music"
            .SubText.Visible = True
            .BackColor = Color.DarkMagenta
            .SubText.Location = New Point(0, .Height - (MySize.Height + 15))
            .TabIndex = 3
            '// Add Event Handler
            AddHandler ImageStreamer4.Click, AddressOf ImageStreamer4_Click
      End With

      '//
      With Me.ImageStreamer5
            .Images.Add(Image.FromFile(strPathImages + "\g.png"))
            .BackColor = Color.CadetBlue
            .SubText.Text = "Sample Text"
            .SubText.ForeColor = Color.Black
            MySize = TextRenderer.MeasureText(ImageStreamer5.SubText.Text, Me.Font)
            .SubText.Location = New Point(0, .Height - (MySize.Height + 5))
      End With

      '// Exit
      Me.pictureBox1.Image = Image.FromFile(strPathImages + "\Exit.png")

    End Sub

    Private Sub ImageStreamer4_Click(sender As Object, e As System.EventArgs)
      Dim myMusicPath As String = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic)
      System.Diagnostics.Process.Start(myMusicPath)
    End Sub

    Private Sub pictureBox1_Click(sender As Object, e As System.EventArgs) Handles pictureBox1.Click
      Me.Dispose()
    End Sub

    Private Sub pictureBox1_MouseEnter(sender As Object, e As System.EventArgs) Handles pictureBox1.MouseEnter
      Me.Cursor = Cursors.Hand
      Dim pt As Point = Me.PointToScreen(New Point(Me.pictureBox1.Bounds.X + 10, Me.pictureBox1.Bounds.Y + Me.pictureBox1.Height + 10))
      Me.MyToolTip.Text = "Close"
      Me.MyToolTip.ShowPopup(pt)
    End Sub

    Private Sub pictureBox1_MouseLeave(sender As Object, e As System.EventArgs) Handles pictureBox1.MouseLeave
      Me.Cursor = Cursors.Default
      Me.MyToolTip.HidePopup()
    End Sub

    Private Sub ImageStreamer3_Click(sender As System.Object, e As System.EventArgs) Handles ImageStreamer3.Click
      Process.Start("http://www.syncfusion.com/downloads/latest-version")
    End Sub

End Class

โมดูลหากินอีกแล้ว modFunction.vb ...
' / --------------------------------------------------------------------------------
' / Developer : Mr.Surapon Yodsanga (Thongkorn Tubtimkrob)
' / eMail : thongkorn@hotmail.com
' / URL: http://www.g2gnet.com (Khon Kaen - Thailand)
' / Facebook: https://www.facebook.com/g2gnet (For Thailand)
' / Facebook: https://www.facebook.com/commonindy (Worldwide)
' / Microsoft Visual Basic .NET (2010)
' /
' / This is open source code under @Copyleft by Thongkorn Tubtimkrob.
' / You can modify and/or distribute without to inform the developer.
' / --------------------------------------------------------------------------------
Imports Microsoft.VisualBasic
Module modFunction
    '// Images Path
    Public strPathImages As String = MyPath(Application.StartupPath) & "Images"

    ' / --------------------------------------------------------------------------------
    ' / Get my project path
    ' / AppPath = C:\My Project\bin\debug
    ' / Replace "\bin\debug" with "\"
    ' / Return : C:\My Project\
    Function MyPath(AppPath As String) As String
      '/ MessageBox.Show(AppPath);
      AppPath = AppPath.ToLower()
      '/ Return Value
      MyPath = AppPath.Replace("\bin\debug", "\").Replace("\bin\release", "\").Replace("\bin\x86\debug", "\")
      '// If not found folder then put the \ (BackSlash) at the end.
      If Right(MyPath, 1) <> "\" Then MyPath = MyPath & "\"
    End Function

End Module
ดาวน์โหลดโค้ดฉบับเต็ม VB.NET (2010) ได้ที่นี่ ...

Oplot โพสต์ 2019-2-2 07:43:40

ขอบคุณครับ :D

optimized โพสต์ 2019-2-8 21:38:55

ขอบคุณครับ
หน้า: [1]
ดูในรูปแบบกติ: [VB.NET] แจกโค้ดฟรีการทำ Tile Layout ของฟรีจากค่าย Syncfusion