Last post Jan 04, 2006 06:16 PM by R100
Jan 03, 2006 04:20 PM|R100|LINK
Jan 04, 2006 06:12 PM|Cal Zant|LINK
This is actually going to require some fairly complex code ... so if you are just a beginner you may want to try to steer clear from it if possible. However, I made a similar class recently in C# so I know it
can be done. And as luck would have it the X axis label is easier than the Y axis label because it doesn't have to be rotated.
As you probably already figured out, you will have to make extensive use System.Drawing Namespace.
You first need to create a Rectangle structure that
will be used to contain and center the axis label. It might look something like this (like I said it is in C#, but the VB.NET code will look very similar):
Rectangle recXAxis = new Rectangle((int)(intWidth * .15), (int)(intHeight * .93), (int)(intWidth * .75), (int)(intHeight * .07));
Then you will need to create a font that will be used to format the label, and also create a StringFormat object that will be used to make the text centered inside the Rectangle:
Font AxisFont = new Font("Arial", 16);
StringFormat FormatCenter = new StringFormat();
FormatCenter.Alignment = StringAlignment.Center;
Then you simply write the label out to the rectangle passing in the various attributes:
objGraphics.DrawString("Label Text", AxisFont, new SolidBrush(Color.Black), recXAxis, FormatCenter);
Hope this helps get you started in the right direction.
Jan 04, 2006 06:16 PM|R100|LINK