Knight Online Private Serverlar
Knight Online Private Serverlar

Knight Online Private Serverlar Hakkındaki Tüm Paylaşımlar.
 
AnasayfaTakvimSSSAramaÜye ListesiKullanıcı GruplarıKayıt OlGiriş yap

Paylaş | 
 

 VB.NET Sağ Altta Balon Çıkarma

Aşağa gitmek 
YazarMesaj
Corleone
Administrator
Administrator
avatar

Tuttuğu Takım : Beşiktaşlı
Ruh Hâli : Neşeli
Mesaj Sayısı : 1541
Kullanıcı Puanı : 35001
Saygınlık : 10381
+500 Repliler
Üyelik Tarihi : 24/07/09
Yaş : 23
Şubesi : Ä°stanbul

MesajKonu: VB.NET Sağ Altta Balon Çıkarma   Çarş. Ağus. 12, 2009 10:37 pm

Vereceğim bu kodlar ekranın sağ alt köşesinde balon çakırmakta kullanılmaktadır.
Projenize bir tane modüle ekleyin ve şu kodları yazın :


Kod:
#Region "imported namespaces"

Imports System.Runtime.InteropServices

Imports System

Imports System.Resources

Imports System.IO

#End Region

Module Module1

#Region "Windows Ballon Tip"

Public Class BalloonTip

#Region "Private Message handler Class"

Private Class MessageHandler

Inherits Form '//Inherite from Form class so we can receive events

_
Private Shared Function RegisterWindowMessage(ByVal lpString As String) As Int32

End Function

Private Const WM_USER As Integer = &H400

Private Const WM_USER_TRAY As Integer = WM_USER + 1

Private Const WM_MOUSEMOVE = &H200

Private Const WM_LBUTTONDOWN = &H201

Private Const WM_LBUTTONUP = &H202

Private Const WM_LBUTTONDBLCLK = &H203

Private Const WM_RBUTTONDOWN = &H204

Private Const WM_RBUTTONUP = &H205

Private Const WM_RBUTTONDBLCLK = &H206

Private Const WM_MBUTTONDOWN = &H207

Private Const WM_MBUTTONUP = &H208

Private Const WM_MBUTTONDBLCLK = &H209

Private Const NIN_BALLOONSHOW As Int32 = &H402

Private Const NIN_BALLOONHIDE As Int32 = &H403

Private Const NIN_BALLOONTIMEOUT As Int32 = &H404

Private Const NIN_BALLOONUSERCLICK As Int32 = &H405

Public Shadows Event Click(ByVal sender As Object, ByVal e As System.EventArgs)

Public Shadows Event DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs)

Public Shadows Event MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)

Public Shadows Event MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)

Public Shadows Event MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)

Public Event Reload()

Public Event BalloonShow(ByVal sender As Object)

Public Event BalloonHide(ByVal sender As Object)

Public Event BalloonTimeout(ByVal sender As Object)

Public Event BalloonClick(ByVal sender As Object)

Private WM_TASKBARCREATED As Int32 = RegisterWindowMessage("TaskbarCreated")

Public Sub New()

ShowInTaskbar = False

StartPosition = FormStartPosition.Manual

Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedToolWindow

Size = New Size(100, 100)

Location = New Point(-500, -500)

Show()

End Sub

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)

Select Case m.Msg

Case WM_USER_TRAY

Select Case m.LParam.ToInt32

Case WM_LBUTTONDBLCLK, WM_RBUTTONDBLCLK, WM_MBUTTONDBLCLK

RaiseEvent DoubleClick(Me, New MouseEventArgs(MouseButtons, 0, MousePosition.X, MousePosition.Y, 0))

Case WM_LBUTTONDOWN, WM_RBUTTONDOWN, WM_MBUTTONDOWN

RaiseEvent MouseDown(Me, New MouseEventArgs(MouseButtons, 0, MousePosition.X, MousePosition.Y, 0))

Case WM_MOUSEMOVE

RaiseEvent MouseMove(Me, New MouseEventArgs(MouseButtons, 0, MousePosition.X, MousePosition.Y, 0))

Case WM_LBUTTONUP

RaiseEvent MouseUp(Me, New MouseEventArgs(Windows.Forms.MouseButtons.Left, 0, MousePosition.X, MousePosition.Y, 0))

RaiseEvent Click(Me, New MouseEventArgs(Windows.Forms.MouseButtons.Left, 0, MousePosition.X, MousePosition.Y, 0))

Case WM_RBUTTONUP

