日期:2014-05-20  浏览次数:20817 次

如何让百分比总是出现在相应饼图扇区的中央位置?
如题,下面是我的代码,如何才能让百分比随着所在扇区角度的变化而变化,并且总是出现在该扇区的中央位置。
 Sub ShowPicture1(ByVal mBad As Integer, ByVal mVendor As String, ByVal Qty As Integer)
        Dim iFlags%
        Dim sql As String = ""
        Dim ds As DataSet
        Dim BMP1 As New Bitmap(Me.PictureBox1.Width, PictureBox1.Height)
        Dim BMP2 As New Bitmap(Me.P1.Width, P1.Height)
        Try

            sql = "select FIELD_DATA from udtKeyWord where KeyWord='Dining' and FIELD_TYPE='Title'"
            ds = SQLiteHelper.ExecuteDataset(connectstr, CommandType.Text, sql)
            If ds.Tables(0).Rows.Count > 0 Then
                Title_1.Text = ds.Tables(0).Rows(0).Item(0).ToString
            Else
                iFlags = vbInformation Or vbOKOnly
                MessageBoxTimeout(Me.Handle, "标题没有维护!", "Message", iFlags, 0, 3000)
                Exit Sub
            End If
            Name_1.Text = mVendor.ToString
            Dim i As Integer = 0
            Dim Sc As String = My.Computer.Screen.Bounds.Width.ToString & "*" & My.Computer.Screen.Bounds.Height.ToString
            'Dim MyGraphics As Graphics = Me.PictureBox1.CreateGraphics
            Dim MyGraphics As Graphics = Graphics.FromImage(BMP1)
            MyGraphics.Clear(Color.White)

            'Dim MyGraphicsP1 As Graphics = Me.P1.CreateGraphics
            Dim MyGraphicsP1 As Graphics = Graphics.FromImage(BMP2)
            Dim MyBrush As New SolidBrush(Color.Red)
            Dim MyProportion As Single
            Dim MyRect As New Rectangle
            Dim MyPoint As New PointF
            Dim R As Single
            Dim arrValues(1) As Integer