BDCC class (drawing the diagram class)

xiaoxiao2021-03-06  55

Imports system.drawing.drawing2dimports system.drawing

Public Class BDCC Private Bmp As Bitmap # Region "Introduction" 'Class Name: BDCC' Class Full Name: Benlee Drawing Chart Class' Class Function: Draw Print Chart (Temporarily join the two-dimensional line chart) 'class version number: 1.0 Bate' Class start writing Date: August 15, 2003 'Class final modification date: August 20, 2003 #END Region

#Region "field" Private mintChartWidth As Integer = 0 'Image Width Private mintChartHeight As Integer = 0' Image Height Private mintContainerWidth As Integer = 0 'container width Private mintContainerHeight As Integer = 0' container height Private mobjContainer As New Object () 'container Private MintChartpercentage as integer = 100 'picture and container percentage

Private mintX_AxisColor As Color = Color.Black 'X axis color Private mintY_AxisColor As Color = Color.Black' Y axis color Private mintX_AxisSize As Integer = 1 'X axis magnitude Private mintY_AxisSize As Integer = 1' Y axis size Private mintX_AxisLength As Integer 'X coordinate axis length Private mintY_AxisLength As Integer' Y coordinate axis length Private mstrX_AxisLabel As String = "time (s)" 'X coordinate axis labeled axis Private mstrY_AxisLabel_1 As String = "speed"' Y of axes labeled _1 Private mstrY_AxisLabel_2 As String = "(km / h)" 'Y coordinate axis labeled axis _2 Private mstrY_axislabel_3 As String = "brake signal"' Y coordinate axis labeled axis _3 Private mblnIsShowAxisLabel As Boolean = True 'is displayed axis scale Private mblnIsShow_X_AxisScale As Boolean = True 'Whether to display X-axis scale Private MBLN Isshow_x_axissecondscale as boolean = true 'Whether the x-axis scale private mblnisshow_y_axisscale as boolean = true' does not display Y-axis scale

Private mintX_axisfirstscale_count as integer = 20 'X coordinate axis main scales number private mintx_axissecondscale_count as integer = 5' X coordinate axis secondary scale

Private mintX_AxisScaleMaxValue As Integer = 100 'X axis scale maximum Private mintY_AxisFirstScale_Count As Integer = 18' Y coordinate axis of the main scale number Private mintY_AxisSecondScale_Count As Integer = 2 'Y axis the number of times a scale Private mintY_AxisScaleMaxValue As Integer = 180' Y coordinate axis scale maximum Private mintX_AxisScaleLength As Integer 'X axis scale length Private mintY_AxisScaleLength As Integer' Y axis scale length Private mintX_AxisFirstScalePerLength As Integer 'X axis unit length of the main scale Private mintY_AxisFirstScalePerLength As Integer' Y axis unit length of the main scale Private mintX_AxisSecondScalePerLength As Integer 'X axis time scale unit length Private mintY_AxisSecondScalePerLength As Integer' Y axis scale unit time length Private mintX_AxisFirstScaleColor As color = Color.Black 'X coordinate axis of the main scale color Private mintY_AxisFirstScaleColor As color = Col or.Black 'Y coordinate axis of the main scale color Private mintX_AxisSecondScaleColor As Color = Color.Black' X axis time scale color Private mintY_AxisSecondScaleColor As Color = Color.Black 'Y axis scale color views Private mblnIsShowX_AxisScaleLabel As Boolean = True' is displayed X A shaft scale label private mblnisshowy_axisscalelabel as boolean = true 'Whether to display Y-axis scale label

Private mintx_axisscalelabelcount as integer = 4 'x coordinate axis display mark tag

Private mintY_AxisScaleLabelCount As Integer = 18 'Y axes show the number of the scale labels Private mintX_AxisScaleLabelColor As Color = Color.Black' X coordinate axis tick label color Private mintY_AxisScaleLabelColor As Color = Color.Black 'Y coordinate axis scale labels color Private mblnIsShowX_AxisSecondLine As boolean = true 'Whether to display the secondary mintx_axissecondLineColor As Color = Color.Black' x axis colors on the X-axis of the X-axis Mint = Color Private Mintx_AxissecondLineCount AS Integer = 4 'X The axis of the axis

Private mblnisshowdataline as boolean = true 'Whether to display data cable private mintDatanelinesize as integer = 1' data cable size Private MintDataLineColor as color = color.red 'data cable color

Private mstrChartTitle As String = "Accident Data doubt curve" 'chart title Private mblnIsShowChartTitle As Boolean = True' whether the chart title Private mfntChartTitleFont As New Font ( "Arial", 9) "graph title font Private mfntChartTitleFontColor As Color = Color.Black ' Chart Title Font Color Private MFNTCHARTTIALIGN As Titlealign = TitleAlign.topcenter 'Chart Title Alignment

Private mblnIsShowChartTitleNote As Boolean = True 'whether to display a chart title comments Private mstrCarNumber As String = "Su BA 000001"' license plate number Private mstrCarClass As String = "large car '' license plate classification Private mstrDriverCardNumber As String =" 320204198006281614 " 'driver's license No. Private mstrStopDate As String = Date.Today.ToString 'parking time Private mfntChartTitleNoteFont As New Font ( "Arial", 9') of the title chart Notes Font Private mfntChartTitleNoteFontColor As color = Color.Black 'comment font color chart titles Private mobjGraphics As Graphics' GDI PRIVATE MOBJPEN AS PEN 'PEN Private MintTopheight AS INTEGER' Top Height

