Pirate scholar
2017-09-22 05:37
采纳率: 22.2%
浏览 1.5k

C#/vb.net 在picturebox中的画图

C#/vb.net 在picturebox中的画图函数button_click 可以触发,form load不可触发

 Dim MyFormGraphic As Graphics = FormPic.CreateGraphics
        Dim BlackPen As New Pen(Brushes.Black, 2)  '线宽为2 
        Dim x As Integer
        Dim y As Integer
        Dim width As Integer = Piewidth
        Dim height As Integer = Pieheight
        x = (PicBoxWidth - width) / 2    '目前没用
        y = (PicBoxHeight - height) / 2    '计算距离轴起点纵坐标
        Dim StrF As New StringFormat()
        StrF.FormatFlags = StringFormatFlags.DirectionVertical
        MyFormGraphic.DrawString("( 范 围 Km )", New Font("Verdana", 10), Brushes.Blue, 10, 180, StrF)
        For i = 0 To 10 Step 2
            '画距离标尺   上半轴
            Dim startb As New PointF(40, y + height / 2 - i * PicR / 10 - 10)
            MyFormGraphic.DrawString(Convert.ToString(i * PerDis + DisMin), New Font("Verdana", 10), Brushes.Blue, startb)
            '画距离刻度
            Dim start2b As New PointF(80, y + i * PicR / 10)
            Dim end2b As New PointF(89, y + i * PicR / 10)
            MyFormGraphic.DrawLine(BlackPen, start2b, end2b)     '画长刻度
            Dim start2bb As New PointF(84, y + i * PicR / 10 + PicR / 10)
            Dim end2bb As New PointF(89, y + i * PicR / 10 + PicR / 10)
            MyFormGraphic.DrawLine(BlackPen, start2bb, end2bb)     '画短刻度
        Next i

这是什么原因

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题