|
Dany Ramos wrote:
I see a C++ project which it is possible to introduce a separator.
It can be done in C# too. But you need to subclass the control. That article you mention syas how he did it, by subclassing the control and using WM_CTLCOLOR message to paint the separator; that is to avoid the use of an ownerdrawn combobox, which is a much more work for something so simple.
Alternatively you could try writing an ownerdrawn control. I've never done this myself so I can't offer much help. But for a start, see the documentation for the DrawMode property and DrawItem event of the ComboBox control.
It'd go something like this: set the DrawMode to OwnerDrawFixed when you create the item. Insert your separators as a regular item with " " as text. When you get the DrawItem event for your separator, draw a single line in the middle of the rectangle. When you get that event for a regular item, check its State to see if it's selected or not, and paint it accordingly.
Dany Ramos wrote:
Do you know how to convert a c++ project in c#?
It's not possible to convert a C++ projecto into C# automatically (at least not in the general case.) But you can see how it's done in C++ and reimplement it in C#.
I hope this helps,
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hi all.
I'm writing an application where I have a few forms linking up events to other form's methods. I have to manage this eventhandlers clean up to kill any reference I might have through the events when i close one of the forms.
My first approach was calling a disposeEvents() method from the Dispose(bool dispose) method on each form and unlinking (-=) al eventhandlers.
I was just wondering if this could be done by simply callinh myForm.Events.Dispose()? or is it better to do it as I have it right now and unlink one by one all eventhandlers that point to an object outside myForm?
thnks.
|
|
|
|
|
Hi,
My code draws a large graphic (e.g. a rectangle) and the window initially displays only part of it because the window size is small. When I enlarge the window, it will show the whole graphic. However, instead of enlarging the window, if I scroll the scroll bar to the right, then the graphic will be redrawn so I always can only see the first part of the graphic and cannot see the remaining part. How can I fix this display problem to see the whole graphic? Thanks in advance for your help.
|
|
|
|
|
Read "Professional C# - Graphics with GDI+" here at cp.com.
Should be: http://www.codeproject.com/books/1861004990.asp
Cheers
Sebs
|
|
|
|
|
I need an Information icon (similar to System.Drawing.SystemIcons.Information) but I need to resize it down to (16,16), does anyone know how I go about doing this in C#?
|
|
|
|
|
I want to invoke the format command of OS(XP) im my C# code:
string VolumeName = "UDISK";
string FormatW2K = "CMD.EXE";
string FormatW2KParam = string.Format("/C \"format.com {0}:/q/x/V:{1}\"",driverletter,VolumeName);
Win32.ShellExecute((IntPtr)0,"open", FormatW2K, FormatW2KParam, string.Empty, Win32.SW_SHOW);
I have got two problems:
1,the format function always compels me to click the Enter key to go on the format operation.I want to my code can do it for me.So,my program will invoke the Format command and do format operation automatically and never bother me.Then how to realize my dream?
2,When the Format command has been invoked,my program automatically perform the following code no matter if the format operation finished or not.But I hope that the following code should be perform as long as the format operation finished.So,how to settle this problem?
Thanks!
|
|
|
|
|
Hi ,
Yeah I m facing one major problem in my project.Here is the situation in which i want help.
Suppose there is one plane page in which one image of Rectangle is placed but it is any where in the page.Now i have to find out the location of that Ractangle in page.For that i m finding any three corner point(in co-ordinate).
by that i can findout the ractangle.
but major problem is that how to find out exact location of that ractangle in a page?
if any one have any clue the tell me.
Regards.,
Hteen24
|
|
|
|
|
You can also construct a Point object by passing a Size object. In this case, the Size object's width will become the abscissa of the Point, and the Size object's height will become the ordinate of the Point object. For example:
Size mySize = new Size(13, 133);
Point myPoint = new Point(mySize);
System.Console.WriteLine("X: " + myPoint.X + ", Y: " + myPoint.Y);
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Does anyone know how to reliably compare two .NET exe files to see if they are the same (except for time stamps and version information)?
I have several C# projects that I build and I would like to compare results of different builds to see if anything has changed. I am testing by doing two complete rebuilds of a C# project one right after the other and comparing the two resulting exe files. But every test I run finds the files to be different.
Fc doesn't work. WinDiff doesn't work. Beyond Compare 2 doesn't work. The 'dumpbin /rawdata' trick doesn't work. Even the BinDiff.exe in Windows 2003 Server doesn't work (however it does work well with many non-.NET exe files I have tried).
Any other suggestions?
Thank you,
Ray Gregory
|
|
|
|
|
|
WinDiff does the job. It is shipped with the Platform SDK on MS web site. It's free.
|
|
|
|
|
No, it doesn't work. Remember, he's comparing binary EXE files, not the source files.
--
Weiter, weiter, ins verderben.
Wir müssen leben bis wir sterben.
I blog too now[^]
|
|
|
|
|
WinDiff DOES binary comparison.
There is no spoon.
|
|
|
|
|
But how do you easily see which binary differences aren't logical differences?
--
Weiter, weiter, ins verderben.
Wir müssen leben bis wir sterben.
I blog too now[^]
|
|
|
|
|
Ray Gregory wrote:
Does anyone know how to reliably compare two .NET exe files to see if they are the same (except for time stamps and version information)?
In addition to what Daniel wrote (and in case you don't necessarily need to compare/view the C# code) you could use the IL disassembler from the SDK to disassemble the exe files and compare that. Basically the same suggestion as the one Daniel made but without installing new tools.
ildasm foo.exe /out=foo.il
Best regards
Dennis
P.S. A really cool open source diff tool I use instead of WinDiff is WinMerge[^].
|
|
|
|
|
Informex has recently moved into beta a tool called IXSnapIn Assembly that allows you to compare .NET Assemblies on local and remote machines. You can compare .NET Assemblies in the GAC or filesystem and results are displayed visually. It's still in an early stage but it may help.
Visit http://www.ixsnapin.com/IXSnapInAssembly.aspx for more information and to download it.
Disclosure: I work for Informex, the developer of this tool.
Glenn Lewis
|
|
|
|
|
Hi all
Can any one explain why C# does not suport for overloading =,.,sizeof,new operators? I am in the need to overload the operator '='.Is there any other way to redifine the functionality of '='.
M.Sendilkumar
|
|
|
|
|
Sendilkumar.M wrote:
Can any one explain why C# does not suport for overloading =,.,sizeof,new operators? I am in the need to overload the operator '='.Is there any other way to redifine the functionality of '='.
Probably because the environment is garbage collected. Those operators you describe are tipically used when you need to implement your own memory management mechanism in C++. This is simply not possible in C#.
About the '.' operator (in C++, the '->' operator), you don't need it because C# has property get/set pairs, so it's a much more elegant and simple solution to the same problem.
Yes, even I am blogging now!
|
|
|
|
|
|
Hi,
From webpage
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/battery/hh/battery/UPS_mini_10660b09-2746-44ea-9f27-5523677ae09e.xml.asp
it says that there is a sample UPS minidriver in the XP DDK at src/general subdirectory. However, my XP DDK has no such directory/subdirectory. It may be that it is old (original XP) and I have ordered the new SP2 version, but in the meantime, does anyone know what this file's name might be or where it might be located in the original XP DDK? If you could provide me with that information or a copy of the file, it would be much appreciated.
Thanks,
Tom
|
|
|
|
|
I have a class where I override GetEquals(), == and != and now need to override GetHashCode(). The class in question has only string data members. Any tips on how to generate a "good" hash code? (I assume I call GetHashCode() on each of the strings then somehow munge the results together, but what's the best way to do that--with my luck, I'll pick a method that results in zero half the time.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
|
In addition to what Daniel said, you should also take a look at a few examples of similar classes by viewing some of your favorite (and similar) classes in ildasm.exe that installs with the .NET Framework SDK or a decompiler like the .NET Reflector[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello gurus,
I would like to know if there is a data importer in .NET like in the excel's or access' "Import Data" option? Or must I reinvent the wheel?
As most software have this "Import Data" I guess it's already built in .NET but where is it?
Which class does that? I feel this functionality of data import exist in the framework.
Thanks for the answers.
Best regards.
There is no spoon.
|
|
|
|
|
The .NET Framework base class library (BCL) is just that - a class library. It does not - and should not - contain such functions as data import, but should - and does - facilitate it. That's what a base class library is for. It's not a piece of software like Excel - which is a functional product.
Besides, into what format are you importing data? There's no standard format in .NET for data like an XLS for Excel or something. The only thing that comes close is to import data from either a database or an XML file (the serialized representation) into a DataSet . Importing data into your own classes is specific to your implementation.
The BCL facilitates that through I/O classes, data readers and adapters, the DataGrid , and just about anything else you can use to import and manipulate data. How you do that depends on your requirements, but there are classes to help that like the FileStream , the TextReader , a DataReader derivative, the DataAdapter derivatives, and many, many more.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|