|
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!
|
|
|
|
|
Hi,
I'm writing a program on the .NET compact framework to connect to the MPD musicplayer via a wifi connection. When I run the program from the simulator it runs fine. However when I deploy the software on the real device, I see the strange fenomenom, that I get the same data back from the the Networkstream object twice (even when connected through the active sync app). I checked the network traffic and I can see no errors there, the messages are correctly in sync. The stream.read method however returns the same data twice, when I do a re-read the correct message is received and the software runs smoothly furtheron. I disabled the optimizer, played around with the socket options, without any result. Adding delays between send and receive doesn't help either, however I do see a difference in debug and release versions. Stepping through the code does not show the problem anymore.
// the code i use to send and receive
protected void sendCommand(string command)
{
if (stream != null)
{
mLock.WaitOne();
OnLog(">>" + command + "\r\n");
byte[] sendBytes = System.Text.Encoding.ASCII.GetBytes(command + "\r\n");
connection.GetStream().Write(sendBytes, 0, sendBytes.Length);
}
}
protected string readResponse(bool check)
{
if (stream != null)
{
byte[] myReadBuffer = new byte[connection.ReceiveBufferSize];
NetworkStream myStream = connection.GetStream();
StringBuilder response = new StringBuilder();
int numberOfBytesRead = 0;
if (stream.CanRead)
{
do
{
numberOfBytesRead = myStream.Read(myReadBuffer, 0, myReadBuffer.Length);
response.Append(Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead));
commander.addDatatrafic(numberOfBytesRead);
}
while (myStream.DataAvailable && numberOfBytesRead > 0);
OnLog("<<" + Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead) + "\r\n");
response.Replace("\n", "\r\n");
if (check)
{
if (!checkOK(response.ToString()) && !checkFailed(response.ToString()))
{
response.Append(readResponse());
}
}
mLock.ReleaseMutex();
//lastresponse = response.ToString();
return response.ToString();
}
return "";
}
else
{
return "";
}
}
Anybody any ideas?
Regrards,
eric
modified on Monday, April 14, 2008 4:45 PM
|
|
|
|
|
Hi there,
i have an application developed for Windows Xp on VS2003 which uses Microsoft.ApplicationBlocks.Data.dll. Now i wish to migrate the application to windows vista for which i first need to migrate my code to VS2005. i want to know whether Microsoft.ApplicationBlocks.Data.dll is compatible to VS2005 and subsequently Vista. If no, then what are the workarounds or what else should i do.
Hope for help
Best Regards,
Mustanseer
|
|
|
|
|
It depends on the version of the ApplicationBlock you're using, not the name of the .DLL. But, generally speaking, yes, it'll work.
|
|
|
|
|
Well, he asked in three forums, and finally got an answer
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 )
|
|
|
|
|
Christian Graus wrote: Well, he asked in three forums, and finally got an answer
Damn - he broke the duck.
|
|
|
|