C#/add images and video to dictionary program in c#
Expert: Nick - 4/12/2008
QuestionDear sir
i work on a bilingual dictionary in c# that have a database in
text format(notepad).i want add images and video for a few words.i want add 2 button on dictionary form for images and video files . if a word have a image or video the buttons should be enable otherwise disable.please help me and if you khow address of a source code same as this program guide me.
tnx
tnx
AnswerI'm not quite sure what your question is, but I'll try my best to answer any I think you're asking.
You can get a button to be disabled/enabled programmatically. Here is the code for that:
if(word.hasImage) {
btnImage.Enabled = false;
} else {
btnImage.Enabled = true;
}
// Do the same for the video button.
Now, in order to display an image, you can create a form with an image control in it. I forget what the control is called exactly... ImageBox or PictureBox or something like that (you'll see it in the Visual Studio tool box). I'm not sure how to display a video. If that is indeed one of your questions, get back to me and I'll look into it for you.
If you need help on storing information about an image or a video in your database, just store relative paths to the image/video files. If you have an image for "elephant", you might store that in the images folder with the name "elephant.jpg". So, in your database, depending on how it is structured, you might have something like this (assuming you use an XML text format):
<word english="elephant" spanish="elephante">
<definition>
<english>
A big gray animal with a trunk and which never forgets.
</english>
</definition>
<image src="images/elephant.jpg">
</word>
Good Luck,
Nick