|
I seem to have found a bug in ListView.Items.Insert(int,ListViewItem).
Could someone please try reproduce this? Maybe I could get a bug report submitted.
(Problem seems to occur on 2.0 and 3.5)
Steps to Reproduce:
1. Start a new project
2. Add a ListView with five items in it.
3. Label them 1 to 5 so we can see what happens.
4. Add a Button.
5. Add the following code to Button.Click:
ListViewItem item4 = this.listView1.Items[3];<br />
item4.Remove();<br />
this.listView1.Items.Insert(0, item4);
The items should be arranged like this:
4 - 1 - 2 - 3 - 5
Instead we see this:
1 - 2 - 3 - 5 - 4
Workaround:
I have found if we switch to View.Details before doing the remove/insert then everything works fine.
Replace the code in Button.Click with this:
ListViewItem item4 = this.listView1.Items[3];<br />
View oldView = this.listView1.View;<br />
this.listView1.BeginUpdate();<br />
this.listView1.View = View.Details;<br />
item4.Remove();<br />
this.listView1.Items.Insert(0, item4);<br />
this.listView1.View = oldView;<br />
this.listView1.EndUpdate();
www.wickedorange.com
www.andrewvos.com
|
|
|
|
|
Does the same thing here
"An eye for an eye only ends up making the whole world blind"
|
|
|
|
|
Thanks for checking it out. What version of .NET?
www.wickedorange.com
www.andrewvos.com
|
|
|
|
|
that was using .net 2
"An eye for an eye only ends up making the whole world blind"
|
|
|
|
|
Works, thanks a lot. I am using VS 2010 prof. and had the same problem. Using above code fixed it.
|
|
|
|
|
Hello,
I want to draw two lines which are mitered at the corners (see: http://www.kever.com/images/corners.jpg).
As you can see both lines have different properties (like color) and can even be of different widths. Therefore I draw each line separately (using Graphics.DrawLine and not DrawLines).
My idea is to create a pen with a custom end cap so that the endpoints have a 45 degrees angle.
Anybody knows how to setup a CustomLineCap to achieve this?
Kees
|
|
|
|
|
I am using Crystal Reports for Visual Studio 2005 for making a report including barcodes (Code 39). Whenever the report is generated it does not show the barcode, instead it shows the plain string. I have to export the report to word or pdf to make it show barcodes and then print it. What could be wrong??
|
|
|
|
|
Hi,
I have a long-running application that that periodically outputs the values of many internal fields/variables to a log file.
These variables used to all live in one class, but as the application grew and functionality was added, they became spread out across classes.
The hack-ish solution is to have globally accessible references to the instances of the classes in question, with each class having public properties for the variables. I feel that this is ugly and breaks OO abstraction.
Furthermore, this setup doesn't fix the base problem of seeing when/where things go wrong. Once I see an exception I have to filter through lots of logs to find any evidence of inconsistent state.
What I really want is some kind of global statistics tracking package, where I could do something like the following:
Statistics.AddValue<float>("average.requests.time", 0.0);<br />
Statistics["requests.served"]+= 1.5;<br />
<br />
Predicate<float> p = delegate(float val) { return val > 1; };<br />
Statistics.AddConditionalListener<int>("requests.served", p, <br />
delegate() { Console.WriteLine("why so slow?"); } );</int></float></float>
Basically, a class/package that would store have a name->value mapping, have nice update syntax with operator overloading, and allow you to add listeners for conditions you specify. Oh, and allow you to use a value of any base type, using generics =).
Is there something like this out there? Or, are there classes built into the .NET framework that would let me do this easily (e.g. however conditional breakpoints work?).
|
|
|
|
|
Sounds to me like a use for several of the windows application blocks in the Enterprise library, specifically the logging application block and maybe some custom code built on that.
Also maybe making use of performance counters?
http://msdn2.microsoft.com/en-us/library/aa480453.aspx[^]
|
|
|
|
|
|
This might be a different approach to the problem, but...
What immediately comes to mind is the use of some custom attributes. You might also want to check out the Spring.NET framework. There's a lot you could do with some of the functionality in that framework. This very much sounds like a cross-cutting concern, for which aspect-oriented programming would be well suited.
BW
|
|
|
|
|
Hi,
i have one windows service & i created one setup for windows service using VS.NET 2005. After adding project output getting following error.
"The following files may have dependencies that cannot be determined automatically.
Please confirm that all dependencies have been added to the project.
c:\winnt\system32\shdocvw.dll"
If i build setup getting build error Error
"'shdocvw.dll' should be excluded because its source file 'C:\WINNT\system32\shdocvw.dll' is under Windows System File Protection."
How to resolve please help me.....
Ramana
|
|
|
|
|
Hi everybody!
This is my question (may be a very unprofessional one): when I make a project in Visual Studio and add a reference to some dll file and complete the project( by here every thing is OK!),so the program runs in my system as I want,BUT! as you know if I want to pick the project up and run it in another system so I should add and reference the dlls again. Is there some professional way to add dlls once and the program could be run on every system whitout being worry about adding dlls?
thanks in advance
|
|
|
|
|
Well what dlls are you referencing? If they're part of the .NET framework then they will come with the framework.
www.wickedorange.com
www.andrewvos.com
|
|
|
|
|
I assume you're talking about your own dlls, not framework ones. The professional way is to ship the dlls with the product.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
thank you for your reply
as you mentioned, I am talking about my own dlls (sorry for forgotting to say it. it would be very kind of you if you say what do you exactly mean with "ship the dlls in the product", whould you please explain it a little more.
I thank you again.
|
|
|
|
|
It's pretty straightforward. You choose to write code in a dll, or within the main app. If it's in a dll, then whoever runs the app, needs that dll. So, you have to make sure all your users have the dll. If you don't want it to be a dll, you need to move the code into your exe itself.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi all,
I'm trying to find a way to draw a sort of section of a pie.
Check this image:
http://img186.imageshack.us/img186/9095/piesectionsqv7.png[^]
I'm trying to draw an antialiased line around the blue section.
I have filled that blue section by adding a pie to a path, then adding another pie using the size of the inner circle, which effectively removes the inner ellipse area.
I can't get the same code working for drawing a border line.
The only other way I can think of is using regions and Exclude, but this will break antialiasing. Am I missing something here?
PS. I can't change my draw order, because the image could contain transparent sections.
Thanks in advance
www.wickedorange.com
www.andrewvos.com
|
|
|
|
|
Err, sorry I didn't see GDI+ when I hovered over the Graphics section
www.wickedorange.com
www.andrewvos.com
|
|
|
|
|
Hmmm. This is a tad messy, but it works:
<br />
public class PieWithExclusionEllipse : IDisposable {<br />
private GraphicsPath path;<br />
public GraphicsPath Path { get { return this.path; } }<br />
public PieWithExclusionEllipse(Rectangle pie, float startAngle, float sweepAngle, Rectangle exclusionEllipse) {<br />
GraphicsPath outerLine = new GraphicsPath();<br />
GraphicsPath innerLine = new GraphicsPath();<br />
<br />
outerLine = new GraphicsPath();<br />
outerLine.AddPie(pie, startAngle, sweepAngle);<br />
<br />
if ((exclusionEllipse.Width != 0) && (exclusionEllipse.Height != 0)) {<br />
outerLine = this.removePointFromPath(outerLine, 0);<br />
outerLine = this.changePathPointType(outerLine, outerLine.PointCount - 1, PathPointType.Bezier);<br />
innerLine.AddPie(exclusionEllipse, startAngle, sweepAngle);<br />
innerLine = this.removePointFromPath(innerLine, 0);<br />
innerLine = this.changePathPointType(innerLine, innerLine.PointCount - 1, PathPointType.Bezier);<br />
innerLine.Reverse();<br />
outerLine.AddPath(innerLine, true);<br />
outerLine.CloseFigure();<br />
}<br />
<br />
this.path = outerLine;<br />
}<br />
private GraphicsPath changePathPointType(GraphicsPath path, int pointIndex, PathPointType pointType) {<br />
List<pointf> points = new List<pointf>();<br />
List<byte> pointTypes = new List<byte>();<br />
<br />
for (int index = 0; index < path.PointCount; index++) {<br />
points.Add(path.PathPoints[index]);<br />
<br />
if (index == pointIndex) {<br />
pointTypes.Add((byte)pointType);<br />
}<br />
else {<br />
pointTypes.Add(path.PathTypes[index]);<br />
}<br />
}<br />
return new GraphicsPath(points.ToArray(), pointTypes.ToArray());<br />
}<br />
<br />
private GraphicsPath removePointFromPath(GraphicsPath path, int removeIndex) {<br />
List<pointf> points = new List<pointf>();<br />
List<byte> pointTypes = new List<byte>();<br />
<br />
for (int index = 0; index < path.PointCount; index++) {<br />
if (index != removeIndex) {<br />
points.Add(path.PathPoints[index]);<br />
pointTypes.Add(path.PathTypes[index]);<br />
}<br />
}<br />
return new GraphicsPath(points.ToArray(), pointTypes.ToArray());<br />
}<br />
<br />
#region IDisposable Members<br />
<br />
public void Dispose() {<br />
if (this.path != null) {<br />
this.path.Dispose();<br />
}<br />
}<br />
<br />
#endregion<br />
}<br />
</byte></byte></pointf></pointf></byte></byte></pointf></pointf>
www.wickedorange.com
www.andrewvos.com
|
|
|
|
|
Why don't you use ZedGraph? there's an article posted on CP about it.
"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
|
|
|
|
|
How can I have the results from a GridView or DetailsView e-mailed when the user inserts or updates their record?
Thanks for the help
|
|
|
|
|
I guess by building a table out of the data source and sending a HTML mail
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Do you mean sending rendred output of gridview/details view ? You need to work with RenderControl() method. Here[^] is an article.
|
|
|
|
|
I had not seen this article but it sounds like what I need.
Thanks for the help!
|
|
|
|