To flip a image in C# and VB.NET you can use the following snippet.
Sample C#
public enum FlipMode { Horizontal = 0, Vertical = 1, Both = 2 } public Image FlipImage(Image myImage, FlipMode myFlipmode) { var ret = myImage; switch (myFlipmode) { case FlipMode.Horizontal: ret.RotateFlip(RotateFlipType.RotateNoneFlipX); break; case FlipMode.Vertical: ret.RotateFlip(RotateFlipType.RotateNoneFlipY); break; case FlipMode.Both: ret.RotateFlip(RotateFlipType.RotateNoneFlipXY); break; } return ret; }
Sample Vb.NET
Public Enum FlipMode Horizontal = 0 Vertical = 1 Both = 2 End Enum Public Function FlipImage(myImage As Image, myFlipmode As FlipMode) As Image Dim ret = myImage Select Case myFlipmode Case FlipMode.Horizontal ret.RotateFlip(RotateFlipType.RotateNoneFlipX) Exit Select Case FlipMode.Vertical ret.RotateFlip(RotateFlipType.RotateNoneFlipY) Exit Select Case FlipMode.Both ret.RotateFlip(RotateFlipType.RotateNoneFlipXY) Exit Select End Select Return ret End Function
RT @CodeSnippetsNET: How to flip a image in .NET http://t.co/ef4DIUdksv #csharp #dotnet #vb #programming #code #coding #dev