|
Ok I'm doing it right now, I'll let you know. Ty
|
|
|
|
|
I have 5 items in a listbox and am custom paiting each item. but if i click at the very bottom within the listbox i should be getting -1 but I always get the last item index.
private void listbox_MouseDown(object sender, MouseEventArgs e)
{
int indx = this.IndexFromPoint(e.X, e.Y);
MessageBox.Show(indx.ToString());-->>; I always get the last item index
}
I ran a simple test by adding a listbox on a form and on a mouse click if i click outside of the listitem i get -1. means no item is selcted.
Can somebody tell me where the problem os
|
|
|
|
|
What if you handle mouse up instead of down ? Perhaps the selection changes in mouse click, which fires between down and up.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hello All,
I am wondering if it is possible to get the drop location in explorer after you drag and then drop to explorer.
I would like to generate some files at the drop location, not copy\move existing files on the computer.
Thanks
|
|
|
|
|
Using VS2008 in Vista - I'm trying to make use of this code:
http://www.codeproject.com/KB/combobox/ComboBox_appears_flat.aspx[^]
In the designer, the control paints as expected. However, when the application is actually run, the control has an inner white border (including one that separates the down-arrow button with the control's text area). Is there something available (another flat combobox class) that is more reliable?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
|
The .Net ComboBox control does not support flatness.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Is there any way to get an Excel 2003 xml file to show images?
I understand they can't be included in the document, but is there a way to reference images by URL and have them shown when it is opened?
Thanks
-c
|
|
|
|
|
GibbleCH wrote: Excel 2003 xml file
Excel 2003 doesn't support XML as a workbook format. I don't get what you're really trying to do.
|
|
|
|
|
|
Hmm...I had no idea.
Well, depending on how you're doing this, it may or may not be supported. If you are trying to embed the image data directly into the XML, it's not supported. If you are using an external file to store the image, then you might get away with it. This[^] is the best discussion I could find on the subject.
|
|
|
|
|
I had found that, unfortunately it's using the new SpreadsheetML format in use by Excel 2007, not Excel 2003
|
|
|
|
|
Yeah, I was kind of shocked at what that file really is. Have you tried renaming that file to whatever.ext.zip?? Pretty interesting what you find inside.
|
|
|
|
|
Yes, and I like the format, it's not perfect, but it's fast and relatively simple to create excel files for consumption from your existing data without a dependence on com access to excel.
Unfortunately, it appears I may be stuck with 2003 as we want this doc to be fairly accessible. Which means slow com calls to create the document, unless I can find a way to reference images in the older 2003 SpreadsheetML format
|
|
|
|
|
Hi,I am having one interface which consits of methods that are used in classone and classtwo like:
classone: Interface1
classtwo: Interface1
Because this is having same methods until now iam using the same interface for classone and classtwo. But now classtwo is having some more additional methods. so, I have included that methods declaration in Interface1 the problem is classone do not require this new methods but only for the sake i have kept in interface and iam inheriting classone form Interface1. I need to write the implementation of this methods in classone also like
Class Classone:Interface1
{
public void MethodName1()
{
// No implementaion require for this method in Classone
}
}
Class Classtwo:Interface1
{
{
// implementation is there for this class;
Console.WriteLine("Welcome to Classtwo");
}
}
Now my doubt is in this situation the way I am doing is correct or wrong.
If such situation comes do i need to have two separate interfaces for each one of the class. which way is good. Please help on this.
Md.Karimulla
|
|
|
|
|
The Interface should only specify those members that all implementations must have.
The classes may have members that are not in the interface.
|
|
|
|
|
HI, thanks for your reply.
Because iam using the same interface for the two classes. In which classone require some methods and classtwo requires some methods from the interface.
Previous the methods are common for both the classes so it is fine.
Now my problem is do i need to have to separate interfaces, one for each class.
Md.Karimulla
|
|
|
|
|
Do you really need your classes to implement an interface? I don't think you do...
If you must have an interface and then implement it, create interfacetwo that inherits interfaceone , and add the additional methods in interfacetwo .
|
|
|
|
|
interface is like "template" for your class, if your classes implement that interface, both of your classes must implement all methods and properties defined in it.
so if your "class one" have some methods other than defined in the interface and these methods only use for "class one" then just add them in "class one" and no need to create them in your interface, vice versa.
But you must be aware for casting that object. i.e:
public inteface MyInterface{
void IntefaceMethod();
}
public class ClassOne : myInterface
{
public void IntefaceMethod(){
}
public void ClassOneMethod(){
}
}
public class ClassTwo : myInterface
{
public void IntefaceMethod(){
}
public void ClassTwoMethod(){
}
}
MyInterface one = new ClassOne();
MyInterface two = new ClassTwo();
one.IntefaceMethod();
two.IntefaceMethod();
((ClassOne)one).ClassOneMethod();
((ClassTwo)two).ClassTwoMethod();
hope it helps
dhaim
ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro"
in the front line gave a lead, in the middle line build goodwill, in the behind give power support
|
|
|
|
|
mdkarimulla wrote: Now my problem is do i need to have to separate interfaces, one for each class.
What are you trying to achieve?
|
|
|
|
|
I dont think you should keep a single class specific methods in the interface. If you do so, then whole purpose of creating interface is lost IMHO. In case you really want to have something like this, then you can go for Abstract class but it will then not allow you to inherit any other class. The abstract class might look like this:
abstract class SomeClass {
abstract public void CommonMethod();
public void Class1_Method(){
}
public void Class2_Method(){
}
}
But then also the purpose of having an abstract class goes in vain IMHO.
Loading signature. Please wait...
|
|
|
|
|
mdkarimulla wrote: I need to write the implementation of this methods in classone also like
If you have to implement something only to fulfill syntactical requirements, then you can be absolutely sure that something is wrong! Always and ever, no exception!
In your specific situation, you can do one of two things:
Make a new interface Interface2 that inherits from Interface1 . Then implement Interface1 in ClassOne (in other words: just leave it as it is...). In Interface2 you declare all the additional methods that you need for ClassTwo . Then let ClassTwo implement Interface2 instead of 1 . This solution of the problem uses Inheritance (it's specializing a certain behaviour).
You can achieve the same by using Aggregation (adding up certain groups of behaviour): Let Interface2 declare only the additional methods and let ClassTwo implement both interfaces.
Generally, it is said that Aggregation should be preferred over Inheritance, but that's not a strict rule but merely a general guideline. It depends fully on what sounds more reasonable when you try to describe it in natural language.
Regards
Thomas
www.thomas-weller.de
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Programmer - an organism that turns coffee into software.
|
|
|
|
|
Without knowing the exact requirements, I'd just add the additional methods into classtwo and leave the interface as is.
Keep It Simple Stupid! (KISS)
|
|
|
|
|
Is it possible for the GC to collect a static variable if it determines that no further references to it exist? For example:
class LockFile {
static FileStream lockFile;
static LockFile ()
{
lockFile = File.Open(".lock", FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);
}
} If the LockFile class is being loaded somewhere in my code, could the file stream be collected before AppDomainUnload?
|
|
|
|
|
AFAIK, static variables are not garbage collected. It will be cleaned up when the application domain unloads.
|
|
|
|