RaiseEvent MouseUp(Me, New MouseEventArgs(Windows.Forms.MouseButtons.Right, 0, MousePosition.X, MousePosition.Y, 0))

RaiseEvent Click(Me, New MouseEventArgs(Windows.Forms.MouseButtons.Right, 0, MousePosition.X, MousePosition.Y, 0))

Case WM_MBUTTONUP

RaiseEvent MouseUp(Me, New MouseEventArgs(Windows.Forms.MouseButtons.Middle, 0, MousePosition.X, MousePosition.Y, 0))

RaiseEvent Click(Me, New MouseEventArgs(Windows.Forms.MouseButtons.Middle, 0, MousePosition.X, MousePosition.Y, 0))

Case NIN_BALLOONSHOW

RaiseEvent BalloonShow(Me)

Case NIN_BALLOONHIDE

RaiseEvent BalloonHide(Me)

Case NIN_BALLOONTIMEOUT

RaiseEvent BalloonTimeout(Me)

Case NIN_BALLOONUSERCLICK

RaiseEvent BalloonClick(Me)

Case Else

Debug.WriteLine(m.LParam.ToInt32)

End Select

Case WM_TASKBARCREATED

RaiseEvent Reload()

Case Else

End Select

MyBase.WndProc(m)

End Sub

End Class

#End Region

Private Result As Boolean

Private Structure NOTIFYICONDATA

Dim cbSize As Int32

Dim hwnd As IntPtr

Dim uID As Int32

Dim uFlags As Int32

Dim uCallbackMessage As Int32

Dim hIcon As IntPtr

Dim szTip As String

Dim dwState As Int32

Dim dwStateMask As Int32

Dim szInfo As String

Dim uVersion As Int32

Dim szInfoTitle As String

Dim dwInfoFlags As Int32

End Structure

Const NIF_MESSAGE As Int32 = &H1

Const NIF_ICON As Int32 = &H2

Const NIF_STATE As Int32 = &H8

Const NIF_INFO As Int32 = &H10

Const NIF_TIP As Int32 = &H4

Const NIM_ADD As Int32 = &H0

Const NIM_MODIFY As Int32 = &H1

Const NIM_DELETE As Int32 = &H2

Const NIM_SETVERSION As Int32 = &H4

Const NOTIFYICON_VERSION As Int32 = &H5

Const NIS_HIDDEN = &H1

Const NIS_SHAREDICON = &H2

Const NIIF_ERROR = &H3

Const NIIF_INFO = &H1

Const NIIF_NONE = &H0

Const NIIF_WARNING = &H2

Const NIM_SETFOCUS = &H4

Const NIIF_GUID = &H5

Const WM_USER = &H400

Const WM_USER_TRAY = WM_USER + 1

Private Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" ( _
ByVal dwMessage As Int32, _
ByRef lpData As NOTIFYICONDATA) As Boolean

Private uNIF As NOTIFYICONDATA

Public Enum enumSoundType

SOUND_FROMSYSTEM = 1

SOUND_FROMRESOURCE = 2

SOUND_FROMFILE = 3

End Enum

Public Enum enumIconType

ICON_NONE = NIIF_NONE

ICON_INFO = NIIF_INFO

ICON_WARNING = NIIF_WARNING

ICON_ERROR = NIIF_ERROR

End Enum

#Region "Event declarations of tray icon"

Public Event Click(ByVal sender As Object, ByVal e As System.EventArgs)

Public Event DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs)

Public Event MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)

Public Event MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)

Public Event MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)

Public Event BalloonShow(ByVal sender As Object)

Public Event BalloonHide(ByVal sender As Object)

Public Event BalloonTimeout(ByVal sender As Object)

Public Event BalloonClick(ByVal sender As Object)

#End Region

Private WithEvents Messages As MessageHandler = New MessageHandler

Private m_ContextMenu As ContextMenu

Private m_VisibleBeforeBalloon As Boolean

Private m_Visible As Boolean

Private m_Icon As System.Drawing.Icon

Public Sub New()

With uNIF

.hwnd = Messages.Handle

.cbSize = Marshal.SizeOf(GetType(NOTIFYICONDATA))

.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE

.uCallbackMessage = WM_USER_TRAY

.uVersion = NOTIFYICON_VERSION

.szTip = ""

.uID = 0

End With

End Sub

Protected Overrides Sub Finalize()

Visible = False

MyBase.Finalize()

End Sub

Public Property Icon() As System.Drawing.Icon

Get

Return m_Icon

End Get

