|
Ray Cassick wrote:
I thought that you were supposed to add each image to the imageList as a separate image. That's what I have done before.
Yes, and this is the best way to do things, IMHO. But in the .NET imagelist control, there is also the option of adding a bitmap strip and having it divided up into seperate icons.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
jdunlap wrote:
there is also the option of adding a bitmap strip and having it divided up into seperate icons.
How? You mean in the code?
Don't and drive.
|
|
|
|
|
Yes, using the ImageList.AddStrip method. As James T Johnson said below, the ImageList designer may not support this - i.e. you'll probably have to add it by code, not through the designer.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
You should only have to add it once, but make sure you call AddStrip instead of Add. To my knowledge the ImageList designer does not support this usage.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
if my C# application have a webbrowser to open/operate an excel file. When I deliver the application to the user, must the user's computer has excel installled?
It seems that all the office object are COM based not within the .NetFramework.
any idea?
thanks.
|
|
|
|
|
The .NET classes for Office are just wrappers around the COM automation interface. That means if you want your users to have Excel functionality, then they'll need Excel. There is no way around this.
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
If you create a setup routine with .net it will see that there is a reference to excel and add a own excel.exe into the needed files for the installation!
|
|
|
|
|
Here's the scenario:
We're migrating an existing java Windows application to .NET over the next several months and were thinking of using our new app to open the older one as a way to minimize the user's confusion.
Is there a way to open an existing java app as an MDI child inside a .NET MDI parent form?
Cheers,
Simon
"I ask candidates to create an object model of a chicken.", Bruce Eckel on interviewing programmers.
animation mechanics in SVG (my first abstract photo)
|
|
|
|
|
SimonS wrote:
Is there a way to open an existing java app as an MDI child inside a .NET MDI parent form?
Read this: Embedding .NET Controls in Java[^], it's a little different but check it out.
-Nick Parker
|
|
|
|
|
Is there an object I can use to stop/start a website hosted on the local machine programmatically?
For example, perform the same actions that occur when you click the STOP button on the Default Website in the IIS Console.
Thanks in advance.
Cody
|
|
|
|
|
Just kill/start the process! Look under services for WWW's commandline.
Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
|
|
|
|
|
hi ,
how can i add a gripper to a toolbar ?
thanks
|
|
|
|
|
hey there.. i have a problem working with an older data type that i dont know how to handle..
i have a byte (8 bits) which tells me if 8 different options are turned on or off.. so when i read in a value of 36 i know that bit 6 and bit 3 are on (32 + 4 = 36).. im trying to figure out an easy way to get if a bit is on or off without having to write some sort of code to parse the byte value..
so if i have:
byte bByte = GetByte(); i want to be able to write a function (or use one that exists) to call something like:
if (IsOption1On(bByte))
...
can someone help me understand how this works?
thanks in advance!
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
You can use & operator to get what 'flags' options are set.
if ((bByte&0x01)!=0) {}
if ((bByte&0x02)!=0) {}
if ((bByte&0x04)!=0) {}
You can use this function to get whether is option set (nOpt is value from 0 to 7)
bool IsOptionOn(byte bByte,byte nOpt)
{
return ((bByte&(1<<nOpt))!=0)
}
Hope this helps
i'm only pointer to myself
|
|
|
|
|
this helped a bunch.. but im doing something wrong.. i dunno what it is..
it seems to work fine until i get into higher numbers.. here is whats happening:
byte myByte = 45;
bool bOn = (myByte&0x64)!=0;
b0n should be false since 64 is bigger than 45, so bit 7 should be off.. but its returning true ..
what am i doing wrong?
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
Problem is that number 0x64 (this is 16*6+4*1 = 100 ) is in hexadecimal and 64 is decimal.
To learn more about this I recomend you this article[^].
i'm only pointer to myself
|
|
|
|
|
stupid hexidecimal..
i was wondering what was happening.. is there any reason why you chose to use hex in your example you gave me?
the following works perfect:
bool bOn1 = (bByte&01);
bool bOn2 = (bByte&02);
bool bOn3 = (bByte&04);
bool bOn4 = (bByte&08);
bool bOn5 = (bByte&16);
bool bOn6 = (bByte&32);
bool bOn7 = (bByte&64);
bool bOn8 = (bByte&128);
thanks for all of your help!!
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
Hexadecimal rox. I think in hexadecimal
I'm sorry if I confused you.
i'm only pointer to myself
|
|
|
|
|
Here's an article[^] (which I wrote ) which does just this thing. I wrapped the int in a struct which made it much easier to get at the bits.
α.γεεκ Fortune passes everywhere. Duke Leto Atreides
|
|
|
|
|
I suggest a Flagged Enum too. Else just use bitwise operators if you are feeling comfortable with them.
Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
|
|
|
|
|
You can use System.Collections.BitArray. Also, in Systems.Collections.Specialized, there is a 32-bit vector, which is essentially an integer wrapped in a struct.
|
|
|
|
|
Hey.
I'm developing a system, where multible smartsclients (thin winform programs) is using a webservice. I want to validate user input on the webservice and thorw an exception back to the clients if the input is badly formattet (it must be an exception, and i made my own ServiceException).
However when i throw my ServiceException from the server, all my clients get back is a SOAPException containing one long string with the serviceexception and its inner exceptions. I am not able to retrieve that it was a service ekception that was thrown, and much less what the message of the exception was (fx "Input Error").
Can anyone tell me how to retrieve exceptiontypes and their messages thrown from a webservice?
//Troels
|
|
|
|
|
Hi,
this has got a bug that I cannot fathom, it is happily traversing through all the folders that it finds and checks all the files that it comes across with what is stored in the list. Unfortunately, the only files stored in the list, come from the working directory rather than the whole path.
As I step through it, I can see it checking all the files, but I cannot see why it stops collecting filenames after completing a scan of the first folder !
public class MainForm : System.Windows.Forms.Form
{
public void DirSearch(string path)
{
try
{
foreach(string file in Directory.GetFiles(path))
{
Original original = new Original(new FileInfo(file));
original.CheckDirectory(new DirectoryInfo(path));
if(original.HasDuplicates())
{
listViewResult.Items.Add(file);
foreach(string duplicate in original.GetDuplicates())
{
listViewResult.Items.Add(duplicate);
}
}
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
public class Duplicate
{
private FileInfo _info;
public Duplicate(FileInfo info)
{
this._info = info;
}
public bool IsDuplicate(FileInfo info)
{
return (_info.Name == info.Name) &&
(_info.Length == info.Length) &&
(_info.LastWriteTime == info.LastWriteTime) &&
(_info.DirectoryName != info.DirectoryName);
}
}
public class Original : Duplicate
{
private ArrayList _list = new ArrayList();
public Original(FileInfo info) : base(info) {}
public void CheckFile(FileInfo info)
{
if(base.IsDuplicate(info))
{
this._list.Add(info.FullName);
}
}
public void CheckDirectory(DirectoryInfo dirInfo)
{
foreach(FileInfo fileInfo in dirInfo.GetFiles())
{
CheckFile(fileInfo);
}
foreach(DirectoryInfo subDirInfo in dirInfo.GetDirectories())
{
CheckDirectory(subDirInfo);
}
}
public IList GetDuplicates()
{
return this._list;
}
public bool HasDuplicates()
{
return (this._list.Count > 0);
}
}
tia,
|
|
|
|
|
It's okay now, I have added another loop to traverse the rest of the directories
public void DirSearch(string path)
{
string[] directories;
try
{
directories = Directory.GetDirectories(path);
foreach(string file in Directory.GetFiles(path))
{
Original original = new Original(new FileInfo(file));
original.CheckDirectory(new DirectoryInfo(path));
if(original.HasDuplicates())
{
listViewResult.Items.Add(file);
foreach(string duplicate in original.GetDuplicates())
{
listViewResult.Items.Add(duplicate);
}
}
}
foreach(string directory in directories)
{
DirSearch(directory);
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
|
|
|
|
|
... Nevermind.
I had the attributes above the XML comments and that kept them from working properly. I'm all set now, thanks!
|
|
|
|