473,566 Members | 2,784 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display images - C#

Please HELP

1. How can I display an array of images from diffrent types(jpeg,
bmp..)(In C#)
Can I also display video files?(In C#)
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #1
3 10867
"Dafna m" <mo***@012.net. il> wrote in message
news:eX******** *******@tk2msft ngp13.phx.gbl.. .
Please HELP

1. How can I display an array of images from diffrent types(jpeg,
bmp..)(In C#)
Can I also display video files?(In C#)


There are many ways to do this. See PictureBox, and the classes Image and
Bitmap. Note that Bitmap can load from files from many, many types.

This link should give you more than enough info for what you want for
pictures.
http://www.codeproject.com/cs/media/

I'd first look at the article "How to load/display images"
http://www.codeproject.com/cs/media/quickview.asp

As for videos, you have three choices (probably more than this)
1) Managed DirectX 9 and the AudioVideoPlayb ack class
- Uses all C# code
- Documentation is not very good
- Lots of annoying bugs in the library.
- Requires DirectX 9 is installed on clients.

Here's DirectX9 SDK link:
http://www.microsoft.com/downloads/d...displaylang=en

I found I had to use a LOT of workarounds to get the AudioVideoPlayb ack to
"play" nicely - but that was only when I started messing with the volume
level of the sound. If you don't mess with volume, it's not too hard to get
this working.

2) DirectX DirectShow and interop
- Uses Interop to get to non-native code (more complicated code)
- Much better documentation
- More stable libraries (less bugs)
- Requires only DirectX 8 or so

There are two articles on the above codeproject link on using this.

3) Use Windows Media Player ActiveX control
I've only used this slightly, didn't have much success myself.

http://msdn.microsoft.com/library/de...9seriessdk.asp
I'll be happy to answer any more detailed (or more specific) questions that
you have.

--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com

Nov 15 '05 #2
For video:

Solution #1 is optimal. It is no different from using the Interop library
for DirectShow, the only big difference is that the DX team custom coded a
type library wrapper rather than have one that is auto-generated. This
means they do a lot of the marshalling of various types for you to make your
life easier, and supposedly make the libraries run faster. In most cases,
Managed DirectX is 97% the speed of DirectX accessed through C#. There are
some issues if you are constantly loading resources or changing vertex
buffers since all of this stuff has to be marshalled, but that can be
optimized out in most cases (basically, this can be optimized out for most
cases where you would use C# instead of C++).

Solution #2 is a bit more kludgy than solution #1. You have to learn what
kinds of types are expected in many cases, especially where IntPtr's are
being used and you have to pass things using memory. It is pretty solid
(though so is solution #1, I'm not sure which problems Mike is having) and
you shouldn't have too many problems once you get the initial playback
working.

Solution #3 is probably the easiest. You can use a type library wrapper
around the various components that ships with Media Player and have it play
all of your video back for you. If done correctly you can host a media
player control right inside of your Windows Forms application and fully
customize the playback UI if you desire. I'd say #3 is going to give you
the broadest support for Video, while #1 and #2 are going to offer you more
customization (placing filters in the DirectShow stream for example that
modify the output).

If video is really turning into a big problem for people in the Managed
world speak up. I'd be happy to sit down and write up a couple of tutorials
surrounding the kinds of things I've done with video. I'm guessing most
people haven't put a large amount of time into examining video since the
time to place it in an application versus the pay-off isn't spectacular.

--
Justin Rogers
DigiTec Web Consultants, LLC.
"Michael Mayer" <mi**@mag37.com > wrote in message
news:eI******** *****@TK2MSFTNG P11.phx.gbl...
"Dafna m" <mo***@012.net. il> wrote in message
news:eX******** *******@tk2msft ngp13.phx.gbl.. .
Please HELP

1. How can I display an array of images from diffrent types(jpeg,
bmp..)(In C#)
Can I also display video files?(In C#)
There are many ways to do this. See PictureBox, and the classes Image and
Bitmap. Note that Bitmap can load from files from many, many types.

This link should give you more than enough info for what you want for
pictures.
http://www.codeproject.com/cs/media/

I'd first look at the article "How to load/display images"
http://www.codeproject.com/cs/media/quickview.asp

As for videos, you have three choices (probably more than this)
1) Managed DirectX 9 and the AudioVideoPlayb ack class
- Uses all C# code
- Documentation is not very good
- Lots of annoying bugs in the library.
- Requires DirectX 9 is installed on clients.

Here's DirectX9 SDK link:

http://www.microsoft.com/downloads/d...displaylang=en
I found I had to use a LOT of workarounds to get the AudioVideoPlayb ack to
"play" nicely - but that was only when I started messing with the volume
level of the sound. If you don't mess with volume, it's not too hard to get this working.

2) DirectX DirectShow and interop
- Uses Interop to get to non-native code (more complicated code)
- Much better documentation
- More stable libraries (less bugs)
- Requires only DirectX 8 or so

There are two articles on the above codeproject link on using this.

3) Use Windows Media Player ActiveX control
I've only used this slightly, didn't have much success myself.

http://msdn.microsoft.com/library/de...9seriessdk.asp

I'll be happy to answer any more detailed (or more specific) questions that you have.

--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com

Nov 15 '05 #3
"Justin Rogers" <Ju****@games4d otnet.com> wrote in message
news:%2******** *******@TK2MSFT NGP09.phx.gbl.. .
<snip>
If video is really turning into a big problem for people in the Managed
world speak up. I'd be happy to sit down and write up a couple of tutorials surrounding the kinds of things I've done with video. I'm guessing most
people haven't put a large amount of time into examining video since the
time to place it in an application versus the pay-off isn't spectacular.

--
Justin Rogers
DigiTec Web Consultants, LLC.


I'd be curious to see what you've done. I wrote a screensaver to show both
my jpg's and avi's from my camera (can be found here:
http://www.mag37.com/projects/screensaver/ - plug, it also does all kinds
of other things including rotating and skipping files)

I spent a lot of time trying to get the Video class to play nicely with
GDI+. That is, after playing a video, I needed to Dispose the video object
so that I could use the screen for Graphics.DrawIm age calls.

My first problem was how to call Dispose for a video class. Ideally, I
would do it as a result of the Ending event. However, if I actually put a
call to Dispose in the Ending event handler function, then I'd get terrible
exceptions when my method returned (and the "calling" video class that
called my event was suddenly disposed). So instead I set a timer in the
Ending event, and had that timer dispose the Video class.

Later, when I wanted to mute the audio of the video class, I ran into more
problems. It turns out you can't even look at the Audio property of a Video
class without screwing it up. I got workarounds to get the Ending event to
fire again. But video.Dispose() still doesn't work if you do
video.Audio.any thing.

I finally went to two separate forms - one for Graphics.DrawIm age and one
for Video playing, with the two forms being made visible or not as needed.
I still have sporadic errors popping up when I close my application, if I
have avi video files play.

I'd like a more elegant solution - thought maybe DirectShow might work
better, but haven't gotten around to it yet.

I'd be happy to work with you on tutorials and post and/or give you some of
my code and workarounds - especially for dealing with Audio in a Video
class. Although a lot of my code is specific to trying to handle both video
and images.

--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com

Nov 15 '05 #4

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

Similar topics

2
6764
by: Tyrone Slothrop | last post by:
I am coding a site which involves uploading images. All of the PHP and display is OK but the client wants to be able to display the image thumbnail on the upload page and show the full image on mouseOver instead of the popup I coded. The section of code below works perfectly in Firefox but not at all in IE (why am I not surprised?). The...
4
8369
by: Kevin Myers | last post by:
Hello, Please forgive my reposting of this note with hopefully a more relevant subject line. On an Access 2000 form under Windows 2000 I would like to use a Kodak Image Edit Control to display the contents of a TIFF image file. According to the very limited documentation that I have been able to locate so far, all I should need to do is...
2
5127
by: John Do | last post by:
Hi, I want to store the path and the name of the images in a sql 2000 database and all the images in a folder named images. And then I want to display all the images in a datagrid. Does any one know how to do it? Thanks in advance Jonh
5
5020
by: Peter Lapic | last post by:
I have to create a image web service that when it receives an imageid parameter it will return a gif image from a file that has been stored on the server. The client will be an asp.net web page that calls the web service to render a vertical strip of images. After doing some research I am unable to find some vb.net code that can assist...
4
5605
by: drew197 | last post by:
I am a newbie. I am editing someone elses code to make it compatible with Firefox and Safari. In IE, when you click on the proper link, a block of text is shown in a nice paragraph form. But, in FireFox and Safari it appears as a narrow column of text with only 2-3 words per line. Here is the code: function showAll()
0
2453
by: adubra | last post by:
Hi there, I am using a device context (DC) and a buffer to successfully draw to screen. However, when I update the DC at very high frame rate and drag the frame containing the image very quickly over the screen or I drag another window on top of the fast display, I get errors (Pyassertion ....). I believe those are related to a conflict between...
2
6818
by: Randy | last post by:
Hi, I have a small table - 2 columns, 5 rows. Col 1 is the key column and has integer values of 1 through 5. Column 2 is a varbinary(MAX) column and has jpg images loaded in it. What I want to is to bind a combobox to this table so that the combobox will display these these five images in its dropdown list and the user can then select...
11
4151
by: Jankie | last post by:
I need to dispaly a user's multiple images in one entry.Right now,say if a user uploads 3 images,three entries for the same id display to match 3 images. I only want 1 entry to display all of a user's related images like below: Id First Name Last Name Title Image1 Image2 Image3
2
3245
by: wreed06 | last post by:
Hello, I have 2 problems. In my webpage, I have a dropdown list with a button that takes the user to a popup window specific to the option. I am using Firefox 2.0.0.13. I have successfully validated my HTML and CSS code. 1. When I clear cache and refresh my webpage, it takes 3 tries before the popup window displays - I click on the button...
6
1580
by: Geoff Cox | last post by:
Hello, I am using the following css ..hiddenDiv2 { display: none; } ..visibleDiv2{ display: inline;
0
7666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7951
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2083
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1201
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.