- [C#] Di chuyển và thay đổi kích thước Control Winform khi ứng dụng đang chạy
- [VB.NET] Chia sẻ source tạo sắp xếp đội hình bóng đá Line-ups đội bóng
- [C#] Hướng dẫn chỉnh sửa Text của label trực tiếp trên winform
- [C#] Hướng dẫn custom TextBox giống Ultraviewer trên Winform
- [C#] Show Modal Winform like Bootstrap
- [DATABASE] Thứ tự thực hiện mệnh đề truy vấn SELECT trong Sqlserver
- [C#] Hướng dẫn viết addin Excel Lấy hình ảnh từ URL internet vào Excel
- [DATABASE] TSQL view max length all column data trên table Sqlserver
- [DEVEXPRESS] Hướng dẫn sử dụng MailMerge kèm Hình ảnh trên Winform
- [DATABASE] Hướng dẫn truy vấn xem kích thước lưu trữ của từng bảng ghi Table trên sqlserver
- [C#] Hướng dẫn Fake Date Time sử dụng thư viện Harmony
- [DATABASE] Phân biệt câu lệnh DDL và DML trong sqlserver
- [C#] Hướng dẫn convert file mã HTML sang file Pdf trên winform
- [DEVEXPRESS] Tạo các loại mã vạch Barcode trực tiếp trên Devexpress Barcode API
- [DEVEXPRESS] Hướng dẫn custom Simple button thành Progressbar
- [DATABASE] Tách số và chữ từ chuỗi - hàm tối ưu hóa tách số và chữ trong Sqlserver
- [C#] Tìm kiếm gần đúng Full Text Search sử dụng thư viện Lucene.NET
- [C#] Chia sẻ tài liệu, sdk và source code máy chấm công dòng máy ZKTeco
- [C#] Memory Cache là gì, và sử dụng trong ứng dụng Winform
- [DATABASE] Khóa chính Primary Key trong Sqlserver
Hướng dẫn sử dụng tooltip khi rê chuột vào cell của grid view devexpress
Hôm nay, mình xin hướng dẫn các bạn, cách sử dụng tooltip khi rê chuột vào từng cell của gridview Devexpress.
Giao diện, demo của chương trình tooltip:
Đầu tiên, các bạn thiết kế form như giao diện bên dưới.
Sau đó, các bạn kéo control tooltipcontroller vào, sau đó các bạn add tooltipcontroller cho gridview như hình bên dưới:
Dưới đây, là source code chương trình:
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraGrid.Views.Grid.ViewInfo
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'SinhvienDataSet1.tbl_sinhvien' table. You can move, or remove it, as needed.
Me.Tbl_sinhvienTableAdapter.Fill(Me.SinhvienDataSet1.tbl_sinhvien)
'TODO: This line of code loads data into the 'SinhvienDataSet.tbl_sinhvien' table. You can move, or remove it, as needed.
End Sub
Private Sub ToolTipController1_GetActiveObjectInfo(sender As Object, e As DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs) Handles ToolTipController1.GetActiveObjectInfo
If e.Info Is Nothing AndAlso e.SelectedControl Is GridControl1 Then
Dim view As GridView = TryCast(GridControl1.FocusedView, GridView)
Dim info As GridHitInfo = view.CalcHitInfo(e.ControlMousePosition)
If view Is Nothing Then
Return
End If
If info.InRowCell Then
If info.Column.Caption = "Tên sinh viên" Then
Dim text As String = ""
Dim fullname As String = view.GetRowCellValue(info.RowHandle, view.Columns("fullname")).ToString
Dim birthday As String = view.GetRowCellValue(info.RowHandle, view.Columns("birthday")).ToString
Dim vb As String = view.GetRowCellValue(info.RowHandle, view.Columns("vb")).ToString
Dim csharp As String = view.GetRowCellValue(info.RowHandle, view.Columns("CSHARP")).ToString
Dim php As String = view.GetRowCellValue(info.RowHandle, view.Columns("PHP")).ToString
Dim asp As String = view.GetRowCellValue(info.RowHandle, view.Columns("asp")).ToString
Dim sql As String = view.GetRowCellValue(info.RowHandle, view.Columns("SQLSERVER")).ToString
text += "Tên sinh viên: " & fullname & "
Ngày sinh: " & birthday & "
VB.NET: " & vb & "
CSHARP: " & csharp & "
PHP: " & php & "
ASP.NET: " & asp & "
SQLSERVER: " & sql
Dim cellKey As String = info.RowHandle.ToString() & " - " & info.Column.ToString()
e.Info = New DevExpress.Utils.ToolTipControlInfo(cellKey, text)
End If
End If
End If
End Sub
End Class
CHÚC CÁC BẠN THÀNH CÔNG!