I'm a huge fan of creating centralized, reusable libraries for any project, be it flash, php, or whatever, so I'd like to make a lib for some common functions I do in VB, and the one I like using so far is centering the Form on the screen when it starts. Problem is, I'm not sure how to reference them (in code) just yet...
But here's my Logic
I know how to reference this in other projects, but I don't know exactly how to get it set up to how I want. I'd assume it would go something like this:
But I'm not sure exactly how to reference this all correctly with the namespaces, Public vs. Shared stuff, and the like. Also, how would I create an Enum (or something comparable) so when I go to put something in constValue the intellisense gives me only the ReadOnly's I've declared?
But here's my Logic
VB.NET:
Imports System.Drawing
Imports System.Windows.Forms
Namespace Common
Public Class Location
Shared ReadOnly Screen As Rectangle = My.Computer.Screen.WorkingArea
Shared ReadOnly TOP_LEFT = New Point(0, 0)
Shared ReadOnly TOP_RIGHT = New Point(0, Screen.Width)
Shared ReadOnly BOTTOM_LEFT = New Point(0, Screen.Height)
Shared ReadOnly BOTTOM_RIGHT = New Point(Screen.Width, Screen.Height)
Shared ReadOnly SCREEN_CENTER = New Point(Screen.Width, Screen.Height)
End Class
End Namespace
I know how to reference this in other projects, but I don't know exactly how to get it set up to how I want. I'd assume it would go something like this:
VB.NET:
Me.Location = Common.Location.TOP_LEFT
But I'm not sure exactly how to reference this all correctly with the namespaces, Public vs. Shared stuff, and the like. Also, how would I create an Enum (or something comparable) so when I go to put something in constValue the intellisense gives me only the ReadOnly's I've declared?