Private MDTCHARTDATA AS New DataTable 'Chart Data Private MdtotherData As New DataTable' Other Data Private MdtopenValue As New DataTable 'Switching Private MstrFileName As String # End Region

#Region "Properties" Public Property Container () As Object Get Return mobjContainer End Get Set (ByVal Value As Object) mobjContainer = Value mintContainerWidth = Value.width mintContainerHeight = Value.height End Set End Property 'container Public Property ChartPercenTage () As Integer Get Return mintChartPercenTage End Get Set (ByVal Value As Integer) If Value> = 0 And Value <= 100 Then mintChartPercenTage = Value Else Throw New ArgumentException ( "percentage of data is not correct!") mintChartPercenTage = 100 End If End Set End Property 'Photos With container percentage Property Chartwidth () AS Integer Get Return Cint (MintContainerWidth * MintChartPERCentage / 100) End Get Property 'Picture Width Public Readonly Property ChartHEight () AS Integer Get Return Cint (MintContainerHeight * MintChartPERCentage / 100) End Get End Property 'Picture Height

Public Property X_AxisColor () As Color Get Return mintX_AxisColor End Get Set (ByVal Value As Color) mintX_AxisColor = Value End Set End Property 'X axis color Public Property Y_AxisColor () As Color Get Return mintY_AxisColor End Get Set (ByVal Value As Color) mintY_AxisColor = Value End Set End Property 'Y axes color Public Property X_AxisSize () As Integer Get Return mintX_AxisSize End Get Set (ByVal Value As Integer) If Value> 0 And Value <= 5 Then mintX_AxisSize = Value Else Throw New ArgumentException ( " The axis size must be between 1 to 5! ") Mintx_axissize = 1 End IFEND SET End Property 'X Card Size Public Property Y_axissize () AS INTEGER GET RETURN MINTY_AXISSIZE END GET SET (BYVA l value as integer) if value> 0 and value <= 5 damty_axissize = value else throw new argumentException ("The axis size must be between 1 to 5! ") MintY_AxisSize = 1 End If End Set End Property 'Y axis magnitude Public Property IsShowAxisLabel () As Boolean Get Return mblnIsShowAxisLabel End Get Set (ByVal Value As Boolean) mblnIsShowAxisLabel = Value End Set End Property' is displayed axis scale

Public Property X_AxisFirstScale_Count () As Integer Get Return mintX_AxisFirstScale_Count End Get Set (ByVal Value As Integer) mintX_AxisFirstScale_Count = Value End Set End Property 'number of X-coordinate axis of the main scale Public Property X_AxisSecondScale_Count () As Integer Get Return mintX_AxisSecondScale_Count End Get Set (ByVal Value As Integer) mintX_AxisSecondScale_Count = Value End Set End Property 'number of X-coordinate axis scale views Public Property Y_AxisFirstScale_Count () As Integer Get Return mintY_AxisFirstScale_Count End Get Set (ByVal Value As Integer) mintY_AxisFirstScale_Count = Value End Set End Property' Y coordinate axis of the main scale PUBLIC PROPERTY Y_AXISSECONDSCALE_COUNT () AS INTEGER GET RETURN MINTY_AXISSECONDSCALE_COUNT END GET (BYVAL VALUE AS INTEGER) MINTY_AXISSECONDSCALE_COUNT = Value End Set End Property 'Y times the number of tick-axis coordinate Public ReadOnly Property X_AxisScaleLength () As Integer Get Return mintX_AxisScaleLength End Get End Property' X axis scale length Public Property X_AxisScaleMaxValue () As Integer Get Return mintX_AxisScaleMaxValue End Get Set (ByVal Value AS integer) mintx_axisscaleMaxValue = value End set End Property 'x coordinate axis scale Maximum PUBLIC READONLICELY Property y_axisscalength () AS INTEGER GET RETURN MINTY_AXISSCALELENGTH End Get Property'

Y axis scale length Public Property Y_AxisScaleMaxValue () As Integer Get Return mintY_AxisScaleMaxValue End Get Set (ByVal Value As Integer) mintY_AxisScaleMaxValue = Value End Set End Property 'Y axis scale maximum Public ReadOnly Property X_AxisFirstScalePerLength () As Integer Get Return mintX_AxisFirstScalePerLength End Get End Property 'X coordinate axis of the main scale unit length Public ReadOnly Property Y_AxisFirstScalePerLength () As Integer Get Return mintY_AxisFirstScalePerLength End Get End Property' Y coordinate axis of the main scale unit length Public ReadOnly Property X_AxisSecondScalePerLength () As Integer Get Return mintX_AxisSecondScalePerLength End Get End Property ' X coordinate axis minus unit length Public Readonly Property y_axissecondscaleperLength () AS INTEGER GET RETURN MINTY_AXISSECONDSCALEPERLENGTY END GET End Property 'y coordinate axis times Scale Unit PUBLIC Property X_AXISFIRS tScaleColor () As Color Get Return mintX_AxisFirstScaleColor End Get Set (ByVal Value As Color) mintX_AxisFirstScaleColor = Value End Set End Property 'X coordinate axis of the main scale color Public Property Y_AxisFirstScaleColor () As Color Get Return mintY_AxisFirstScaleColor End Get Set (ByVal Value As Color) mintY_AxisFirstScaleColor = Value End Set End Property 'Y coordinate axis of the main scale color Public Property X_AxisSecondScaleColor () As color Get Return mintX_AxisSecondScaleColor End Get Set (ByVal Value As color) mintX_AxisSecondScaleColor =

