Click here to Skip to main content
15,879,535 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 52.7K   1.3K   5  
Gage R&R using VB.NET.
Imports System.IO
Imports System.Text
Imports System.Drawing
Imports System.Reflection
Imports System.Drawing.Image
Imports Microsoft.VisualBasic
Imports System.Data.SqlClient
Imports System.Runtime.InteropServices
Imports Microsoft.VisualBasic.ControlChars
Imports System.Net
Public MustInherit Class Theme
    Private sFrmBackGroundImage As String
    Private sFrmTransperncyColor As Color
    Public Property BackGroundImage()
        Get
            Return sFrmBackGroundImage
        End Get
        Set(ByVal Value)
            sFrmBackGroundImage = Value
        End Set
    End Property
    Public Property TransperncyColor()
        Get
            Return sFrmTransperncyColor
        End Get
        Set(ByVal Value)
            sFrmTransperncyColor = Value
        End Set
    End Property
    Public MustOverride Function SetTheme(ByRef frmObj As Form) As Boolean
End Class
Public Class Theme1
    Inherits Theme
    Sub New()
        'Get the Image Location
        Dim fn As String = System.Environment.CurrentDirectory() & "\" & "Bitmap1.JPG"
        Me.BackGroundImage = fn ' New Bitmap([Assembly].GetExecutingAssembly().GetManifestResourceStream("SampleMlaProjectWork.Bitmap1.JPG")) ' fn
        Me.TransperncyColor = Color.FromArgb(192, 192, 255)
    End Sub
    Public Overrides Function SetTheme(ByRef frmObj As System.Windows.Forms.Form) As Boolean

        'set the transparency color
        frmObj.TransparencyKey = Me.TransperncyColor
        'set the form background image
        frmObj.BackgroundImage.FromFile(Me.BackGroundImage)
        'Change the control settings
        Dim cntl As Control
        For Each cntl In frmObj.Controls
            If TypeOf (cntl) Is Label Then
                cntl.ForeColor = Color.White
                cntl.BackColor = Color.Transparent
            ElseIf TypeOf (cntl) Is ComboBox Then
                cntl.ForeColor = Color.White
            Else
                cntl.ForeColor = Color.White
            End If
        Next
    End Function
End Class
Public Class Theme2
    Inherits Theme
    Sub New()
        'Get the Image Location
        Dim fn As String = System.Environment.CurrentDirectory() & "\" & "Bitmap2.JPG"
        Me.BackGroundImage = fn
        Me.TransperncyColor = Color.FromArgb(192, 192, 255)
    End Sub
    Public Overrides Function SetTheme(ByRef frmObj As System.Windows.Forms.Form) As Boolean
        'set the transparency color
        frmObj.TransparencyKey = Me.TransperncyColor
        'set the form background image
        frmObj.BackgroundImage.FromFile(Me.BackGroundImage)
        'Change the control settings
        Dim cntl As Control
        For Each cntl In frmObj.Controls
            If TypeOf (cntl) Is Label Then
                cntl.ForeColor = Color.Green
                cntl.BackColor = Color.Gold
            ElseIf TypeOf (cntl) Is ComboBox Then
                cntl.ForeColor = Color.DarkRed
            Else
                cntl.ForeColor = Color.DarkGreen
            End If
        Next
    End Function

End Class

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