|
|||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
IntroductionIn this article, I intend to create a The codeThe code is self explanatory. In this Using the ControlAdd the control to any Windows project.. and then call its methods and properties like any other control. Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
gs.Xscale_Max = 10
gs.Yscale_Max = 10
gs.Xscale_units = 1
gs.Yscale_units = 1
gs.showBorder = True
gs.displayUnits = True
gs.fontSize = 6
'gs.MarginX = 10
'gs.MarginY = 40
gs.initializeGraphSheet()
gs.AddPoint(1, 1)
gs.AddPoint(2, 5)
gs.AddPoint(3, 3)
gs.AddPoint(5, 5)
gs.AddPoint(7, 5)
gs.AddPoint(9, 9)
gs.AddPoint(7, 9)
gs.AddPoint(4, 6)
gs.DrawGraph(GraphSheetControl.GraphSheet.PlotType.Curve, _
Color.Blue, False)
'gs.DrawPoint(2, 5, Color.SaddleBrown)
End Sub
.NET and Graphics.NET has definitely made things simple for producing graphics, especially for VB programmers. We had to really be good at mathematics if we had to produce an optimized yet flexible code like this in Visual basic 6.0. One good example is the oG.DrawCurve(New Pen(color.red), PointsArray)
.NET though, hasn't made everything easy for the graphics part of things, for VB programmers at least. Creating a Windows control that would draw itself entirely is not easy, and even if done, not feasible to be used in production.
Why? When? and How?Well, we have Chris Maunder commenting on this article. God, where did I get into...was my first expression on the comment. :) The The control did make the final code well maintainable. I had to just modify code in the control to make offsetting, err handling, etc., possible, and the change took effect on all graphs drawn thereafter. With the To add to all this, since it's a control, I could create an instance dynamically and position it on my project.
|
||||||||||||||||||||||||||||||