Chamuanza Posted April 16, 2015 at 09:43 AM Report Share #581359 Posted April 16, 2015 at 09:43 AM Um Bem Aja Existe maneira de apresentar num Datagridview do Vb Net 2013 o efeito de Mergecells como no VB6 via Mshflexgrid ? Link to comment Share on other sites More sharing options...
Joel Ribeiro Posted April 16, 2015 at 02:11 PM Report Share #581378 Posted April 16, 2015 at 02:11 PM eu penso que não Link to comment Share on other sites More sharing options...
Chamuanza Posted April 16, 2015 at 02:48 PM Author Report Share #581380 Posted April 16, 2015 at 02:48 PM Oi Ribeiro Aproveitando a tua resposta e no seguimento do topico andei a vasculhar pela net e encontrei esta classe. Mas não sei se serve e não sei como aplicar no meu projecto // Public Class GroupByGrid Inherits DataGridView Protected Overrides Sub OnCellFormatting(ByVal args As DataGridViewCellFormattingEventArgs) MyBase.OnCellFormatting(args) ' First row always displays If args.RowIndex = 0 Then Return End If If IsRepeatedCellValue(args.RowIndex, args.ColumnIndex) Then args.Value = String.Empty args.FormattingApplied = True End If End Sub Private Function IsRepeatedCellValue(ByVal rowIndex As Integer, ByVal colIndex As Integer) As Boolean Dim currCell As DataGridViewCell = Rows(rowIndex).Cells(colIndex) Dim prevCell As DataGridViewCell = Rows(rowIndex - 1).Cells(colIndex) If (currCell.Value Is prevCell.Value) OrElse (currCell.Value IsNot Nothing AndAlso prevCell.Value IsNot Nothing AndAlso currCell.Value.ToString() = prevCell.Value.ToString()) Then Return True Else Return False End If End Function Protected Overrides Sub OnCellPainting(ByVal args As DataGridViewCellPaintingEventArgs) MyBase.OnCellPainting(args) args.AdvancedBorderStyle.Bottom = DataGridViewAdvancedCellBorderStyle.None ' Ignore column and row headers and first row If args.RowIndex < 1 OrElse args.ColumnIndex < 0 Then Return End If If IsRepeatedCellValue(args.RowIndex, args.ColumnIndex) Then args.AdvancedBorderStyle.Top = DataGridViewAdvancedCellBorderStyle.None Else args.AdvancedBorderStyle.Top = AdvancedCellBorderStyle.Top End If End Sub Private Sub InitializeComponent() CType(Me, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() CType(Me, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub End Class tenho um este form com uma datagridview que vai buscar os dadoa a uma tabela access // Public Class frmRoscasTabelaComposta Private Sub frmRoscasTabelaComposta_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'TODO: This line of code loads data into the 'RoscasDataSet.TabRoscas' table. You can move, or remove it, as needed. Me.TabRoscasTableAdapter.Fill(Me.RoscasDataSet.TabRoscas) End Sub Private Sub btnSair_Click(sender As Object, e As EventArgs) Handles btnSair.Click Me.Close() End Sub End Class Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now