Pls help to convert these into VB.NET

private static void SetColorComponent(ref Color pixelColor, int colorComponent, int newValue)
{
switch(colorComponent){
case 0:
pixelColor = Color.FromArgb(newValue, pixelColor.G, pixelColor.B);
break;
case 1:
pixelColor = Color.FromArgb(pixelColor.R, newValue, pixelColor.B);
break;
case 2:
pixelColor = Color.FromArgb(pixelColor.R, pixelColor.G, newValue);
break;
}
}

Comments

  • [code]
    Private Shared Sub SetColorComponent(ByRef pixelColor As Color, colorComponent As Integer, newValue As Integer)
    Select Case colorComponent
    Case 0
    pixelColor = Color.FromArgb(newValue, pixelColor.G, pixelColor.B)
    Case 1
    pixelColor = Color.FromArgb(pixelColor.R, newValue, pixelColor.B)
    Case 2
    pixelColor = Color.FromArgb(pixelColor.R, pixelColor.G, newValue)
    End Select
    End Sub 'SetColorComponent
    [/code]
  • Give a try this::

    private static SetColorComponent(ref Color pixelColor, int colorComponent, int newValue)

    Select Case ColorComponent
    Case 0
    pixelColor = Color.FromArgb(newValue, pixelColor.G, pixelColor.B);
    case 1
    pixelColor = Color.FromArgb(pixelColor.R, newValue, pixelColor.B);
    case 2
    pixelColor = Color.FromArgb(pixelColor.R, pixelColor.G, newValue);
    End Select

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories