The document discusses adding tooltips and buttons to a form in Visual Basic. It includes code to add buttons and tooltips, start and pause a timer when buttons are clicked, and save log data to a file.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
56 views2 pages
Tambah Tool Tip & Button Methode Mause Hover
The document discusses adding tooltips and buttons to a form in Visual Basic. It includes code to add buttons and tooltips, start and pause a timer when buttons are clicked, and save log data to a file.
Tambahkan tool tip dan sebuah button lalu pada property atur tooltip on tool tip satu (isi nama nya)
Public Class Form1
Dim xxx As New Stopwatch Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Timer1.Start() Button1.Enabled = False Button2.Enabled = True Button3.Enabled = True xxx.Start()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Button2.Enabled = False Button3.Enabled = False End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Dim elapsed As TimeSpan = Me.xxx.Elapsed Label1.Text = String.Format("{0 : 00} :{1:00}:{2:00}", Math.Floor(elapsed.TotalHours), elapsed.Minutes, elapsed.Seconds)
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If Button3.Text = "stop" Then xxx.Reset() Button1.Enabled = True End If
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
ListBox1.Items.Add(Label1.Text) End Sub End Class Private Sub open_Click(sender As Object, e As EventArgs) Handles Button5.Click If Me.OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then System.Diagnostics.Process.Start(Me.OpenFileDialog1.FileName) End If End Sub Pada bagian property open file dialog 1 filter bisa d tambah |*txt
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
If Me.SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then My.Computer.FileSystem.WriteAllText(Me.SaveFileDialog1.FileName, Me.ListBox1.Text, True) End If End Sub Pada bgian property Defaut ext = rtf Filter |*rtf
Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
e.Graphics.DrawRectangle(Pens.Red, 10, 10, 20, 50) e.Graphics.FillRectangle(Brushes.Blue, 30, 60, 20, 50) e.Graphics.DrawRectangle(Pens.Red, 51, 10, 20, 50) End Sub
Dim g as graphics = me.label1.creategraphics
Private Sub NotifyIcon1_DoubleClick(sender As Object, e As EventArgs) Handles
NotifyIcon1.DoubleClick Me.Show() Me.WindowState = FormWindowState.Normal End Sub
Private Sub Form1_Resize(sender As Object, e As EventArgs) Handles Me.Resize
Me.NotifyIcon1.ShowBalloonTip(1000, "aa", "aaaa", ToolTipIcon.Info) Me.Hide() End Sub