none
VB2008 Datagridview Cell 元件提示功能 RRS feed

  • 問題

  • 請教各位大大,小弟在程式中規劃一個類似Recipe列表的功能,希望呈現是 當我把滑鼠移到該Cell,便出現一個元件提示窗 顯示Recipe內容

    下方是該功能的程式片段,我是參考網路範例測試的,範例是移到Button元件跳出提示實際測試該功能是可以被呈現,但我將元件宣告成DataGridView元件後就無法呈現,想請問各位大大,是否我的方向錯誤或是沒有注意到的地方

    Dim Msg_Show  As String
    Dim RecipeName As String
    
    Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
           Tool_Tip_Set()
    End Sub
    
    Private Sub Main_Display_CellMouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles Main_Display.CellMouseMove
            Dim x As Integer = e.RowIndex
            Dim y As Integer = e.ColumnIndex
            RecipeName= Main_Display.Rows(x).Cells(y).Value
            Msg_Show = "(" & x & "," & y & ")"
            ' Tool_Tip_Set()
        End Sub
    
    
    Private Sub Tool_Tip_Set()
            Dim TipType As New ToolTip()
             TipType.Active = True  
            TipType.AutomaticDelay = 200 
            TipType.AutoPopDelay = 20000    
            TipType.BackColor = Color.Black   
            TipType.ForeColor = Color.Lime 
            TipType.InitialDelay = 1 
            TipType.OwnerDraw = True   
            TipType.ReshowDelay = 1 
            TipType.ShowAlways = True  
            TipType.StripAmpersands = True 
            TipType.ToolTipIcon = ToolTipIcon.Info 
            TipType.ToolTipTitle = RecipeName & "Info."  
            TipType.UseAnimation = True    
            TipType.UseFading = True   
            TipType.IsBalloon = True 
            TipType.SetToolTip(Me.Main_Display, Msg_Show)
    
        End Sub


    新手上路

    2016年6月20日 上午 12:29

所有回覆