Value End Set End Property 'X axis time scale color Public Property Y_AxisSecondScaleColor () As Color Get Return mintY_AxisSecondScaleColor End Get Set (ByVal Value As Color) mintY_AxisSecondScaleColor = Value End Set End Property' Y axis views scale color

Public Property IsShowX_AxisScaleLabel () As Boolean Get Return mblnIsShowX_AxisScaleLabel End Get Set (ByVal Value As Boolean) mblnIsShowX_AxisScaleLabel = Value End Set End Property 'for an X-axis scale labels Public Property IsShowY_AxisScaleLabel () As Boolean Get Return mblnIsShowY_AxisScaleLabel End Get Set (ByVal Value As Boolean) mblnIsShowY_AxisScaleLabel = Value End Set End Property 'whether the Y-axis scale labels Public Property IsShow_X_AxisSecondScale () As Boolean Get Return mblnIsShow_X_AxisSecondScale End Get Set (ByVal Value As Boolean) mblnIsShow_X_AxisSecondScale = Value End Set End Property' for an X-axis time scale Public Property X_AXISSCALELABELCOUNT () AS INTEGER GET RETURN MINTX_AXISSCALELABELCOUNT END GET SET (BYVAL VALUE AS INTEGER IF ((Mintx_Axisfirstscale_cou) NT * mintx_axissecondscale_count) MOD Value) = 0 Then mintx_axisscalelabelcount = value else throw new ArgumentException ("The scale label is incorrect! ") MintX_AxisScaleLabelCount = 4 End If End Set End Property 'X axes show the number of the scale labels Public Property Y_AxisScaleLabelCount () As Integer Get Return mintY_AxisScaleLabelCount End Get Set (ByVal Value As Integer) If ((mintY_AxisFirstScale_Count * mintY_AxisSecondScale_Count) Mod Value) = 0 damty_axisscalelabelcount = value else throw new argumentException ("The scale tag is incorrect!

") MintY_AxisScaleLabelCount = 4 End If End Set End Property 'Y axes show the number of the scale labels Public Property X_AxisScaleLabelColor () As Color Get Return mintX_AxisScaleLabelColor End Get Set (ByVal Value As Color) mintX_AxisScaleLabelColor = Value End Set End Property' X coordinate axis scale labels color Public Property Y_AxisScaleLabelColor () As color Get Return mintY_AxisScaleLabelColor End Get Set (ByVal Value As color) mintY_AxisScaleLabelColor = Value End Set End Property 'Y coordinate axis scale labels color

Public Property IsShowX_AxisSecondLine () As Boolean Get Return mblnIsShowX_AxisSecondLine End Get Set (ByVal Value As Boolean) mblnIsShowX_AxisSecondLine = Value End Set End Property 'times whether the axis X coordinate axis Public Property X_AxisSecondLineColor () As Color Get Return mintX_AxisSecondLineColor End Get Set ( ByVal Value As color) mintX_AxisSecondLineColor = Value End Set End Property 'secondary axis color X coordinate axis Public Property X_AxisSecondLineCount () As Integer Get Return mintX_AxisSecondLineCount End Get Set (ByVal Value As Integer) If (mintX_AxisFirstScale_Count * mintX_AxisSecondScale_Count) Mod mintX_AxisSecondLineCount = 0 The mintx_axissecondLineCount = value else throw new argumentException ("The number of times must be taken in total!") Mintx_AxissecondLineCount = mintx_axisfirstscale_count END IF End Set End Property Axis of the Subject Shaft

Public Property IsShowDataLine () As Boolean Get Return mblnIsShowDataLine End Get Set (ByVal Value As Boolean) mblnIsShowDataLine = Value End Set End Property 'whether data line Public Property DataLineSize () As Integer Get Return mintDataLineSize End Get Set (ByVal Value As Integer) mintDataLineSize = Value End Set End Property 'data line size Public Property DataLineColor () As color Get Return mintDataLineColor End Get Set (ByVal Value As color) mintDataLineColor = Value End Set End Property' data line color Public Property ChartTitle () As String Get Return MSTRCHARTTITLE END GET SET (BYVAL VALUE AS STRING) MSTRCHARTTITLE = VALUE END SET End Property 'Chart Title Public Property IsshowchartTitle () A s Boolean Get Return mblnIsShowChartTitle End Get Set (ByVal Value As Boolean) mblnIsShowChartTitle = Value End Set End Property 'whether the chart title Public Property ChartTitleFont () As Font Get Return mfntChartTitleFont End Get Set (ByVal Value As Font) If (Value.SizeInPoints > 0) and (value.sizeinpoints <= 15) THEN MFNTCHARTTITLEFONT = VALUE ELSE thROW New ArgumentException ("The title font size must be between 1 and 15! ") MFNTCHARTTITLEFONT = New font (" Song ", 9) end if

End Set End Property 'Chart title font Public Property ChartTitleFontColor () As Color Get Return mfntChartTitleFontColor End Get Set (ByVal Value As Color) mfntChartTitleFontColor = Value End Set End Property' Chart title font color Public Property ChartTitleAlign () As TitleAlign Get Return mfntChartTitleAlign End Get set (byval value as titlealign) mfntcharttitaryalign = value end vendy 'chart title alignment

Public Property IsShowChartTitleNote () As Boolean Get Return mblnIsShowChartTitleNote End Get Set (ByVal Value As Boolean) mblnIsShowChartTitleNote = Value End Set End Property 'whether the chart title Note Public Property CarNumber () As String Get Return mstrCarNumber End Get Set (ByVal Value As String ) mstrCarNumber = Value End Set End Property 'license plate number Public Property CarClass () As String Get Return mstrCarClass End Get Set (ByVal Value As String) mstrCarClass = Value End Set End Property' license classification Public Property DriverCardNumber () As String Get Return mstrDriverCardNumber End get set (byval value as string) mstrivercardnumber = value end vendy 'driver's license number public property stopdat e () As String Get Return mstrStopDate End Get Set (ByVal Value As String) mstrStopDate = Value End Set End Property 'parking time Public Property ChartTitleNoteFont () As Font Get Return mfntChartTitleNoteFont End Get Set (ByVal Value As Font) If (Value. SizeinPoints> 0) and (value.sizeinpoints <= 15) THEN MFNTCHARTTILENOTEFONT = VALUE ELSE thROW New ArgumentException ("The title font size must be between 1 and 15! ") MFNTCHARTTITLENOTEFONT = New Font (" Song "

, 9) End If End Set End Property 'Chart title Note Font Public Property ChartTitleNoteFontColor () As Color Get Return mfntChartTitleNoteFontColor End Get Set (ByVal Value As Color) mfntChartTitleNoteFontColor = Value End Set End Property' Chart title comment font color Public ReadOnly Property Graphics () AS Graphics Get Return MobjGraphics End Get Property 'GDI PUBLIC READONLY Property FileName () AS STRING GET RETURN MSTRFILENAME END GET End Property' file name #END Region

#Region "Structure"

#End region

#Region "enumeration" public enum title = 2 butTomLDLELEFT = 2 ButtomLeft = 3 TopCenter = 4 MiddleCenter = 5 Buttomcenter = 6 TOPRIGHT = 7 Middleright = 8 Buttomright = 9 End Enum 'Alignment #END Region

#REGION "Event"

#End region

#Region "Method" Private sub new () TRY

Catch exception main.errMessage = new frMerrMessage ("The program has an exception, it is not possible!" DataTable, ByVal otherdata As DataTable, ByVal OpenValue As DataTable) Me.New () Try mdtChartData = tempdata.Copy 'data lines mdtOpenValue = OpenValue.Copy mdtOtherData = otherdata' other relevant data Catch ex As Exception main.errmessage = New frmerrmessage ( " The program has an abnormality, and it is not possible to run! "," Error code: A00033 ") main.errMessage.showdialog () end end sub 'constructor (with parameters, parameter) Public Sub New (Byval array_1 as arraylist, byval Array_2 as arraylist) 'Adds the code of the number of sets of data tables. Try

Catch exception main.errMessage = new frMerrMessage ("The program has an exception, it is not possible!" ) Public Sub DrawChart_2D_XY () Try 'Dim b As Image bmp = New Bitmap (mintContainerWidth, mintContainerHeight) Graphics.FromImage (bmp) .Clear (Color.White)' Dim i, j As Integer 'For i = 0 To bmp.Width - 1 'for j = 0 to bmp.height - 1' if bmp.getpixel (i, j) .black.toString () = color.black.toString the 'Bmp.Setpixel (i, j, color.white)' Endiff 'next' Next 'If the chart title drawchart_2d_xy_title (graphics.fromimage (bmp))' DRAWCHART_2D_XY_TITLE (MobjContainer.creategraphics) endiff

If mblnIsShowChartTitleNote Then 'if the chart title DrawChart_2D_XY_TitleNote comment display (Graphics.FromImage (bmp))' DrawChart_2D_XY_TitleNote (mobjContainer.CreateGraphics) End If DrawChart_2D_XY_Axis_XY (Graphics.FromImage (bmp)) 'DrawChart_2D_XY_Axis_XY (mobjContainer.CreateGraphics) If mblnIsShowAxisLabel Then' If the coordinates axis scale DrawChart_2D_XY_AxisLabel (Graphics.FromImage (bmp)) 'DrawChart_2D_XY_AxisLabel (mobjContainer.CreateGraphics) End If If mblnIsShow_X_AxisScale Then' if the X-axis scale DrawChart_2D_XY_X_AxisScale display (Graphics.FromImage (bmp)) 'DrawChart_2D_XY_X_AxisScale (mobjContainer.CreateGraphics) End If If mblnIsShow_Y_AxisScale Then 'If you display Y-axis scale Drawchart_2D_XY_Y_AXISSCALE (Graphics.FromImage (BMP))' DRAWCHART_2D_XY_Y_AXISSCALE (MobjContainer.createGra phics) End If If mblnIsShowX_AxisSecondLine Then DrawChart_2D_XY_X_AxisSecondLine (mobjContainer.CreateGraphics) End If If mblnIsShowX_AxisScaleLabel Then '' if the next axis DrawChart_2D_XY_X_AxisSecondLine X axis (Graphics.FromImage (bmp)) show 'if DrawChart_2D_XY_X_AxisScaleLabel X-axis scale labels display (Graphics. FromImage (bmp)) 'DrawChart_2D_XY_X_AxisScaleLabel (mobjContainer.CreateGraphics) End If If mblnIsShowY_AxisScaleLabel Then' if DrawChart_2D_XY_Y_AxisScaleLabel Y-axis scale labels display (Graphics.FromImage (bmp)) '

DrawChart_2D_XY_Y_AxisScaleLabel (mobjContainer.CreateGraphics) End If If mblnIsShowDataLine Then 'if the data lines DrawChart_2D_XY_DataLine (Graphics.FromImage (bmp))' DrawChart_2D_XY_DataLine (mobjContainer.CreateGraphics) End If If Not (mdtOtherData Is Nothing) Then 'If there are other data DrawChart_2D_XY_DataLine_OtherData (Graphics .FromImage (bmp)) 'DrawChart_2D_XY_DataLine_OtherData (mobjContainer.CreateGraphics) End Ifmstrfilename = Date.Now.Year & "_" & Date.Now.Month & "_" & Date.Now.Day & "_" & Date.Now. Hour & "_" & date.now.second mstrfilename = Application.startuppath & "/ picture /" & mstrfilename & ".jpeg" if Dir (Application.Startuppath & "/ Picture" , FileAttribute.directory) <> "picture" the system.io.directory.createdirectory (Application.Startuppath & "Picture") End if Bmp.sAV e (MStrFileName, System.drawing.Imaging.ImageFormat.jpeg)

Catch exception main.errMessage = new frMerrMessage ("The program has an exception, it is not possible to run!", "Error code: A00035") main.errMessage.showdialog () End Try End Sub 'draws two-dimensional fold line diagram private sub drawchart_2d_xy_title ByVal TempGraphics As Graphics) Try Dim X, Y As Integer 'coordinates X, Y Dim TopHeight As Integer' top height mobjGraphics = TempGraphics Select Case mfntChartTitleAlign Case TitleAlign.TopLeft X = 5 Y = 5 Case TitleAlign.TopCenter X = CInt ((mobjContainer .width / 2) - ((MSTRCHARTTILE.LENGTH / 2) * (MFNTCHARTTILEFONT.SIZE * 1.4))))))) Y = 5 case titlealign.topright x = mobjcontainer.width - 5 y = 5 case titlealign.middleleft x = 5 Y = CINT (MobjContainer.Height / 2) - (MFNTCHARTTILEFONT.HEIGHT * 1.4 / 2)) Case titlealign.middleCenter x = CINT ((MobjContainer.width / 2) - (MSTRCHARTTITLE.LENGTH / 2) * (MFNTCHARTTITLOONT. Size * 1.4)))) Y = CINT ((MobjContainer.Height / 2) - (mFntcharttitlefont.Height * 1.4 / 2)) Case titlealign.middleright x = (MobjContainer.Width - 5) y = cint ((MobjContainer.Height / 2) - (mfntcharttitlefont.height * 1.4 / 2)) Case titleAlign.ButTomLT X = 5 y =

(Mobjcontainer.Height - 5) Case titleAlign.ButTomcenter x = ((MOBJCONTAINER.WIDTH / 2) - (MFNTCHARTTILE.LENGTH / 2) * (MFNTCHARTTILEFONT.SIZE * 1.4))))))))) Y = (MobjContainer.Height - 5) Case TitleAlign.ButtomRight X = (mobjContainer.width - 5) Y = (mobjContainer.height - 5) End Select mobjGraphics.DrawString (mstrChartTitle, mfntChartTitleFont, New SolidBrush (mfntChartTitleFontColor), X, Y) Catch ex As Exception main.errmessage = New frmerrmessage ( "program exception occurs, can not function properly!", "error code: A00036") main.errmessage.ShowDialog () End Try End Sub 'draw the chart title Private Sub DrawChart_2D_XY_TitleNote (ByVal TempGraphics As Graphics) Try Dim X_1, Y_1, X_2, y_2 AS INTEGER DIM TOPHEIGHT AS INTEGER 'Top Height Dim Noteline_1, Noteline_2 AS StringNoteline_1 = "License plate number:" & MST Rcarnumber & "License Category:" & MSTRCARCLASS NOTELINE_2 = "Driving Dedication No .:" & MSTRDRIVERCARDNUMBER & "Parking time:" & mstrstopdate

