DrawSkewImage – skewing an image by a given amount along one or both axes

DrawSkewImage – skewing an image by a given amount along one or both axes

' Skew an image by a given amount along one or both axes (the dx and dy ' parameters)' The x and y parameters are the coordinates of the upper-left point' Note: requires Imports System.Drawing.Imaging'' Example:'   Dim gr As Graphics = Me.CreateGraphics'   gr.Clear(Color.White)'   Dim bmp As New Bitmap("logo.bmp")'   DrawSkewImage(gr, bmp, 100, 400, -50, 0)'   DrawSkewImage(gr, bmp, 300, 400, 0, 50)'   DrawSkewImage(gr, bmp, 500, 400, -50, 50)'   bmp.Dispose()'   gr.Dispose()Sub DrawSkewImage(ByVal gr As Graphics, ByVal bmp As Bitmap, ByVal x As Single, _    ByVal y As Single, ByVal dx As Single, ByVal dy As Single)    ' Find the position of (x1,y1) and (x2,y2).    Dim x1 As Single = x + bmp.Width    Dim y1 As Single = y + dy    Dim x2 As Single = x + dx    Dim y2 As Single = y + bmp.Height    ' Create the points array.    Dim points() As Point = {New Point(x, y), New Point(x1, y1), New Point(x2, _        y2)}    ' Draw the skewed image    gr.DrawImage(bmp, points)End Sub' Note: This code is taken from Francesco Balena's' "Programming Microsoft Visual Basic .NET" - MS Press 2002, ISBN 0735613753' You can read a free chapter of the book at ' http://www.vb2themax.com/HtmlDoc.asp?Table=Books&ID=101000

Share the Post:
XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing

data dictionary

Tools You Need to Make a Data Dictionary

Data dictionaries are crucial for organizations of all sizes that deal with large amounts of data. they are centralized repositories of all the data in organizations, including metadata such as