|
Have you looked at the properties on the form?
|
|
|
|
|
Actually, I forgot to tell that I need this in TreeView derived control, not on Form derived control.
So, the question is how to disable "Close" button in .NET's class which is derived from Control class, in my case TreeView control?
I'm sorry I've missed full information.
-- modified at 11:11 Monday 30th July, 2007
|
|
|
|
|
To display the treeview you still have to put it on a form?
|
|
|
|
|
I'm not sure what you mean. I'm creating TreeView derived control programmatically and I'm not able to disable "Close" button.
|
|
|
|
|
In .Net a TreeView is a control. Controls go on forms. FOrms are then displayed to the user. The close button is on the form. To disable the close button you must access the properties on the form.
If your not putting your treeview on a form what are you doing?
Edit:
Are you talking about WinForms or Asp.Net?
|
|
|
|
|
Do you mean "collapse"? To keep the nodes from being collapsed? (Not closed?)
|
|
|
|
|
Does anyone know of an alternative to Pegasus' ImagXpress for opening/viewing/scrolling an image? The product works very well, but the licensing fees are way too high ($60,000-$100,000).
Thanks
R.Myers
|
|
|
|
|
Leadtools - www.leadtools.com/
or
Accusoft - www.accusoft.com/
Leadtools has no runtime fees, which is pretty darn nice. Pegasus looks like a great product, but how in the heck do they justify the pricing structure?
|
|
|
|
|
Thanks, I appreciate the input.
|
|
|
|
|
Most of the Image toolkits are expensive and have some form of runtime licenses or reporting requirements. I have used Accusoft controls in the past, from a development perspective it is easy to use and feature rich. Unfortunately, they have a runtime license fee as well as quarterly reporting requirements (At least last year).
|
|
|
|
|
Do you happen to know what the pricing was on that? Just a ballpark figure.
Thanks
|
|
|
|
|
The Accusoft website. The pricing is, from what I remember, was around $1400 per developer and $8 per user for runtime royalities, plus annual maintenance.
|
|
|
|
|
Help me to get the memory details as u retrieve the hardware info.
If possible send the code
|
|
|
|
|
You can retirve hardware configuration information via WMI[^].
Here's some info on how to access it from C#:
C# WMI[^].
|
|
|
|
|
What is the use of having Dispose() method in class. All .NET classes are under managed code and garbage collection will be done automatically. But some classes like Dataset having dispose method. When we need to use dispose method for our class ? Writing dispose method for all classes is a good practice ?
|
|
|
|
|
Hello,
I often implement "IDisposable" with the Dispose method to unregister delegates to manager classes (classes which are allways in memory in my app) there.
All the best,
Martin
|
|
|
|
|
Thanks you. So if the code is 100% managed, do we need to implement this ?
|
|
|
|
|
|
AS A USER...
You should call Dispose() if that is the only way to clean up, as is typically the
case when unmanaged resources are involved.
You should call Dispose() if the class offers that method, since you don't know
whether it is using unmanaged resources; example OpenFileDialog()
For Framework classes you should read MSDN, and pay attention to the remarks it
contains regarding Dispose(), Close() and the like.
BTW: In C# the best way to call Dispose() often is with a using construct.
AS A PROVIDER...
You should do the reciprocal, including:
You should implement IDisposable if your object is likely to hold large amounts of
(managed) memory that you want to make collectable immediately, or some resources
you want to free immediately (e.g. an open file).
If your class has a Dispose() you should clarify its use in your documentation.
|
|
|
|
|
Luc Pattyn wrote: You should implement IDisposable if your object is likely to hold large amounts of
(managed) memory that you want to make collectable immediately
Actually, there is rarely any reason to try to release memory earlier. You might even end up holding on to the memory longer than if you didn't try to release it.
Example:
ObjectWithHugeArray obj = new ObjectWithHugeArray();
obj.GetSomeData();
obj.DisplayTheData();
GetSomeUserInput();
obj.Dispose();
obj = null;
ObjectWithHugeArray obj = new ObjectWithHugeArray();
obj.GetSomeData();
obj.DisplayTheData();
GetSomeUserInput();
obj = null;
(Yes, the example is a bit silly, but it tries to show that sometimes the garbage collector is smarter than the programmer...)
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi Guffa,
Guffa wrote: ObjectWithHugeArray obj = new ObjectWithHugeArray();
obj.GetSomeData();obj.DisplayTheData();
// the memory is collectable here already
GetSomeUserInput();
obj = null;
I think I don't agree in general and with the // comment in particular.
I assume you intend the example to be the code of a single method, with obj
a class member, not a local variable.
(if it were a local variable, setting it to null with no statements following
that use it's value, the "obj=null;" statement would be chopped out
by the optimizer).
Not having an obj.Dispose(); ends the life of the obj value sooner when
looking at the code in the method itself; IMO that on its own is insufficient to
expect the compiler to move "obj=null;" upwards. And it is not allowed to move
it over the GetSomeUserInput() method call, without making sure the value of obj
isnt used in there.
So I expect the obj variable be present on the stack, and be cleared only
after returning from the Input method; hence the GC would find the hugeobject
reference, and would have to keep it alive (together with its huge array, for
which my Dispose() would have removed the only reference).
So I don't see how your example works in substatntiating your statement
that Dispose() could work adversely, which I still don't see possible.
|
|
|
|
|
Hello Luc,
Luc Pattyn wrote: with obj
a class member, not a local variable.
But the example looks like it is a local vatiable, doesn't it?
"ObjectWithHugeArray obj = new ObjectWithHugeArray();"
Luc Pattyn wrote: the "obj=null;" statement would be chopped out
by the optimizer
Really!
I use it very often, because I thought it is recomended behaviour, to help the GC.
I think there was a discussion in the past about that, let me look!
-- modified at 11:28 Monday 30th July, 2007
Found it, Scott Dorman gave me that information[^] some time ago.
All the best,
Martin
|
|
|
|
|
Hi Martin,
it will require more investigation; seems the C#2005 compiler is dumber than
I expected (I don't know what the JIT does to it).
Even in release mode, it keeps both "ref=null;" and "val=12;" statements,
even as the last line of a method and for local vars.
For value types that does not make sense at all.
For ref types it could make sense (to throw away the reference, so the object
may become collectable); here the compiler may be keeping it on purpose in
general, but keeping it for a local ref on the last line does not make any sense.
Whatever the compiler does to it, it makes sense (and I apply it too) to
nullify a ref that is a class member everywhere in your code, and I guess
they have (and should have) done something special so you could nullify a local ref
anywhere in a method to throw the ref away earlier than method exit.
I will tell when and if I have more on this.
|
|
|
|
|
Hi Martin,
I investigated the GC stuff somewhat deeper, see here[^]
Net result is: ptr=null; makes sense, the compiler uses a "ldnull stloc" instruction sequence, which the JIT will not move or optimize away.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hello Luc,
Very interesting!!! (Got my five)
Thank you for taking time!
I followed this thread every day (have it in my Favorites), because it was interesting for me.
I was a little surpriesed that the disussion between you and Guffa ran in a "wrong" (abuse) direction.
Hope it doesn't change your behavioure her on CP.
Go on with the good work!!!
Thanks again!
All the best,
Martin
|
|
|
|