Mobjgraphics = Tempgraphics

TopHeight = 5 (mfntChartTitleFont.Height) X_1 = CInt ((mobjContainer.width / 2) - ((noteline_1.Length / 2) * (mfntChartTitleNoteFont.Size * 1.4))) Y_1 = CInt (TopHeight mfntChartTitleNoteFont.Height / 2 ) MobjGraphics.drawstring (Noteline_1, MFNTCHARTLENOTEFONT, New Solidbrush (MfntcharttitlenoteFontColor), X_1, Y_1)

TopHeight = 5 (mfntChartTitleFont.Height) (mfntChartTitleNoteFont.Height) X_2 = mobjContainer.width - noteline_2.Length * mfntChartTitleNoteFont.Size * 1.25 'X_2 = CInt ((mobjContainer.width / 2) - ((noteline_2.Length / 2 ) * (mfntChartTitleNoteFont.Size * 1.4))) Y_2 = CInt (TopHeight mfntChartTitleNoteFont.Height / 2) mobjGraphics.DrawString (noteline_2, mfntChartTitleNoteFont, New SolidBrush (mfntChartTitleNoteFontColor), X_2, Y_2) Catch ex As Exception main.errmessage = New frmerrmessage ( "program exception occurs, can not function properly!", "error code: A00037") main.errmessage.ShowDialog () End Try End Sub 'charting comments Private Sub DrawChart_2D_XY_Axis_XY (ByVal TempGraphics As Graphics) Try Dim X_1, Y_1, X_2, y_2 AS INTEGER 'Coordinate axis two points Coordinate DIM POINT_1, POINT_2, POINT_3 AS Point' Coordinate Dim TrigonPoint as Point () 'trigonpoint as point ()' triangle Sittar Set DIM NE wFillMode As FillMode = FillMode.Winding 'fill mode mintTopHeight = 5 If mblnIsShowChartTitle Then' if the chart title mintTopHeight = (mfntChartTitleFont.Height) End If If mblnIsShowChartTitleNote Then 'if the chart title display the comment display mintTopHeight = (mfntChartTitleNoteFont.Height) * 2 END IF

