|
I dont have much idea but a clue i hope it works
step 1. take a pic box array
2. Count the no of pics in the folder
3. now run a loop to show the pic boxes as accordint to no of pics
4. Assign proper top n left values to the pic boxes
i hope this will be useful ...any way nice question 4m u
its me sid
|
|
|
|
|
I think I was doing that before i posted the question and i received an exception that i did not do how to correct...
//images is an array that contains all images in the given folder
images = loading.Loading();
//loading.cant() returns the number of files contained in the folder
PictureBox[] pics = new PictureBox[loading.cant()];
foreach (Image img in images)
{
//with ImagesList i can display the images but not let them be in the form until it closes
ImagesList.Images.Add(img);
}
//i added this loop to have a better control of the array of pic
for (int i = 0; i < loading.cant(); i++)
{
//both codes generates an execption can you tell me why?
//pics[i].BackgroundImage = images[i];
pics[i].BackgroundImage = ImagesList.Images[i];
pics[i].Show();
}
sindhutiwari wrote: i hope this will be useful ...any way nice question 4m u
thanks man, i really appreciate it!
Luis E Tineo S
|
|
|
|
|
Picture boxes are a waste of time. Write your own paint handler and then render as many images as are appropriate for your screen size and image size.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I like that idea a lot better but can you please point how to start my own paint handler?
I am a little rookie to describe myself in a positive way but i don't know much of images processing.
Thanks...
Luis E Tineo S
|
|
|
|
|
Handle the paint event. It's passed a graphics object. You can use the DrawImage methods on that object to draw images direct to your screen.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks... I guess that's the signal to start reading something new...
I love this project, i surely do... It has made me learn from network programming to Images processing...
I think after this i want to become a programmer!!!
Thanks again!
Luis E Tineo S
|
|
|
|
|
I didn't get it to work the way you advice me, not because it did not work that way but because my lack of knowlege, but i did get it to work like this:
void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
int totalPics = loading.cant();
while (cantPictures < totalPics)
{
PictureBox P = new PictureBox();
Bitmap imag;
if(cantPictures <= 5)
{
if (cantPictures == 0)
{
imag = new Bitmap(images[cantPictures]);
P.Image = imag;
P.Click += new EventHandler(P_Click);
P.Size = new Size(150,150);
P.SizeMode = PictureBoxSizeMode.StretchImage;
P.Location = new Point(35, 10);
constante = 35 + P.Size.Width+10;
this.Controls.Add(P);
}
else
{
imag = new Bitmap(images[cantPictures]);
P.Image = imag;
P.Click += new EventHandler(P_Click);
P.Size = new Size(150, 150);
P.SizeMode = PictureBoxSizeMode.StretchImage;
P.Location = new Point( constante, 10);
constante += 10 + P.Size.Width;
this.Controls.Add(P);
}
}
Now i have a little problem adding the Click Event individually, any advice there?
Luis E Tineo S
|
|
|
|
|
|
That is soo true it does have all i need.
I am going to ask the owner to let me use some of his code if it is possible.
I like to ask for permission even if it is open.
Thanks a lot,
Best regards!!!
Luis E Tineo S
|
|
|
|
|
Erhm, not having a dev env here right now, but this should be pretty close...
<br />
DirectoryInfo diPictureFolder = new DirectoryInfo("c:\\Your\\Pics\\");<br />
foreach (FileInfo fiPic in diPictureFolder.GetFiles("*.jpg"))<br />
{<br />
PictureBox pb = new PictureBox();<br />
pb.Image = new Bitmap(fiPic.FullName);<br />
pb.Click += new Event handler for click event<br />
yourForm.Controls.Add(pb);<br />
}<br />
|
|
|
|
|
Hi Friends,
Kindly give the method, How may I set "F10" key in "MDI/Main" form to close application?
Thank you
(Riaz)
|
|
|
|
|
if (e.KeyCode == Keys.F10)
Application.exit();
But remember it will run when you are having the focus onto the MDI form.
It will not work when any child form is open.
Regards
Pankaj Joshi
|
|
|
|
|
1. Set KeyPreview to True in the properties of Main form
2. Write the following code in the Keypress event of Main Form
if(e.KeyCode == keys.F10){<br />
Application.Exit();<br />
}
Hope it helps.
|
|
|
|
|
|
Hi....i need to implement scanner in one of my project to read the barcode...how can i do it in windows applications with c#?
vicky
|
|
|
|
|
Hi,
If you are going to use the actual hardware, then you will have to connect it and get data from it. Otherwise, you'll have to detect and extract the exact place in the image, where the barcode is, and then read it as its specifications.
Regards,
Adeel
|
|
|
|
|
thanks for your support....i am going to use actual hardware for it...do i have to use any supporting dll for that...if yes, what is it and how to use it?
|
|
|
|
|
For that you will have to check what interface the barcode reader has i.e. will you connect it using serial port, USB port or parallel port. After that you need to look-in the specifics of the barcode reader, like in what format it sends/receives data, what commands it supports, that mainly depends on the make and the chip design of the barcode reader.
Hope that helps!
Adeel
|
|
|
|
|
|
most barcodescanners act like a keyboard so you won't need anything special.
greets
m@u
|
|
|
|
|
Hello experts,
I have a combo in that I fill some values from Db say A,B,C,D,e,f,G,h,i,j etc.
My combo is a simple combo so end user can also type in that. for data consistency I check wheather or not the user select proper value or not...? That is user have to enter or select the pre-filed value. For that I am using the Contains method
like
comboBox1.Items.Contains(comboBox1.Text.ToString()
and its working fine.
But this will interperete A and a different ....What to do...?
I want a and A are the same
Regards
Pankaj Joshi
|
|
|
|
|
One idea might be to do a string comparison between the objects in the combobox and the the value inserted by the user
for (int i = 0 ; i < cmb.Items.Count ; i++)
{
if (String.Compare(cmb.Items[i].ToString,cmb.Text,true)
{
}
else
{
}
}
Hope it helps.
I will use Google before asking dumb questions
|
|
|
|
|
Thanks for reply
But this is Ok...? If I having 15,000 records in combo then for loop will run 15,000 times and check the item. This will make code slower, And .Contains method automatically do that only case-sensitivity is the matter...I am right?
Regards
Pankaj Joshi
|
|
|
|
|
pankaj.indore wrote: If I having 15,000 records in combo then for loop will run 15,000 times and check the item.
Yes, when you have 15000 records in a combobox it's not right...but then again...why don't you do some filtering to have fewer values...or even...you should try to use autocomplete would work better
Hope it helps.
I will use Google before asking dumb questions
|
|
|
|
|
Hi,
If you have already fill-in all the possible values in that combo, why not you make it un-editable? That way, still, the user will be able to select the value by pressing the 1st character key of the value. Correct me if i am wrong.
Regards,
Adeel
|
|
|
|