|
O.k. Thanks for your help
|
|
|
|
|
Friends,
I've been searching for a solution to a problem for 2 days on Google and forums but couldn't succeed. The problem is how do I get the ListView selection highlight style as it is in VS .NET menus. There is an article "TreeListView" here http://www.codeproject.com/cs/miscctrl/treelistview.asp[^] that has this feature but it's a little complicated for me to distinguish this feature from rest of the code.
This is my 3rd post on the same subject and will be the last - so please forgive me.
Thanks.
Radgar
"Imagination is more important than knowledge." - Albert Einstein
|
|
|
|
|
There is no such property. The control uses the system's Display Properties/Appearance colors to draw the highlights.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave, thanks for your time but I never said the control has the property. If it had, I'd never have asked this question, would I? The control can be inherited and/or custom-drawn via some Windows APIs or so.. I know it's possible and I gave a link of an example actually. But that example has too crowded code which is hard for me to pick the parts I need. Don't get me wrong but please read the post fully next time before answering because now my post seems like answered to other users who possibly has the correct solution I need.
Radgar
"Imagination is more important than knowledge." - Albert Einstein
|
|
|
|
|
Radgar wrote:
Don't get me wrong but please read the post fully next time before answering because now my post seems like answered to other users who possibly has the correct solution I need.
I did. The solution IS to ownerdraw the entire control and use the colors you want, not the system. If the example that you found is too much to wrap your brain around all at once, pick it apart. Try certain things and see what they do. Because nearly all of what you saw in the example is what your going to have to go through to get the functionality you want. The question you show now be asking yourself is "Is this worth it?"
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I need information about web pages that rent coders.
Thanks for your time
|
|
|
|
|
The Code Project isn't one of them. Thank you Chris!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I have two sockets and i want to transfer a struct object.How can i convert object to binary abd vice versa?Thanks for you time.
Wanna be C#
|
|
|
|
|
hii,that's too simple in c# first add Serializable attrubite before your struct
[Serializable]
struct YourStruct
{..}if struct also contains (nested) other structs objects. thier structs also must have Serializable attrubite then
using System.Runtime.Serialization.Formatters.Binary;
using System.IO
BinaryFormatter bin=new BinaryFormatter();
MemoryStream memory=new MemoryStream();
bin.Serialize(memory, yourStructObject);
byte[]data=memory.GetBuffer();//your struct in bytes
//to Reverse operation:
memory=new MemoryStream(data);
memory.Seek(0,System.IO.SeekOrigin.Begin);
yourStructObject=(YourStruct) bin.Deserialize(memory);
marcoryos
|
|
|
|
|
Thank u man..thanks a lot.That was simple and very specific
|
|
|
|
|
hii,i want to transfer a file from two hosts using Tcp protocol but the problem is i don't know the suitable transfer rate (the connection speed between those hosts)
felopater
|
|
|
|
|
|
The previous post is correct. Are you, perhaps, referring to the send and receive buffer sizes instead? That would reflect the largest "chunk" size that could be sent or received by the server and client.
If you're really referring to line speed then there's not a lot you can influence merely by using sockets or not.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
I have a problem here with an exception.
<br />
try<br />
{<br />
... some code ...<br />
Exception appears here<br />
}<br />
catch(Exception ex)<br />
{<br />
... some code ...<br />
(go back into try block, but how ?)<br />
}<br />
After exception was thrown, application should continue code processing in the try block. Is it possible to avoid processing a special error with given error number ? Otherwise, code processing will be interrupted and application close this process.
|
|
|
|
|
you can try the following
public void HandleException( Exception ex )
{
... Do something, as in old catch ...
... some code ...
}
try
{
... some code ...
try
{
// Where exception appears
}
catch(Exception ex)
{
HandleException( ex )
}
}
catch(Exception ex)
{
HandleException( Exception ex )
}
CodeMadness - Code before you go mad!
|
|
|
|
|
Seraphin wrote:
application should continue code processing in the try block
Make your try blocks smaller.
So if you have
try
{
}
catch(Exception ex)
{
} Change it to:
try
{
}
catch(Exception ex)
{
}
try
{
}
catch(Exception ex)
{
}
try
{
}
catch(Exception ex)
{
}
Or a better solution would be to refactor your code so that item 1, item 2 and item 3 individual private methods that get called, each of which has their own try/catch block.
Does this help?
Cada uno es artifice de su ventura
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
|
|
|
|
|
|
A perfect example of when/why goto should NEVER be used! I haven't used GOTO since, what, 1992?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Wow. I can't believe you would seriously suggest someone use this. Part of the advantage of methods written in a language like C, C++ or C# is that they are by nature "fall-through". No artificial flow interruptions, reroutes, twists, turns or gyrations are advised (such as "goto", "gosub" etc.).
This kind of coding reflects poor planning, not good practice. It looks like a (bad) piece of VB 6 code.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Maybe you should use IlDecompiler and look at the IL generated from some of your nice 'fall through' c# code. I think you'll find it is liberally sprinkled with goto's. The closer you get to the machine, the more useful and sensible goto gets to be.
what is gosub other than a void method call? is goto really any different than
if(true)<br />
...<br />
else<br />
...
I would agree that if-else is preferable for clatity: the brace blocks are clearer than a lable, but the result is no different: code branches to a new location under some conditions.
In leppies example, if there were multiple try-catch blocks in the same function, a goto and a common cleanup code block would be preferable for maintainability to repeating the code in each catch block...
Anger is the most impotent of passions. It effects nothing it goes about, and hurts the one who is possessed by it more than the one against whom it is directed.
Carl Sandburg
|
|
|
|
|
I was commenting on the code example provided. In the example, if an error is generated after the RESTART label, the code will loop indefinitely. That, to me, was a perfect example of why not to use the goto. It leads to bad code.
I'm not disputing whether IL contains goto calls. I am contending that at the time the IL is compiled, there are no nonsensical looping calls made if the developer has constrained him/herself to using the fall-through code style.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
turbochimp wrote:
This kind of coding reflects poor planning, not good practice.
I beg to differ. Show me more readable code, sure you wrap a while around it, or some other way. The fact is goto is clean and simple, and it gives you much better flow control that you can perform via a for/while/etc.
xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
|
|
|
|
|
Until you find a sub with about 20-30 of them in it, then it's just damn ugly and completely unreadable.
Much better flow control? I'd say much more "quick and dirty" flow control. Seriously, I haven't used a single Goto in the last 13 years...
Sure, if you get down to the IL that the compiler generates, yes, you'll find Goto's, or more acurately, Jump's, all over the place. This will happen in lower level languages, but in higher level languages, C# or VB.NET or whatever, using Goto's is an extinct practice, found only in the code of 1st year students.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am inclined to agree with you, since I can't recall needing to use a Goto in a very long time (other than in VB6 of course, where it is mandated by the crude error handling). Goto is rather the flow control of last resort, and will stay around in even high level languages for that last ditch "damn, now what?" situation that once in a very rare while crops up in even the best designed code...
Anger is the most impotent of passions. It effects nothing it goes about, and hurts the one who is possessed by it more than the one against whom it is directed.
Carl Sandburg
|
|
|
|
|
Um...okay...
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|