Mobjpen = new pen (mintx_axiscolor, mintx_axissize) mobjgraphics = Tempgraphics

'Y-axis plotted X_1 = 70 Y_1 = mintTopHeight 30 X_2 = 70 Y_2 = mobjContainer.height - 10 mintX_AxisLength = Y_2 - Y_1' Y-axis length recording mobjGraphics.DrawLine (mobjPen, X_1, Y_1, X_2, Y_2) 'Y-axis plotted Top triangle Point_1 = new point (x_1, y_1 25) Point_2 = new point (x_1 - 4, y_1 45) Point_3 = new point (x_1 4, y_1 45) TrigonPoint = New Point () {Point_1, Point_2, Point_3} MobjGraphics.FillPolygon (New Solidbrush (Mintx_Axiscolor), TrigonPoint

'Draw X-axis x_1 = 30 y_1 = mobjcontainer.Height - 30 x_2 = mobjcontainer.width - 50 y_2 = mobjcontainer.Height - 30 MobjGraphics.drawline (mobjpen, x_1, y_1, x_2, y_2)

'Draw X-axis top triangles Point_1 = new point (x_2 5, y_2) Point_2 = new point (x_2 - 15, y_2 - 4) Point_3 = new point (x_2 - 15, y_2 4) TrigonPoint = New Point () { Point_1, Point_2, Point_3} MobjGraphics.FillPolygon (New Solidbrush (Mintx_Axiscolor), TrigonPoint

