Hi!
How can I "crop" out an elliptical portion of a bitmap? The code I posted here only draws the bitmap and the circle. I want to make something that will copy only what is within the circle. (Do I need to use the circle formula for this?)
Thanks. ~NinjaNic
vb Code:
Public Class Form1 Dim BitmapLocation As New Point(0, 0) Dim B As New Bitmap(My.Resources.picture) Private Sub Form1_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint e.Graphics.DrawImage(B, New Point(0, 0)) e.Graphics.DrawEllipse(Pens.Black, CreateRectangle) 'I need the part of the bitmap inside the circle. End Sub Private Function CreateRectangle() As Rectangle Dim R As New Rectangle R.Location = BitmapLocation If B.Width > B.Height Then R.Width = B.Height R.Height = B.Height R.X += CInt((B.Width - B.Height) / 2) Else R.Width = B.Width R.Height = B.Width R.Y += CInt((B.Height - B.Width) / 2) End If Return R End Function End Class


Reply With Quote

