|
Thank you. I'll check those links.
--
Adrián Córdoba
|
|
|
|
|
Hi
I have tried the following code in Form's constructor
<br />
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");<br />
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); but it doesn't work in other dlls which are used by the applicaiton (form).
How to achieve this?
Thanks
srini
|
|
|
|
|
I typically set the Application.CurrentCulture property in addition to the thread properties.
Are you sure that the DLLs make use of the thread's culture settings? Maybe their localisation is hard-coded or they utilize the OS culture (CultureInfo.InstalledUICulture ).
Regards,
Tim
|
|
|
|
|
Hi
How can we make sure the dlls are using thread's culture settings?
We just created dlls without touching any culture informations. But our OS is running on UK culture, thats why it is dispalying in DD/MM/YYYY format
Actually in my application i have some calendar controls where it is displaying US format (after i made that culture change), but the data which i am getting from other dlls are in "DD/MM/YYYY" format!
I thought changing the culture info of current thread will impact the referring dlls is it correct?
Thanks
srini
|
|
|
|
|
You should not force your culture on a client.
The client's system settings should be used.
If you must force a date/time format it should be ISO 8601.
|
|
|
|
|
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)
(><)
|
|
|
|