'Draw the coordinate origin 0 X_1 = 56 Y_1 = mobjContainer.height - 26 mobjGraphics.DrawString ( "0", New Font ( "Arial", 9), New SolidBrush (mintX_AxisColor), X_1, Y_1) Catch ex As Exception main.errmessage = New FRMERRMESSAGE ("The program has an abnormality, not working properly!", "Error code: A00038") main.errmessage.showdialog () End Try

End Sub 'Draw Coordinate PRIVATE SUB DRAWCHART_2D_XY_AXISLABEL (Byval Tempgraphics AS Graphics) Try Dim x_1, y_1 as integermobjGraphics = Tempgraphics

'Draw X-axis Space X_1 = MobjContainer.width - 80 y_1 = Mobjcontainer.Height - 22 MobjGraphics.drawstring (MSTRX_AXISLABEL, New Font ("Song", 9), New Solidbrush (Mintx_Axiscolor), X_1, Y_1)

'Draw Y-axis axis_1 x_1 = 30 y_1 = MINTTOPHEIGHT 55 MOBJGRAPHICS.DRAWSTRING (MSTRY_AXISLABEL_1, New FONT ("Song", 9), New Solidbrush (Mintx_Axiscolor), X_1, Y_1)

'Draw Y-axis axis _2 x_1 = 10 y_1 = MINTTTOPHEIGHT 70 MOBJGRAPHICS.DRAWSTRING (MSTRY_AXISLABEL_2, New FONT ("Song", 9), New Solidbrush (Mintx_Axiscolor), X_1, Y_1)

'Y plotted shaft standard _3 X_1 = 10 Y_1 = mintTopHeight 35 mobjGraphics.DrawString (mstrY_axislabel_3, New Font ( "Arial", 9), New SolidBrush (mintX_AxisColor), X_1, Y_1) Catch ex As Exception main.errmessage = New frmerrmessage ( "program exception occurs, can not function properly!", "error code: A00039") main.errmessage.ShowDialog () End Try End Sub 'drawing of axes marked Private Sub DrawChart_2D_XY_X_AxisScale (ByVal TempGraphics As Graphics) Try Dim X_1 , Y_1, x_2, y_2 AS INTEGER DIM iLOOP AS INTEGER

Mobjgraphics = Tempgraphics

mintX_AxisScaleLength = mobjContainer.width - 85 - 70 mintX_AxisSecondScalePerLength = mintX_AxisScaleLength / (mintX_AxisFirstScale_Count * mintX_AxisSecondScale_Count) 'times the length of the scale unit axis length = X / (the number of times the main scale number * scale) mintX_AxisFirstScalePerLength = mintX_AxisSecondScalePerLength * mintX_AxisSecondScale_Count' main scale unit length = subscale * number of times per unit length scale X_1 = 70 Y_1 = mobjContainer.height - 30 X_2 = 70 Y_2 = mobjContainer.height - 20For iLoop = 1 To mintX_AxisFirstScale_Count * mintX_AxisSecondScale_Count X_1 = mintX_AxisSecondScalePerLength X_2 = X_1 If iLoop Mod mintX_AxisSecondScale_Count = 0 Then mobjGraphics.DrawLine (New Pen (mintX_AxisFirstScaleColor), X_1, Y_1, X_2, Y_2) Else If mblnIsShow_X_AxisSecondScale Then mobjGraphics.DrawLine (New Pen (mintX_AxisSecondScaleColor), X_1, Y_1, X_2, Y_2 - 5) End if end if next catch exception main.errMessage = new frMerrMessage ("The program has an exception, and it is not possible to run normally! "," Error code: A00040 ") main.errmessage.ShowDialog () End Try End Sub 'drawing axis X Scale Private Sub DrawChart_2D_XY_Y_AxisScale (ByVal TempGraphics As Graphics) Try Dim X_1, Y_1, X_2, Y_2 As Integer Dim iLoop As Integer

Mobjgraphics = Tempgraphics

