|
I've noticed that the Dispose method's in the foo.Designer.cs file. Does that mean that as I port my app from the 1.1 to 3.5 framework that if I move the method into the new proper location I need to move the cleanup/shutdown code (thread termination) to a different location to keep it safe, and if so where?
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies
|
|
|
|
|
AFAIK the code generator does not touch Dispose after it is first created. It is placed outside the autogenerated region.
The MSDN documentation gives this:
protected override void Dispose(bool disposing)
{
if (disposing)
{
}
base.Dispose(disposing);
}
I know that sometimes MS doesn't do what it says, but I think it's OK to believe them here.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I am adding images in imagelist also in listview as "thumbnails" like that..
listView1.Items.Clear();
this.listView1.View = View.LargeIcon;
this.imageList1.ImageSize = new Size(60, 60);
this.listView1.LargeImageList = this.imageList1;
try
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
if (open.ShowDialog() == DialogResult.OK)
{
Bitmap slika = new Bitmap(open.FileName);
velikost(slika);
FileInfo fi = new FileInfo(open.FileName);
imena[i] = fi.Name;
this.imageList1.Images.Add(Image.FromFile(open.FileName));
i++;
}
When i click on image thumbnail in listview i do this:
private void listView1_SelectedIndexChanged_1(object sender, EventArgs e)
{
int index = 0;
if (this.listView1.SelectedItems.Count > 0)
index = this.listView1.SelectedIndices[0];
Bitmap nova = new Bitmap(imageList2.Images[index]);
picture.Image = nova;
}
But the size is 60,60 as i specified before.If i want to put height and weight argument in Bitmap..it resizes from 60,60 and normally at size 500,500 is blurrred and f*****.. Can you help me out plz?
|
|
|
|
|
Keep two image lists, one for the the smaller thumbnails and one for the full size images.
|
|
|
|
|
This is my code for deleting multiple items from listview.. how can now i delete with same function also images from imagelist with multiple selected indexes..
private void button2_Click(object sender, EventArgs e)
{
foreach (System.Windows.Forms.ListViewItem eachItem in
this.listView1.SelectedItems)
{
this.listView1.Items.Remove(eachItem);
}
}
|
|
|
|
|
Do the indices of the items in listView1.Items correspond to the indices of the items in imageList1 ? They should, so something like this should work: imageList1.Images.RemoveAt(eachItem.Index);
If they don't then I'd store either the index or the key of the image from imageList1 in the Tag property of your ListViewItem s, that way you know how to find the image later on.
|
|
|
|
|
How shold this line look like:
foreach (System.Windows.Forms.ListViewItem eachItem in
this.listView1.SelectedItems)
One more thing...why everytime i call function the last text in richbox is still in...and it is duplicating..why? The code is here:
private void podatki()
{
string prazno = "";
rich.AppendText(prazno);
int index = 0;
if (this.listView1.SelectedItems.Count > 0)
index = this.listView1.SelectedIndices[0];
FileInfo fi = new FileInfo(poti[index]);
Bitmap nova = new Bitmap(poti[index]);
string dolzina;
string visina;
string ime;
string format;
string velikost;
string datum;
dolzina = nova.Width.ToString();
visina = nova.Height.ToString();
ime = fi.Name;
datum = fi.CreationTime.ToLongTimeString();
velikost = fi.Length.ToString();
dolzina = "Širina: " + dolzina;
visina = "Višina: " + visina;
ime = "Ime: " + ime;
velikost ="Velikost: "+ velikost + "Bytes";
string skupaj = ime + "\n" + dolzina + "\n" + visina + "\n" + velikost + "\n";
rich.AppendText(skupaj);
}
|
|
|
|
|
foreach looks fine
your other question isn't clear. Are you asking why it isn't replacing the text in the text box? use rich.Text = skupaj; to do that.
|
|
|
|
|
richbox works fine now.. how should look in this forreach code for getting indexes for imagelist..can someone edit it plz
private void button2_Click(object sender, EventArgs e)
{
foreach (System.Windows.Forms.ListViewItem eachItem in
this.listView1.SelectedItems)
{
this.listView1.Items.Remove(eachItem);
this.imageList1.Images.RemoveAt(-->INDEX?<--);
}
|
|
|
|
|
Asked and answered.
I think I've helped you enough for one day. It's time for you to help yourself.
|
|
|
|
|
eachitem.index doesn't work..tryed also eachitem.imageindex..also error..about that tag option idk how to use it..
|
|
|
|
|
|
Good People,
Greetings.
I am trying to figure out which casting method I should use for my application.
1)
double average = (double)value;
or
2)
double average = value as double;
I thought that since objects of type "double" are not nullable; the cast would throw an exception if "as" returned null. What do you think?
Thanks for any advice or information you can provide.
Blitz
|
|
|
|
|
Surely this won't compile???
double average = value as double;
If value could be null, and you need a double you can do the following:
double = (double?)value ?? 0d;
Replacing 0 with your prefered default.
10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011
|
|
|
|
|
Neither. TryParse is a much better way to do this (and it works on types such as int, bool, etc).
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
|
Should be a double coming in.
Thanks,
Blitz
|
|
|
|
|
Then why are you trying to cast at all?
|
|
|
|
|
Attaching to a service "Unable to attach to the process. A debugger is already attached"...
how do i know which debugger is assigned
|
|
|
|
|
I have same error when i try to debug silverlight3 application in VS2008 this app have test html page in another project in solution.
in debugger options i have enabled native code ane not enable script debugging
Pleas can someone help me?
|
|
|
|
|
hi i want to connect to SFTP Server using SSH Channel and list files on remote directory, upload file and download file.
I am not an expert in this area, please let me know how to achieve my targe using this code.
|
|
|
|
|
I have a problem with windows services in C#. I have a windows service developed by a programmer already and its been installed. The programmer has deleted the source code, so i don't have any source code for it... my client wants me to make changes to the service for which i can find the exe only. I was able to find the .net reflecter and i can look at the code and understand it... Now in order to make changes, wat do i have to do... as its a service, i need to run it and then somehow connect to it. To connect to the service , do i need the source code or when i connect the code will be generated automatically... also, if i have to generate the code then the fact that the decompiled code is different from the original source can make a problems or not... decompiled code would have compiler generated code , what will i do with that
Plz provide help in this regard
if i am asking this question at a wrong place, lemme know the correct forum and i will copy it over there
|
|
|
|
|
I've never had to do what you're asking before but here's what I'd do:
1. refuse to work on it unless the original developer is fired for deleting the source.
2. use reflector to decompile it.
3. load up the source in VS. you might have to make a new project and then manually merge in the decompiled code.
4. make whatever changes are required to the source and rebuild.
5. add the code into some form of source control repository.
6. give the new executable to the client.
You don't have to run the service and connect into it to change it. I don't even know what that means. After you've rebuilt the service all you have to do is stop the instance that's running on the clients computer, overwrite the existing executable file with your new one and restart the service.
Decompiling the executable won't change the behavior of the program so modifying it and recompiling should be ok. Working with the decompiled source code may be more difficult than working with the original but if the original developer was ignorant enough to delete it in the first place then the decompiled version might be an improvement.
Good Luck.
|
|
|
|
|
oh thanx for replying...actually , by running the service and connecting to it , i meant that is there anyway that i can communicate with the exe without the source... but still i need the source to do changes into it... i am confused.... I can't attach a process to a service until i have the source right? what if the source is a bit older version and is missing classes... wat do i do then...
again thanx for replying
best regards...
|
|
|
|
|
mark_me wrote: communicate with the exe without the source
mark_me wrote: attach a process to a service until i have the source
Huh?
To communicate with the service once it's running you'll need some other program that was built to communicate with it. If you want to know how to communicate with it then you'll have to ask the original developer or you could look in the source and see what it's built to do.
You build and deploy services just like any other program. You edit the source code and rebuild it which produces a new executable file. It has absolutely nothing to do with "attaching processes" or "communicating with exes".
When you decompile an executable that gives you the ALL of source for that executable; there's no way for it to leave things out. The decompiled version is probably different from the original source but there's really no way that you would know that unless you have the original source to compare it to which would alleviate most of your problems.
|
|
|
|