|
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;
|
|
|
|
|
Don't have time to test this but you might try Server.UrlEncode("varname&part2") and see what it gives you.
topcoderjax - Remember, Google is your friend.
|
|
|
|
|
Hi guys! Thanks for the reply. I saw one of the articles...
Features Missing From .NET Compact Framework
As mentioned earlier, the .NET Compact Framework is a subset of the full .NET Framework and major sections were ignored because they implemented features that were specific to the PC platform, which did not make sense in the device world. The following is a brief summary of the features that are excluded from the .NET Compact Framework.
No application configuration files.
No support for COM Interop.
No support for remoting.
No support for printing.
No support for the SoapFormatter or the BinaryFormatter classes.
No support for XPath and XSLT.
No support for the System.Web namespace.
Ok, enough of basics!! Entire books have been written on the Compact Framework, but we don't have space for it. So let's start writing a simple application.
So i could not use System.Web.HttpServer.UrlEncode method otherwise available in dot net 2.0.
Seems like there is no workaround...
Regards and thanks guys!
|
|
|
|
|
I'm creating an setup project for an application I'm working on. The unusual thing about this installation is that the application (via its dependency on various other projects) uses two different versions of the Enterprise Library. The problem with this is that setup project detects this then appears to install a random version of each "duplicate" assembly.
So, I have (and need) a version 1.1 and version 2.0 of Microsoft.Practices.EnterpriseLibrary.Data.dll. This setup project decides to install version 2.0
I have (and need) a version 1.1 and version 2.0 of Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll. The setup project decides to install version 1.1
There doesn't seem to be any rhyme or reason behind which one is actually installed.
The version 2.0 files will be installed in the GAC, so they don't interfere with each other, but I can't seem to get the installer to ignore the 2.0 files. It sees them as dependencies and refuses to allow me to remove them.
I know this is an extremely unusal problem, but does anyone have any ideas of how I should proceed? Or is there something obvious I've missed that would make everything fall into place?
|
|
|
|
|
One posibility could by code optimizations the compiler does when compiling. It could be thinking a certain assembly is being used or not used and updates the assembly manifest accordingly. My thought is that it could be confused as to the exact dependancies due to the information in the assembly manifest.
Hope this helps a bit.
|
|
|
|
|
andre_swnpl wrote: My thought is that it could be confused as to the exact dependancies due to the information in the assembly manifest.
No, it isn't being confused. I've checked that the correct assemblies are being included. The problem is that the application does indeed use both versions of Enterprise Library
The dependency tree looks something like this:
WindowsApplication
/ \
/ \
/ \
Legacy NewCode
/ \
/ \
/ \
Enterprise Enterprise
Library 1.1 Library 2.0
|
|
|
|
|
How to capture a screen shot, and then save it as JPEG format?
Thanks in advance..
|
|
|
|