473,395 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Easy object question

AMP
Hello,
I want to use a ready made class (ie a System.Drawing .Pen) and make it
available to my entire application, but I'm getting stupid.
How do I do this? Or point me in the right direction.
Thanks

Aug 25 '06 #1
4 1123

AMP wrote:
Hello,
I want to use a ready made class (ie a System.Drawing .Pen) and make it
available to my entire application, but I'm getting stupid.
How do I do this? Or point me in the right direction.
Thanks
What do you mean by "it". Do you mean the class, or an instance of that
class? I'm guessing that you mean an instance...?

Aug 25 '06 #2
Hi,

You can create a static member variable and property in a class and make it
public, it will be accessible from all places using className.PropertyName

Now, IIRC a Pen consume unmanaged resources, that you should not keep a hold
on unless you really need it. IMO it would be better if you create it only
when needed and destroy it right after.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"AMP" <am******@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hello,
I want to use a ready made class (ie a System.Drawing .Pen) and make it
available to my entire application, but I'm getting stupid.
How do I do this? Or point me in the right direction.
Thanks

Aug 25 '06 #3
AMP
Yes, an instance.
Thanks
Mike
Bruce Wood wrote:
AMP wrote:
Hello,
I want to use a ready made class (ie a System.Drawing .Pen) and make it
available to my entire application, but I'm getting stupid.
How do I do this? Or point me in the right direction.
Thanks

What do you mean by "it". Do you mean the class, or an instance of that
class? I'm guessing that you mean an instance...?
Aug 25 '06 #4
Something like this?

I have a class called UnitOfMeasure that represents... well, a unit of
measure. There are several units of measure that I use all over the
system, such as LinearFeet:

public class UnitOfMeasure
{
private static _linearFeet = new UnitOfMeasure(... arguments to
make a "linear feet" instance ...);

public static UnitOfMeasure LinearFeet
{
get { return this._linearFeet; }
}
}

then whenever I need linear feet, I just say: UnitOfMeasure.LinearFeet.

AMP wrote:
Yes, an instance.
Thanks
Mike
Bruce Wood wrote:
AMP wrote:
Hello,
I want to use a ready made class (ie a System.Drawing .Pen) and make it
available to my entire application, but I'm getting stupid.
How do I do this? Or point me in the right direction.
Thanks
What do you mean by "it". Do you mean the class, or an instance of that
class? I'm guessing that you mean an instance...?
Aug 26 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: L# | last post by:
Hi, I'm looking for a starting point here. I want to 'intercept' incoming HTML on the client, before it's handled by the browser. Is this possible? Kind regards , Ludwig
6
by: Ryan Smith | last post by:
I am trying to store a string into a string variable via the following code however am receiving an error and cant figure out what i am doing wrong. Any feedback is greatly appreciated. Line...
1
by: Mad Scientist Jr | last post by:
can someone explain how to simply populate a grid in .net ? the way i understand it, there is no more msflexgrid, and instead is this new control that has to be tied to a dataset, and it is a real...
13
by: Ghislain Tanguay | last post by:
I have a compiled vb.net app and I want to give the user a choice to launch it from the start line command and pass it a parameter or not. How can I do that in my code? Is it possible? Ex. :...
2
by: =?Utf-8?B?UnVkeQ==?= | last post by:
Hello All! This seems pretty easy, but I'm missing something. In my app config file I have <add key="HL7File.Path" value="C:\Planes\STB" /> Then in my code I have below Windows Generated...
7
by: Mark Cooney | last post by:
Ok I have a class called Game which has an GameID value. I also have a routine that runs every 6 seconds. I need to see if the object Game exists with an GameID value = to the value of the...
2
by: shawncraig | last post by:
I'm sure I'm just missing something here but is there a way to nest objects inside an object or a collection that functions like an object with properties BESIDES creating whole classes or making...
5
by: TonyJ | last post by:
Hello!! This first expression return System.Int32. The type that is returned is a string. This is perfect understandable. Console.WriteLine(7.GetType().FullName); In this second expression is...
2
by: Tony Johansson | last post by:
Hello! As I have understood this it means the following. Correct me if I'm wrong. You store type objects in the array obj and the first one is refering to a and the second is refering to b and...
20
by: raylopez99 | last post by:
Inspired by Chapter 8 of Albahari's excellent C#3.0 in a Nutshell (this book is amazing, you must get it if you have to buy but one C# book) as well as Appendix A of Jon Skeet's book, I am going...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.