|
no.... all our application is following US datetime format.. if somebody installed OS on UK culture.. then our application must send the datetime in US format irrelevant of system culture. Thats why we need to do this change.
|
|
|
|
|
Too bad - then your application has been developed by some pretty incompetent people.
Your program should always use DateTime objects internally. If it needs to represent the date as a string, then do it using the ISO format mentioned. Preferably the internal format is UTC as well, unless there is an extremely good reason for it to be kept in local time.
Various user interface controls (like your calender) should map to the users culture without problems (if it doesn't, ditch it and use something better).
When interfacing the non-ISO system, encode to and from the specific format at the interface point - never let the bad format requiremen polute your internal program structure, and above all, never EVER let it polute the user interface.
|
|
|
|
|
Hey Everyone,
I have a DataTable exposed to the user through a DataGridView. When a user types in a value for some cells, it triggers events to update other cells. For all my updates, I am updating the underlying databound DataTable, not the DataGridView.
My problem is that in some very rare cases, the data does not show up on the DataGridView. Using the exact same scenarios, updates sometimes work, sometimes not. If I step through the code I can see that the DataTable has the correct values and then I call DataGridView.Refresh() and the display is wrong.
Has anyone had issues with the databindings or know work arounds short of re-writing the code to manage the Table and Grid independantly?
Thanks in advance,
Pualee
P.S. I have removed all possibility of Background threads. There are only events and the GUI to deal with. I have also made sure the events are not overwriting each other (I think).
|
|
|
|
|
hi
i want to change color of diacritics(accent) of font of my text, but how to do ?
|
|
|
|
|
You can't change the color on a part of a character. You have to replace the character that has an accent with it's base character and an accent character, so that you can write them out separately with different colors.
---
single minded; short sighted; long gone;
|
|
|
|
|
i searched in msdn and found _Font.DiacriticColor property in Microsoft.Office.Interop.Word NameSpace, but i doesn't found in references in my VS2005 solution (office 2007 has been installed on my computer).
how to use this namespace to set DiacriticColor ? thanks
|
|
|
|
|
This will only work inside of Word in a Word document. It will NOT work in your application.
|
|
|
|
|
There is no such property outside of Word. A character with a diacritic is just a character that is shaped differently, there is no information in the font that says what part of the character is a diacritic, so the text drawing routines have no way of automatically separating them.
Word does it by separating the characters and the diacricics and drawing them separately, the way that I described.
---
single minded; short sighted; long gone;
|
|
|
|
|
I Know Ican get my computer's environment variables that use Environment.GetEnvironmentVariables()
but how can I get variables from computer in network.
|
|
|
|
|
Don't the environment variables depend on the user that is logged in and the context in which the application is running.
For example, the environment variables I see are different from those my colleague sees when he logs in. And the environment variables that are available in the Visual Studio command prompt are different from those available in the regular system command prompt.
From a remote perspective this question needs to resolve these ambiguities. From a local perspective calling Environment.GetEnvironmentVariables will only ever give you the variables that are available to you in the context in which the application is running.
|
|
|
|
|
Yes,I think I can solve this question from your answer
thanks
|
|
|
|
|
How do i access a website which needs UserID and Password, I need to capture the cookies so that i can send in another location and get some data.
My code is like this.the URL I have is h5.www5.PP.com/partnerportal/au/en
byte[] ba = System.Text.Encoding.ASCII.GetBytes("userName=bsim&Password=Bimbed&submit=submit"); IS this correct?
HttpWebRequest webRequest=(HttpWebRequest)HttpWebRequest.Create("h5.www5.PP.com/partnerportal/au/en);
webRequest.KeepAlive = false;
webRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)";
webRequest.Method = "POST";
webRequest.ContentType ="text/html";
webRequest.ContentLength = ba.Length;
System.IO.Stream requestStream = webRequest.GetRequestStream();
requestStream.Write(ba, 0, ba.Length);
requestStream.Flush();
requestStream.Close();
webRequest.AllowAutoRedirect = false;
WebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
return webResponse.Headers["Set-Cookie"];
Questions: is the above code correct?
when passing username what wording should i user.
When i click on login it goes through this url
http://h5.www5.pp.com/partnerportal_s/au/en/start.swe?SWECmd=ExecuteLogin&SWEUserName=bsimSWEPassword=%5SBsddeeEnc%2DD%5D6mEMSWFhkG06wxVRWrYzzsj3Z8mfTbicVxHTxZulwS0%3D&SWEAC=SWECmd=GotoView,SWEView=Home+Page+View+(SCW),PageName=Home+ELS,SWERF=1,SWEBU=1
To this URL.
http://h5.www5.pp.com/partnerportal_s/au/en/start.swe?SWECmd=Login&SWEPL=1&SWETS=
|
|
|
|
|
I am reposting to add more detail.
I have a custom button that I have created which inherits from windows.forms.button. I simply override the mouseenter, mouseover, and mousedown events to paint a custom gradient over the button. In doing so, I must redraw the available image and text. I have been able to align the image with the base. However, I am unable to do the same with the text. Specifically, centering. It is close, just not perfect.
SizeF wSize = graphics.MeasureString(this.Text, this.Font);
float wCenterX = (Width - wSize.Width) / 2;
mTextPt.X = wCenterX;
mTextPt.Y = Height - 19;
e.Graphics.DrawString(this.Text, this.Font, new SolidBrush(this.ForeColor), mTextpt);
For most of the buttons, the text shifts slightly to the left when I use any of the custom events.
I have thoroughly tried using the StringFormatter to align the text accordingly. However, I have come up empty handed. When you set the LineAlignment to place the text at the bottom of the control, there doesn't seem to be the ability to "pad" the text from the bottom. Therefore, the text simply "sits" on the base or bottom of the control and fails to align with the base text.
Any help would be greatly appreciated. Thanks.
PHD
|
|
|
|
|
I'd do your calculation like this:
float wCenterX = (float)(Width - wSizeWidth) / 2f;
This might be the solution. Also, I usually use the System.Windows.Forms.TextRenderer.MeasureText method for measuring text.
Standards are great! Everybody should have one!
|
|
|
|
|
Hey Bekjong. Thanks a lot for your help. However, I tried both of your suggestions and it continues to react in the same way. Any other ideas? It appears as if it doesn't always grab the proper size of the bounding area for the text. Regardless of which method I use. If I tweak it a little with a few values, some of the text looks perfect. Thanks again.
PHD
|
|
|
|
|
Your code does not make much sense.
PHDENG81 wrote: SizeF wSize = graphics.MeasureString(this.Text, this.Font);float wCenterX = (Width - wSize.Width) / 2;
you measure and calculate the centre of the string, but how is this related to the area that should contain the string. remember DrawString needs the upper left corner of where the string should be drawn.
Hope this helps
|
|
|
|
|
Andre,
Thanks for your help. With all do respect, just because it doesn't make sense to you, doesn't mean it "doesn't make sense."
It is simple math. If written down on paper, the equations seem to be correct. However, it would appear as if I am not receiving the proper values or something else may be skewed. Nevertheless, you have two boxes. One being the button and the other being the bounding box around the text. You are correct in saying that DrawString needs the upper left X and Y coordinates. Therefore, we merely need to divide both boxes in half and subtract the larger half from the smaller. This will give us the X and Y coordinates we desire. Or in this case, the X coordinate. The Y coordinate is working pefectly.
PointF mTextpt = new Point(0);
wSize = graphics.MeasureString(this.Text, this.Font);
this.Width
this.Height
wSize.Width
wSize.Height
float wCenterX = (float)((this.Width - wSize.Width) /2f);
mTextpt.X = wCenterX;
mTextpt.Y = this.Height - 19;
e.graphics.DrawString(this.Text, this.Font, new SolidBrush(this.ForeColor), mTextpt);
I don't claim to have all of the answers. Clearly if that was the case, this simple problem of mine wouldn't be an issue. I must be missing something or screwing something up.
I greatly appreciate your help.
PHD
|
|
|
|
|
To find the X you want to do the following:
Find the center of the button. Take half of the width of the text and subtract it from the center of the button. That should do it.
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
Thanks for the response ExpertComing. The posts prior to yours describes my methods and they do precisely what you illustrate. However, they still don't seem to align with the windows.forms.button text when it is centered. Any other suggestions?
Thanks again.
PHD
|
|
|
|
|
Hi,
How do you make a smooth motion on your windows form??
For example, I'm making a button that will show more/less options on a form and tried to make it move smoothly but I couldn't.. I'm basically using a normal for loop with a timer but it looks like it's not the way it is done
Please help
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
You mention using a for loop - I'm not sure you need one for a smooth motion (or you have might not fully understand the timer object).
Set up a timer and have an Event handler that responds to the Tick event of your timer. That should give you a smooth motion. Once you reach the motion limit, stop the timer.
Hope that helps - if not, I may have misunderstood the problem.
|
|
|
|
|
Hi,
I am trying to create a compact framework 2.0 application which is using WebBrower.Navigate to go to a certain web page.
To do this, I need to pass in a System.Uri object which contains the url to the web page. I need to pass in a variable which contains a &. For example, http://www.test.com/test.aspx?var=varname&part2
varname&part2 is one whole string which i pass in.
since the unicode %26 = & ,
I tried to pass in "varname%26part2" into New Uri() constructor but the result url created is always "varname&part2". After searching the net for answers, there seemed to be no way to tell Uri object to ignore the % escape character. There seemed to be a way to do this with normal .net 2.0 framework but compact framework does not seemed to provide for this.
Anyway to overcome this?
|
|
|
|
|
Hi.
Have you tried with "\&"?
|
|
|
|
|
Now you are just guessing wildly...
---
single minded; short sighted; long gone;
|
|
|
|
|
What is the exact code that you are using?
If you escape the & character as %26, the Uri constructor should not unescape it. If it does, there is something that is seriously wrong.
---
single minded; short sighted; long gone;
|
|
|
|