|
Hi everybody
I'm creating my own trackBar control.
Basically, I need to draw a rectangle that has four rounded corners.
When I reach to the point in the rectangle filling that I need to draw a rounded edge and make sure that it will be filled, how can I do it?
thanks
|
|
|
|
|
GraphicsPath.CloseFigure() did it for me.
Example (rounded rect):
GraphicsPath path=new System.Drawing.Drawing2D.GraphicsPath();
path.AddArc(arc, 180, 90);
arc.X=baseRect.Right-diameter;
path.AddArc(arc, 270, 90);
arc.Y=baseRect.Bottom-diameter;
path.AddArc(arc, 0, 90);
arc.X=baseRect.Left;
path.AddArc(arc, 90, 90);
path.CloseFigure();
and now you can do Graphics.DrawPath or FillPath.
Luc Pattyn
|
|
|
|
|
thanks man
|
|
|
|
|
I am developing an application that will log messages coming from n-number of clients. we cannot predict the number of clients. The application is being developed using .Net Remoting. whenever, i tries to run 3-4 clients, memory goes increasing of server for each addition of client. that means on every addition of client server memory and CPU usage increases. How can i control the increase of memory and CPU usage.
The logs are coming at a very fast rate.
Thanks in advance
Praveen Raghuvanshi
Software Engineer
|
|
|
|
|
praveen raghuvanshi wrote: How can i control the increase of memory and CPU usage.
Not sure you can with remoting. If you can it would likely involve much more development than usual for using Remoting. Given your problem domain (logging) and your memory usage concern, perhaps using Message Queues would be a better approach?
led mike
|
|
|
|
|
I need to read a file with Russian words to an array. But instead I get a lot of empty lines. I tried the sample code from MSDN (below) to find the problem. The result was the same - just empty lines.
using (StreamReader sr = new StreamReader("c:\\input.txt"))
{
String line;
while ((line = sr.ReadLine()) != null)
{
Console.WriteLine(line);
}
}
Will you be so kind to help me understand what to use when working with Russian (non Latin) characters, words?
Any suggestions are welcome. Thanks.
|
|
|
|
|
Hi
For some reason, if you initialize a StreamReader with the Constructor Streamreader(string) , it will use Encoding.UTF7 .
if you want to use russian Encoding, you will have to use Streamreader(string,System.Text.Encoding) Constructor.
if your default Encoding on the PC is the Russion Encoding just do it this way:
<br />
using (StreamReader sr = new StreamReader("c:\\input.txt",System.Text.Encoding.Default))<br />
{<br />
String line;
while ((line = sr.ReadLine()) != null)<br />
{<br />
Console.WriteLine(line);<br />
}<br />
}<br />
otherwise you can Create an Encoding with the appropriate Codepage ID
Greets
M@u
|
|
|
|
|
M@u thank you very much. Your suggestion solved the problem. Now I will have to figure out how to do the same but in cases when Russian is not the default language. Probably I will have to learn how to "Create an Encoding with the appropriate Codepage ID". Thanks again. Very helpful.
|
|
|
|
|
Hi..
to create a Codepage by ID or Name you do the following:
<br />
System.Text.Encoding myEncoding = System.Text.Encoding.GetEncoding(encodingName);<br />
or
<br />
System.Text.Encoding myEncoding = System.Text.Encoding.GetEncoding(codePage);<br />
where encodingName is a string and codePage is an int.
you can find out the name of your current defaultEncoding by saying
<br />
System.Windows.Forms.MessageBox.Show(System.Text.Encoding.Default.Name);<br />
or the codepage with
<br />
System.Windows.Forms.MessageBox.Show(System.Text.Encoding.Default.CodePage);<br />
if you want to use a different Encoding check http://msdn2.microsoft.com/en-us/library/system.text.encoding(vs.80).aspx[^].
here you'll find a list with all supported encodings.
Greets.
m@u
|
|
|
|
|
Thanks again! Quick and comprehensive! I'll try that!
|
|
|
|
|
Hi all,
As a part of my application, I'm writing a serial comport driver. This means lots of bytes will be coming in, and I was considering using a generic Queue<byte> to store the incoming data for a while. But I'm really wondering how efficient this is. Does anyone know how the System.Collections.Generic.Queue class performs?
Thanks in advance for any help or suggestions on this...
Standards are great! Everybody should have one!
|
|
|
|
|
Bekjong wrote: and I was considering using a generic Queue to store the incoming data for a while.
I would rather implement this in a byte buffer rather than using the Queue class.
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
Marc Clifton wrote: I would rather implement this in a byte buffer rather than using the Queue class.
Well the whole point is that I would rather use the Queue class for it's advantages (dynamic sizing, handy dequeue method that drops the bytes I dequeue, etc). I can of course always allocate a byte array as a buffer, that'll perform for sure, but I like the Queue class for these advantages...
Standards are great! Everybody should have one!
|
|
|
|
|
It should perform quite good, if you just set the capacity large enough so that it doesn't have to grow the internal array.
---
single minded; short sighted; long gone;
|
|
|
|
|
Ok, sounds logical... Thanks. Now that I'm at it, would you happen to know if an AutoResetEvent consumes any processor cycles while I'm calling WaitOne() on it?
Standards are great! Everybody should have one!
|
|
|
|
|
No, I don't.
---
single minded; short sighted; long gone;
|
|
|
|
|
I havent seen the internals, but I trust Auto/ManualResetEvent to be fully event driven,
i.e. non-polling. The Windows kernel has the necessary primitives to do this (such as
WaitForSingleObjectEx).
Luc Pattyn
|
|
|
|
|
Yes. WaitOne must at some point check the status of the event it is monitoring, though it is a minimal drain in the overall scheme.
only two letters away from being an asset
|
|
|
|
|
Thanks for the help, I figured the same but just wanted to be sure.
Standards are great! Everybody should have one!
|
|
|
|
|
When you refer to queues, I trust you intend to put either byte[] or text lines in there,
not single chars or bytes.
Luc Pattyn
|
|
|
|
|
Luc Pattyn wrote: When you refer to queues, I trust you intend to put either byte[] or text lines in there,
not single chars or bytes.
Yep. Thanks again.
Standards are great! Everybody should have one!
|
|
|
|
|
Hi
I am creating a windows application.In this I want to display master detail in one grid.Means i want to place one child grid in parent grid.I searched it on msdn and google but examples are using two grids.One dedicated for master and other one for child.I want to give this functionality in one grid.Deatils may appear by clicking + sign of parent record or ?????
any idea or any help????????????????????
|
|
|
|
|
I know Infragitics grid works this way, but I don't know of any free components.
only two letters away from being an asset
|
|
|
|
|
Do you mean by this that it is not possible with build in datagridview control in C# or i keep on searching?
|
|
|
|
|
Correct
only two letters away from being an asset
|
|
|
|