|
Guffa wrote: Also, in this case if the cast fails, you will lose the reference to the original object, which means that you won't be able to dispose it.
Wouldn't I also loose the reference to the original object if the cast succeeds and therefore dispose it before doing this anyway.?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Stefan Troschütz wrote: Wouldn't I also loose the reference to the original object if the cast succeeds
No. The type of the reference variable doesn't matter. A reference is a reference. If you want a reference to the object as the original, you can just cast the reference to the actual type.
---
single minded; short sighted; long gone;
|
|
|
|
|
Ah, I think I misunderstood your post. I thought with original object you were refering to the object that was referenced by the Bitmap variable before doing Bitmap bm = Bitmap.FromFile("Blah") as Bitmap but of course that is nonsense as the variable is declared in this line. So with original object you mean in this special case the Image object returned by FromFile , right?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Stefan Troschütz wrote: So with original object you mean in this special case the Image object returned by FromFile, right?
Right.
---
single minded; short sighted; long gone;
|
|
|
|
|
becarfule that Bitmap class is sealed.so u cant create an object.just u should use Image class.
|
|
|
|
|
You are totally wrong and completley confused on what the OP is doing.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
You are totally wrong and completley confused on what the OP is doing.
what's wrong with me? Bitmap is a sealed class.can explain u me more?
|
|
|
|
|
sealed does not mean that you cant create an instance, of course you can do
"new Bitmap(...)". It does mean you cannot create a class that inherits from it.
Luc Pattyn
|
|
|
|
|
hi.
yes.Now i understand what a big mistake that i had make!
|
|
|
|
|
Hello,
Can I write a c++ code on my c# project?
I mean if I have an array (a) on c# and I want to make something with this array but on c++ code how can I do that?
I mean How can I mix the two languages togather?
SnaidiS(Semion)
|
|
|
|
|
Semion_N wrote: Can I write a c++ code on my c# project
No. A project can only be written in a single language, be it C++, C#, VB.NET, ... But, there's nothing stopping you from having multiple projects in your Solution, each written in a seperate language.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
You can mix languages in a solution, just write your C++ code in a C++/CLI dll and call it from C#.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
This is how I understood it (and I recall I once did a small but successful test
combining C#, VB.NET and J#):
You can create a dll in one .NET language,
and another dll or exe in another .NET language.
for each of these you need a project (that is possible in a single solution).
Now the second project can call on the dll from the first project, and they can
exchange all "CLR types" which covers most of the data types in a .NET language
(I think the biggest limitation is on VB.NET, not sure tho).
Luc Pattyn
|
|
|
|
|
Thank you all for your answers.
Do I have to make a dll from the other projects if I want to use the classes and ect on my C# project?
SnaidiS(Semion)
|
|
|
|
|
Hello,
perhaps someone knows the Hyperbar example from the Microsoft Expression blend beta...
I want to ask, if someone knows how to implement it in .Net 2.0...or knows similar implementations to look at.
Please don't ask, how the hyperbar works and looks like.I think my english is not enough to explain that.
Screenshot here
There a 11 items in the hyperbar on the screenshot. Which are visible depends on the mouse position.
thanks
|
|
|
|
|
You can do it. I've done it in MFC. The trick is, you need to float a frameless window over the toolbar, in MFC I grabbed a screenshot and made it the background to make the window invisible. In C#, you can probably just make it transparent. Then you can draw your enlarged buttons on this window as you move the mouse over it.
In other words, you need to write a custom control, but it can be done.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
I know what a hyperbar is, I wrote one using MFC.
The zoom is the issue, you need a paint area bigger than the toolbar that owns the images. Which is why you create an invisible window.
This video is of the exact same WPF sample that I used as a source when I was writing my MFC version.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi all,
i am trying to programatically get a list of connected users that in are the current
ftp sessions tab in iis6.
i cant find anything on the net that seems to be able to help me, i've
looked at System.Net and various other places but there seems to be
nothing out there.
there are loads of posts about creating an ftp client however i want
to be able to talk to the iis ftp ( i already create ftp virtual
directories and user accounts on the fly and i want to know which of
these users in currently logged in and disconnect them if needed)
any help would be appreciated!
cheers
john
|
|
|
|
|
|
thanks the for reply dave, i've been using the System.DirectoryServices namespace to create and delete iis ftp virtual directories, get/set the logfiledirectory, get/set the AccessRead and AccessWrite properties etc etc and have had a rummage around adsi and wmi but the getting ofthe connected users just doesnt seem possible with any of those api's
but i've just found the following post about getting a list of tcp connections on a machine which i'm hoping might take me in the right direction. loop through all (open) tcp connections on port 21 and then do something with result to map that connection back to the windows user the connection belongs to... out of my comfort zone to be honest!
http://devdistrict.com/codedetails.aspx?A=397
If i get anywhere with it i'll post my findings if anyone is interested.
cheers
john
|
|
|
|
|
I have a database app which runs OK so far except for when I close the form by clicking the X the myprogram.exe process is left still running. Subsequent debug runs fail to start because the myprogram.exe file is still open and can't be updated by the debugger. Even if I quit VS2005 completely the myprogram.exe process is still running and has to be killed manually in Task Manager.
This program utilizes a Pervasive v.9 ODBC driver to an existing database on a server. I used the Querry builder and drag/drop to build the form which uses a DataGridView control and several label controls to display the rest of the row that is selected in the DataGridView control.
Is there something I should be doing to properly close everything down in re: the ODBC driver?
Thanks
Edwin
|
|
|
|
|
It sounds to me that you have a threading-problem, with a thread running when you close the form. This will result in the form disappearing, but another thread keeping the process alive.
Try the Closing event for the Form, and make sure you shut down all threads (might be some database-shutdown command or similar to shutdown/disconnect teh database correctly).
Internet - the worlds biggest dictionary
|
|
|
|
|
Does anyone know of a downloadable C# Class Library? I need to have one for my other computer, which doesn't have internet.
-----
Note: *** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
|
|
|
|
|
max29297 wrote: Does anyone know of a downloadable C# Class Library?
Uhhh... That does what?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|