Set(ByVal Value As System.Drawing.Icon)

m_Icon = Value

uNIF.uFlags = uNIF.uFlags Or NIF_ICON

uNIF.hIcon = Icon.Handle

If Visible Then

Shell_NotifyIcon(NIM_MODIFY, uNIF)

End If

End Set

End Property

Public Property Text() As String

Get

Return uNIF.szTip

End Get

Set(ByVal Value As String)

uNIF.szTip = Value

If Visible Then

uNIF.uFlags = uNIF.uFlags Or NIF_TIP

Shell_NotifyIcon(NIM_MODIFY, uNIF)

End If

End Set

End Property

Public Property ContextMenu() As System.Windows.Forms.ContextMenu

Get

Return m_ContextMenu

End Get

Set(ByVal Value As System.Windows.Forms.ContextMenu)

m_ContextMenu = Value

End Set

End Property

Public Property Visible() As Boolean

Get

Return m_Visible

End Get

Set(ByVal Value As Boolean)

m_Visible = Value

If m_Visible Then

Shell_NotifyIcon(NIM_ADD, uNIF)

Else

Shell_NotifyIcon(NIM_DELETE, uNIF)

End If

End Set

End Property

Public Sub ShowNotifyBalloonTip(Optional ByVal Text As String = "Message", _
Optional ByVal Title As String = "Title", _
Optional ByVal Icon As enumIconType = enumIconType.ICON_INFO, _
Optional ByVal Timeout As Integer = 2000)

m_VisibleBeforeBalloon = m_Visible

With uNIF

.uFlags = .uFlags Or NIF_INFO

.uVersion = Timeout

.szInfo = Text

.szInfoTitle = Title

.dwInfoFlags = Convert.ToInt32(Icon)

End With

If Not Visible Then

'//By changing Visble Property it will show icon in sys tray

Visible = True

Else

'//This will modify attributes if already visible

Shell_NotifyIcon(NIM_MODIFY, uNIF)

End If

'//After showing balloon tip again switch to standard tooltip

uNIF.uFlags = uNIF.uFlags And Not NIF_INFO

End Sub

Private Shadows Sub Messages_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Messages.Click

RaiseEvent Click(Me, e)

End Sub

Private Shadows Sub Messages_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Messages.DoubleClick

RaiseEvent DoubleClick(Me, e)

End Sub

Private Shadows Sub Messages_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Messages.MouseDown

RaiseEvent MouseDown(Me, e)

End Sub

Private Shadows Sub Messages_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Messages.MouseMove

RaiseEvent MouseMove(Me, e)

End Sub

Private Shadows Sub Messages_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Messages.MouseUp

RaiseEvent MouseUp(Me, e)

If e.Button = MouseButtons.Right Then

Messages.Activate()

Dim Position As Point = New Point(Cursor.Position.X - Messages.PointToScreen(New Point(0, 0)).X, Cursor.Position.Y - Messages.PointToScreen(New Point(0, 0)).Y)

If Not m_ContextMenu Is Nothing Then m_ContextMenu.Show(Messages, Position)

End If

End Sub

Private Sub Messages_Reload() Handles Messages.Reload

If Visible Then Visible = True

End Sub

Private Sub Messages_BalloonShow(ByVal sender As Object) Handles Messages.BalloonShow

RaiseEvent BalloonShow(Me)

End Sub

Private Sub Messages_BalloonHide(ByVal sender As Object) Handles Messages.BalloonHide

RaiseEvent BalloonHide(Me)

End Sub

Private Sub Messages_BalloonTimeout(ByVal sender As Object) Handles Messages.BalloonTimeout

If Not m_VisibleBeforeBalloon Then Visible = False

RaiseEvent BalloonTimeout(Me)

End Sub

Private Sub Messages_BalloonClick(ByVal sender As Object) Handles Messages.BalloonClick

If Not m_VisibleBeforeBalloon Then Visible = False

RaiseEvent BalloonClick(Me)

Clicked()

End Sub

Public Sub Clicked()

End Sub

End Class

#End Region

End Module
Sayfa başına dön Aşağa gitmek
Kullanıcı profilini gör http://k2private.yetkin-forum.com
 
VB.NET Sağ Altta Balon Çıkarma
Sayfa başına dön 
1 sayfadaki 1 sayfası

Bu forumun müsaadesi var:Bu forumdaki mesajlara cevap veremezsiniz
Knight Online Private Serverlar :: Programlama :: .NET Programlama Dilleri-
Buraya geçin: