Click here to Skip to main content
15,896,264 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is it possible to convert bitmap to intptr in c#? If the answer is yes, please tell me the solution and if the answer is no,please tell me how I can conert the image loaded by piocture box to intptr.
Posted
Comments
Sergey Alexandrovich Kryukov 24-Oct-11 13:29pm    
First, tag what do you want to use: WPF or System.Drawing? Secondly, why? What do you want to do with IntPtr?
--SA
ready to learn 24-Oct-11 13:35pm    
system.drawing.I want to use emgucv and it's watershed function.this function uses itptr.I have used bitmap in my project and now I want to add watershed function to it.so I want to convert bitmap to intptr

1 solution

If this is System.Drawing.Bitmap, use GetHbitmap.

Again, the question is: why? Chances are, what you want you can do using pure .NET libraries. Also, check up carefully if you really want to use PictureBox. If you want to manipulate image, or animate or do anything interactive, PictureBox will only eat up some extra resources but won't provide any help, will only add some hassles. I explained it, and also explained what to do instead, in my past solutions:
How to keep the image Drawn in PictureBox[^],
Picture box lose drawing after reloading[^],
How do I clear a panel from old drawing[^].


—SA
 
Share this answer
 
Comments
Espen Harlinn 24-Oct-11 14:10pm    
Good points :)
Sergey Alexandrovich Kryukov 24-Oct-11 14:11pm    
Thank you, Espen.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900