09-06-19, 08:19 PM
بارك الله بكم جميعا"
الحمدلله تم حل المشكلة بعد تعديل الكود كالتالي :
الحمدلله تم حل المشكلة بعد تعديل الكود كالتالي :
كود :
Dim i1 As Decimal = TxtBrotin.Text
Dim i2 As Decimal = TxtKrpohidrat.Text
Dim i3 As Decimal = TxtDohon.Text
Dim total As Decimal = i1 + i2 + i3
Dim deg1 As Decimal = (i1 / total) * 360
Dim deg2 As Decimal = (i2 / total) * 360
Dim deg3 As Decimal = (i3 / total) * 360
Dim Img0 As New Bitmap(PbChart_pic.Width, PbChart_pic.Height)
Dim pen As New Pen(Color.Black, 2)
Dim graphics As Graphics = graphics.FromImage(Img0)
Dim rect As New Rectangle(0, 0, PbChart_pic.Width, PbChart_pic.Height)
Dim brush1 As New SolidBrush(Color.Green)
Dim brush2 = New SolidBrush(Color.Yellow)
Dim brush3 = New SolidBrush(Color.Red)
graphics.Clear(PbChart_pic.BackColor)
graphics.FillPie(brush1, rect, 0, deg1)
graphics.FillPie(brush2, rect, deg1, deg2)
graphics.FillPie(brush3, rect, deg1 + deg2, deg3)
Dim ms As New MemoryStream
Img0.Save(ms, Imaging.ImageFormat.Png)
Img = ms.ToArray
graphics.Dispose()
PbChart_pic.Image = Img0