mintY_AxisScaleLength = (mobjContainer.height - 30) - (mintTopHeight 90) mintY_AxisSecondScalePerLength = mintY_AxisScaleLength / (mintY_AxisFirstScale_Count * mintY_AxisSecondScale_Count) mintY_AxisFirstScalePerLength = mintY_AxisSecondScalePerLength * mintY_AxisSecondScale_CountX_1 = 60 Y_1 = mobjContainer.height - 30 X_2 = 70 Y_2 = mobjContainer.height - 30

For iLoop = 1 To mintY_AxisFirstScale_Count * mintY_AxisSecondScale_Count Y_1 - = mintY_AxisSecondScalePerLength Y_2 = Y_1 If iLoop Mod mintY_AxisSecondScale_Count = 0 Then mobjGraphics.DrawLine (New Pen (mintY_AxisFirstScaleColor), X_1, Y_1, X_2, Y_2) Else mobjGraphics.DrawLine (New Pen (mintY_AxisSecondScaleColor) , X_1 5, y_1, x_2, y_2) end if next catch exception main.errMessage = new frMerrMessage End Try End Sub 'drawing axis Y scale Private Sub DrawChart_2D_XY_X_AxisSecondLine (ByVal TempGraphics As Graphics) Try Dim X_1, Y_1, X_2, Y_2 As Integer Dim iLoop As Integer Dim PerLength As Integer

Mobjgraphics = Tempgraphics

mobjPen = New Pen (mintX_AxisSecondLineColor) mobjPen.DashStyle = DashStyle.DashDot PerLength = (mintX_AxisFirstScale_Count * mintX_AxisSecondScale_Count / mintX_AxisSecondLineCount) * mintX_AxisSecondScalePerLength

X_1 = 70 Y_1 = mintTopHeight 30 X_2 = 70 Y_2 = mobjContainer.height - 30For iLoop = 1 To mintX_AxisSecondLineCount X_1 = PerLength X_2 = X_1 mobjGraphics.DrawLine (mobjPen, X_1, Y_1, X_2, Y_2) Next Catch ex As Exception main .errMessage = new frMerrMessage ("The program has an exception, it is not working!" Tempgraphics as graphics) TRY DIM X_1, Y_1 AS INTEGER DIM ILOOP AS INTEGER DIM PerlegTH AS INTEGER

MobjGraphics = Tempgraphics Perlength = (MINTX_AXISFIRSCALE_COUNT * MINTX_AXISSECONDSCALE_COUNT / MINTX_AXISSCALELABELCOUNT) * MINTX_AXISSECONDSCALEPEREPERLENGTH - 2

X_1 = 70 Y_1 = mobjContainer.height - 20 For iLoop = 1 To mintX_AxisScaleLabelCount X_1 = PerLength mobjGraphics.DrawString (iLoop * (mintX_AxisFirstScale_Count / mintX_AxisScaleLabelCount), New Font ( "Arial", 9), New SolidBrush (mintX_AxisScaleLabelColor), X_1, Y_1) Next Catch Exception Main.errMessage = New FrMerrMessage ("The program has an exception, it is not possible to run!", "Error code: A00043") main.errMessage.showdialog () End Try End Sub 'Draw the scale on the X-axis label Private Sub DrawChart_2D_XY_Y_AxisScaleLabel (ByVal TempGraphics As Graphics) Try Dim X_1, Y_1 As Integer Dim iLoop As Integer Dim PerLength As IntegermobjGraphics = TempGraphics PerLength = (mintX_AxisFirstScale_Count * mintY_AxisSecondScale_Count / mintY_AxisScaleLabelCount) * mintY_AxisSecondScalePerLength

X_1 = 30 Y_1 = mobjContainer.height - 34 For iLoop = 1 To mintY_AxisScaleLabelCount Y_1 - = PerLength mobjGraphics.DrawString (iLoop * (mintY_AxisFirstScale_Count / mintY_AxisScaleLabelCount) * 10, New Font ( "Arial", 9), New SolidBrush (mintY_AxisScaleLabelColor), X_1, y_1) Next catch exception main.errMessage = new frMerrMessage ("The program has an exception, not working properly!", "Error code: A00044") main.errMessage.showdialog () End Try

End Sub 'plotted on the Y axis scale labels Private Sub DrawChart_2D_XY_DataLine (ByVal TempGraphics As Graphics) Try Dim X_1, Y_1, X_2, Y_2, X_3, Y_3, X_4, Y_4 As Integer Dim iLoop_1, iLoop_2 As IntegermobjGraphics = TempGraphics

For iLOOP_1 = 0 to mdtchartdata.rows.count - 2 if iLOOP_1> Mint * mintx_axissecale_count * mintx_axissecondscale_count the 'When the total number of X-axis scale, end draw exit for end if' ------------------------------------------------------ -------------------------------------------------- ------------------------ 'Here is to make up for the first data to fall on the Y-axis, so the data is shifted to a unit. Using the first element on the y-axis to fill if iLOOP_1 = 0 Then for iLOOP_2 = 0 to MDTCHARTDATA.COLUMNS.COUNT - 1 x_1 = 70 (iLOOP_1) * mintx_axissecondscalePerlength

If mdtChartData.Rows (iLoop_1) .Item (iLoop_2)> mintY_AxisScaleMaxValue Then Y_1 = mobjContainer.height - 30 - mintY_AxisSecondScale_Count * mintY_AxisFirstScale_Count * mintY_AxisSecondScalePerLength - 10 ElseIf mdtChartData.Rows (iLoop_1) .Item (iLoop_2) <0 Then Y_1 = 0 Else Y_1 = mobjContainer.height - 30 - mdtChartData.Rows (iLoop_1) .Item (iLoop_2) * mintY_AxisSecondScalePerLength / (mintY_AxisScaleMaxValue / (mintY_AxisFirstScale_Count * mintY_AxisSecondScale_Count)) End If

