Click here to Skip to main content
15,894,907 members
Articles / Programming Languages / Visual Basic

A Study of Gage Repeatability and Reproducibility for Automated Measuring Systems using VB.NET

Rate me:
Please Sign up or sign in to vote.
5.00/5 (11 votes)
24 Jan 2015CPOL6 min read 53K   1.3K   5  
Gage R&R using VB.NET.
'Author  : Syed Shanu
'Company : Telstar-Hommel
'Date    : 2007-06-22
'Description :This Class is  created for Datagrid column back color change when datagrid load this class will triger and draw the color to specific datagrid coumn
Option Strict Off
Option Explicit On 
Imports Microsoft.VisualBasic
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Namespace ThetaMLA
    Public Class DataGridEnableTextBoxColumn
        Inherits DataGridTextBoxColumn
        Private _col As Integer
        'Fields
        'Constructors
        'Events
        'Methods
        Public Delegate Sub EnableCellEventHandler(ByVal sender As Object, ByVal e As DataGridEnableEventArgs)
        Public Sub New(ByVal column As Integer)
            MyBase.New()
            _col = column
        End Sub
        Public Event CheckCellEnabled As EnableCellEventHandler
        Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal bounds As Rectangle, ByVal source As CurrencyManager, ByVal rowNum As Integer, ByVal backBrush As Brush, ByVal foreBrush As Brush, ByVal alignToRight As Boolean)
            'can remove this if you don't want to vary the color of diabled cells
            Dim enabled As Boolean
            enabled = True
            Dim e As DataGridEnableEventArgs
            e = New DataGridEnableEventArgs(rowNum, _col, enabled)
            RaiseEvent CheckCellEnabled(Me, e)
            If Not (e.EnableValue) Then
                backBrush = Brushes.Gainsboro 'LightGray 'System.Drawing.Color.FromArgb(137, 164, 218) 'Brushes.Silver
                'Else
                ''    backBrush = Brushes.Goldenrod
            End If
            'end of coloring code
            MyBase.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight)
        End Sub
        Protected Overloads Overrides Sub Edit(ByVal source As CurrencyManager, ByVal rowNum As Integer, ByVal bounds As Rectangle, ByVal [readOnly] As Boolean, ByVal instantText As String, ByVal cellIsVisible As Boolean)
            Dim enabled As Boolean
            enabled = True
            Dim e As DataGridEnableEventArgs
            e = New DataGridEnableEventArgs(rowNum, _col, enabled)
            RaiseEvent CheckCellEnabled(Me, e)
            If e.EnableValue Then
                MyBase.Edit(source, rowNum, bounds, [readOnly], instantText, cellIsVisible)
            End If
        End Sub
    End Class
End Namespace

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader
India India
Microsoft MVP | Code Project MVP | CSharp Corner MVP | Author | Blogger and always happy to Share what he knows to others. MyBlog

My Interview on Microsoft TechNet Wiki Ninja Link

Comments and Discussions