|
I am making a control, and in that I need to implement a caret. I do have problems with that simple task.
First I just want to be able to place the caret in the end of a custom text. I do like this:
float xpos = gfx.MeasureString(string, font).Width
g.FillRectangle(System.Drawing.Brushes.Black, xpos - 3, 0, 1, this.Font.Height);
There is a problem with this. If I use 333 as the text, it goes fine, but do I use 1111111191, the caret is being placed maybe 5 - 10 pixels from the last 1. It seems to me that the size of 1 is measured larger than it actually is.
What can I do about this problem? Am I attacking this problem from the wrong angle? Is there any implementation already made?
Gooky
|
|
|
|
|
Add caret sign to the end of displayed string in paint method -or- add it to the string in setting Text property and remove it in getting this property.
Hi,
AW
|
|
|
|
|
That is not really a good solution. Having a carrot inside a word, makes it look a little strange when the carrot blinks.
I found a solution using API calls to old GDI.
Gooky
|
|
|
|
|
How to change the back color of a tool bar control?
Thanks
|
|
|
|
|
How can I host a remote object in IIS?
Mazy
No sig. available now.
|
|
|
|
|
|
Meisi wrote:
5- Use internet services manager to create 2 virtual directories for both above mentioned directories.
THanks Meisi, Of course you don't need put client part under IIS, and I think the server part need some exe file to respond to client, does IIS do it?
Mazy
No sig. available now.
|
|
|
|
|
Mazdak wrote:
I think the server part need some exe file to respond to client
That is the second approach.
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
hehe...and also a configuration file to set some properties like setting chanel,namespace and...
Mazy
No sig. available now.
|
|
|
|
|
How to load an image from a url into a PictureBox.
Thank's
|
|
|
|
|
You have to save it as a Bitmap,then set the Image property of PictureBox to it.Something like this:
picturebox.Image = Bitmap.FromFile(urlpath);
Mazy
No sig. available now.
|
|
|
|
|
Damn.. yours is much nicer than what I posted!
-------------------------------
Joan
MomComputerGeek.com
|
|
|
|
|
Mazy
No sig. available now.
|
|
|
|
|
<br />
<br />
string sURL="www.MomComputerGeek.com";<br />
System.Web.HttpRequest objRequest = new HttpRequest("",sURL,""); <br />
Stream objStream = objRequest.InputStream;<br />
PictureBox1.Image.FromStream(objStream);<br />
<br />
-------------------------------
Joan
MomComputerGeek.com
|
|
|
|
|
Thank you for the Code, it's right BUT I'm not using ASP.NET I'm using Windows Forms and the class System.Web.HttpRequest is not valid.
Do yuo know how in Windows Forms (Windows Application).
|
|
|
|
|
Josep Restoy wrote:
class System.Web.HttpRequest is not valid
I think you would just need to reference the System.Web library.
-------------------------------
Joan
MomComputerGeek.com
|
|
|
|
|
I find this code:
string sURL="http://localhost:8080/cercalia/img/dispositius_home.gif";
System.Net.WebClient RequestURI = new System.Net.WebClient();
System.IO.Stream objStream = RequestURI.OpenRead(sURL);
pictureBox1.Image = Bitmap.FromStream(objStream);
This Code Works OK.
Thank you for all.
|
|
|
|
|
After a long time I'm thinking to deal with programming again.
I want to write a math application(many graphics) with incredible many calculations in a little time so I must manipulate numbers(integer and real) as fast as possible.
I remember in "TURBO C" and old processors for fastest access(about two times faster) to integer numbers they should be declared as register and no more than two names otherwise the rest would be ignored.
In nowdays what about in "C#" and huge L2 cache memory of powerfull processors?
Has this capability to do with L2 cache?
I mean can I use L2 cache exclusively for frequently used variable names?
|
|
|
|
|
>I want to write a math program with incredible many calculations in a little time so I must manipulate numbers(integer and real) as fast as possible.
Use FORTRAN.
Seriously, if you want to write an app that does serious number crunching, maybe you'll save some development time by targeting a language that was designed and built to do serious number crunching. C# and .NET were designed to implement business applications. That's not to say they couldn't be used for math-type apps, but managed code doesn't lend itself very well to doing intensive work like that.
Also, if you want to write this app in C# (or any other language for that matter), I would just write the app in the simplest, most obvious way possible. Don't worry about performance right off the bat. Only when you have a working app do you worry about how quickly it runs: time it, profile it, and optimize it then. Trying to tune an application that isn't written yet is an exercise in building castles in the air.
Cheers, Julian
Program Manager, C#
This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
|
|
|
Dear Julian,
I don’t like FORTRAN and I don’t need the solutions to complex math problems that FORTRAN provides.
On the contrary I like C# and I need the speed of executing code and support in graphics mode that C# provides.
My calculations are plain operations but many as many are accesses to data that I have placed in memory. That’s why I want to know if I can access L2 cache memory directly placing there data I use more often.
|
|
|
|
|
Demokritos wrote:
want to know if I can access L2 cache memory directly placing there data I use more often
Perhaps the best is to write a little C lib to handle the crunching, and provide an interface via MC++.
leppie::AllocCPArticle("Zee blog");
|
|
|
|
|
Demokritos wrote:
Dear Julian,
I don’t like FORTRAN and I don’t need the solutions to complex math problems that FORTRAN provides.
On the contrary I like C# and I need the speed of executing code and support in graphics mode that C# provides.
My calculations are plain operations but many as many are accesses to data that I have placed in memory. That’s why I want to know if I can access L2 cache memory directly placing there data I use more often.
Graphics number crunching?
Why not use managed C++ with a directx view embedded. Id your doing 3D representations then it can handle it even better. Although, it make take to long to adapt writing to a buffer and not an actual coordinate. Either way as far as grphics go a directx port would be much faster than GDI+. But embedding directx inside a c# is like putting your car in neutral and trying to race.
If its speed you want go to c++, if its faster coding stay in c# and I would stay away from unsafe code. Its asking for trouble.
My thoughts and opinions do not in any way reflect what I just typed.
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
All right:
- No, you can't access the L2 cache directly. Instead you make sure that your data structures exhibit locality of reference, both in space and time, so try not to use linked lists, or trees, or hash tables, etc. Use arraya.
- I meant what I said: write your code in the simplest, most obvious way possible. Then, and only then, when it's all working and tested, profile it. Find out where your major performance problems lay (if you have any major ones). Then start refactoring with using struct instead of class, creating temp variables, using unchecked or unsafe or both, etc.
- To do the previous part, make sure that you have proper unit tests set up beforehand. Comment changes you make for performance reasons, especially if they're not obvious.
Cheers, Julian
Program Manager, C#
This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
|
|
|
I try to flip metafile ,but I recive this kind of exception:
An unhandled exception of type 'System.NotImplementedException' occurred in system.drawing.dll
Additional information: Not implemented.
|
|
|
|
|
Hi there,
I really hope someone can help me with this one. Here's my problem:
I'm wrapping the RAS api in C#for the compact framework. Everything works fine except for one thing: setting and getting the RASDIALPARAMS structure for a certain entry.
Since the CF does not support enough Marshalling features, I have a byte array that represents the RASDIALPARAMS struct initialized as follws:
DIALPARAMS = new byte[1462];<br />
DIALPARAMS[0] = 0xB6;<br />
DIALPARAMS[1] = 5;<br />
Encoding.Unicode.GetBytes(Name, 0, Name.Length, DIALPARAMS, 4);
I've ued the same technique for other structs and have no problem at all. With this one though, the following API call always returns invalid parameter:
<br />
uint ret = RasGetEntryDialParams(null, re.DIALPARAMS, ref pw);<br />
What is really weird: When I use my struct with the RasDial function it seems to work: the function returns a valid connection handle and the ppc device starts sending AT commands over the serial line.
Has someone got an idea on what's wrong here?
Many thanks in advance,
G
"D'Oh!" (Homer J. Simpson)
|
|
|
|