X_2 = 70 (iLOOP_1 1) * mintx_axissecondscalePerLength Y_2 = Y_1

ILOOP_2 MOD 2 = 0 THEN MOBJGRAPHICS.DRAWLINE (New Pen (MintDataLineColor), X_1, Y_1, X_2, Y_2) Else MobjGraphics.drawline (New Pen (Color.Blue), x_1, y_1, x_2, y_2) end if next end IF '------------------------------------------------ -------------------------------------------- for iLOOP_2 = 0 To mdtChartData.Columns.Count - 1 X_1 = 70 (iLoop_1 1) * mintX_AxisSecondScalePerLengthIf mdtChartData.Rows (iLoop_1) .Item (iLoop_2)> mintY_AxisScaleMaxValue Then Y_1 = mobjContainer.height - 30 - mintY_AxisSecondScale_Count * mintY_AxisFirstScale_Count * mintY_AxisSecondScalePerLength - 10 ElseIf mdtChartData .ROWS (iLOOP_1) .Item (iLOOP_2) <0 THEN Y_1 = 0 else y_1 = mobjcontainer.Height - 30 - MDTChartData.Row S (iLOOP_1) .Item (iLOOP_2) * MINTY_AXISSECONDSCALEPERLENGTH / (minty_axisscalemaxvalue / (minty_axisfirstscale_count * minty_axissecondscale_count) endiff

X_2 = 70 (iLOOP_1 2) * Mintx_AxissecondscalePerLength

If mdtChartData.Rows (iLoop_1 1) .Item (iLoop_2)> mintY_AxisScaleMaxValue Then Y_1 = mobjContainer.height - 30 - mintY_AxisSecondScale_Count * mintY_AxisFirstScale_Count * mintY_AxisSecondScalePerLength - 10 ElseIf mdtChartData.Rows (iLoop_1 1) .Item (iLoop_2) <0 Then Y_2 = 0 Else Y_2 = mobjContainer.height - 30 - mdtChartData.Rows (iLoop_1 1) .Item (iLoop_2) * mintY_AxisSecondScalePerLength / (mintY_AxisScaleMaxValue / (mintY_AxisFirstScale_Count * mintY_AxisSecondScale_Count)) End If

If iLOOP_2 MOD 2 = 0 THEN MOBJGRAPHICS.DRAWLINE (New Pen (MintDataLineColor, 1), X_1, Y_1, X_2, Y_2) IF MDTopenValue.Rows (iLOOP_1) (0) = " " Then 'here is brake signal x_3 = 70 (iLoop_1 1) * mintX_AxisSecondScalePerLength Y_3 = mintTopHeight 40 X_4 = 70 (iLoop_1 2) * mintX_AxisSecondScalePerLength Y_4 = Y_3 'here Videos braking signal mobjGraphics.DrawLine (New Pen (Color.Black), X_3 , Y_3, x_4, y_4) end if else mobjgraphics.drawline (New Pen (color.blue), x_1, y_1, x_2, y_2) end if next next catch exception main.errMessage = new frMerrMessage ("program exception, Unable to run! "," Error code: A00045 ") Main.errMessage.showdialog () End Try End Sub 'Draw Chart Data Cord Private Sub Drawchart_2D_XY_DATALINE_OTHERDATA (Byval Tempgraphics As Graphics) TRY

Catch exception main.errMessage = new frMerrMessage ("The program has an exception, it is not possible to run!" Sub DrawChart_2D_XY_Print (ByVal ParaGraphics As Graphics) Try mobjGraphics = ParaGraphics If mblnIsShowChartTitle Then 'if the chart title DrawChart_2D_XY_Title (mobjGraphics) End If If mblnIsShowChartTitleNote Then display' if chart title comment DrawChart_2D_XY_TitleNote display (mobjGraphics) End If DrawChart_2D_XY_Axis_XY (mobjGraphics) If mblnIsShowAxisLabel Then 'if Display coordinate marking DRAWCHART_2D_XY_AXISLABEL (MobjGraphics) end if if mblnisshow_x_axisscale dam If the x-axis scale Drawchart_2D_XY_X_AXISSCALE (MobjGraphics) end if if mblnisshow_y_axisscale life ' If the Y-axis scale display DrawChart_2D_XY_Y_AxisScale (mobjGraphics) End If If mblnIsShowX_AxisSecondLine Then 'if the next axis DrawChart_2D_XY_X_AxisSecondLine X-axis (mobjGraphics) End If If mblnIsShowX_AxisScaleLabel Then display "If the X-axis scale labels DrawChart_2D_XY_X_AxisScaleLabel (mobjGraphics) End If If mblnIsShowY_AxisScaleLabel Then 'If you display the scale tag on the Y-axis Drawchart_2D_XY_Y_AXISSCALABEL (MobjGraphics) End if MblnisshowDataline Then'

If the data lines DrawChart_2D_XY_DataLine (mobjGraphics) End If Catch ex As Exception main.errmessage = New frmerrmessage display ( "program exception occurs, can not function properly!", "Error code: A00047") main.errmessage.ShowDialog () End TryEnd Sub ' Printing two-dimensional fold line map #END Region

END CLASS

转载请注明原文地址:https://www.9cbs.com/read-115250.html

New Post(0)