05-03-21, 09:44 PM
السلام عليكم اخواني
استفسار بسيط في الفيجوال بيسك - ويندوز فورم
كيف تقوم بقص الصورة بشكل دائري بعد استدعائها و تحريكها في الفورم قبل طباعتها.
شكرا مقدما لكل من ينفع الاخرين بعلمه .
Imports System.Drawing.Drawing2D
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim selrect As New Rectangle(100, 50, 200, 100)
CropEllipse(selrect, PictureBox1)
End Sub
Private Sub CropEllipse(ByVal EllipseRect As Rectangle, ByVal PicBox As PictureBox)
Using workBmp As New Bitmap(EllipseRect.Width, EllipseRect.Height)
Dim setrect As New Rectangle(0, 0, EllipseRect.Width, EllipseRect.Height)
Using grx As Graphics = Graphics.FromImage(workBmp)
grx.DrawImage(PicBox.Image, setrect, EllipseRect, GraphicsUnit.Pixel)
Using bm As New Bitmap(EllipseRect.Width, EllipseRect.Height)
Using grx2 As Graphics = Graphics.FromImage(bm)
grx2.SmoothingMode = SmoothingMode.AntiAlias
Using tb As New TextureBrush(workBmp)
tb.TranslateTransform(0, 0)
Using gp As New GraphicsPath
gp.AddEllipse(0, 0, workBmp.Width, workBmp.Height)
grx2.FillPath(tb, gp)
End Using
End Using
End Using
If PicBox.Image IsNot Nothing Then PicBox.Image.Dispose()
PicBox.Image = New Bitmap(bm)
End Using
End Using
End Using
End Sub
End Class
(06-03-21, 03:00 AM)عبد الهادي بهاب كتب : [ -> ]ممكن تجد الاجابة في هذا الموضوع
https://www.dreamincode.net/forums/topic...lar-image/
مثال بسيط ممكن بفيدك
ضع في فورم زر و ضورة ما
في صفحة الاكواد امسح الكل و ازرع ما يلي
PHP كود :
Imports System.Drawing.Drawing2D
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim selrect As New Rectangle(100, 50, 200, 100)
CropEllipse(selrect, PictureBox1)
End Sub
Private Sub CropEllipse(ByVal EllipseRect As Rectangle, ByVal PicBox As PictureBox)
Using workBmp As New Bitmap(EllipseRect.Width, EllipseRect.Height)
Dim setrect As New Rectangle(0, 0, EllipseRect.Width, EllipseRect.Height)
Using grx As Graphics = Graphics.FromImage(workBmp)
grx.DrawImage(PicBox.Image, setrect, EllipseRect, GraphicsUnit.Pixel)
Using bm As New Bitmap(EllipseRect.Width, EllipseRect.Height)
Using grx2 As Graphics = Graphics.FromImage(bm)
grx2.SmoothingMode = SmoothingMode.AntiAlias
Using tb As New TextureBrush(workBmp)
tb.TranslateTransform(0, 0)
Using gp As New GraphicsPath
gp.AddEllipse(0, 0, workBmp.Width, workBmp.Height)
grx2.FillPath(tb, gp)
End Using
End Using
End Using
If PicBox.Image IsNot Nothing Then PicBox.Image.Dispose()
PicBox.Image = New Bitmap(bm)
End Using
End Using
End Using
End Sub
End Class
وجرب .......... غير ما تريد
( للاسف لا افهم في الغرافيك )