|
Hey It is possible..I mean no need to change the systems settings, but the application enviornment as you said .
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US" , true);
will set the application settings into en-US , and our application will work in en-Us format
Thanx
Ranjith Stephen
asdasd
|
|
|
|
|
I mean for example when I use webbrowser control,set the control size 400X300,then navigate the webbrowser to a webpage,and the whole page is displayed in the control,but have scrollbars,so can i scale or shorten the whole page to 400X300.
I hope you know my meanings.
Thanks.
|
|
|
|
|
Hello
I've never seen in before in any browser -this zomming/fit page thing- so I don't think It's avaible directly in the WebBrowser control.
I guess you'd have to make you own Browser object that parses HTML and displays it accordingly. Won't be easy though.
Regards
|
|
|
|
|
Hey everybody !
I'm trying to find a way to get my IP.
I'm pretty sure there is a method for that in the libraries, so I thought maybe someone wouldn't mind to share that information .
Thanks.
|
|
|
|
|
Very simple, Try this:
<br />
IPHostEntry host = Dns.GetHostByName(Dns.GetHostName());<br />
foreach (IPAddress address in host.AddressList) <br />
{<br />
Console.WriteLine("IP Address: {0}", address.ToString());<br />
}<br />
You must include the System.Net namespace as well.
|
|
|
|
|
Thanks
its working perfectly!
by the way, just one more thing, is there a way to tell if the IP I'm getting is the internet IP? (if I have more than one), or do I have to find something (like checking the first number of the IP address)?
|
|
|
|
|
You might check if it's in the valid range of non-network IPs
Alternatively, you could send a HttpWebRequest to http://www.whatismyip.com/
If it succeeds then you can parse the IP. If it does not, you might still want to check method 1
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Good day
Im tring to uninstall an application using command prompt. After it has uninstalled, it must not show on the Add/Remove Programs folder. Can anyone help me.
Thank you in advance
Kulile --- RSA
|
|
|
|
|
Is there a way to center text in a message box? Its left aligning it and Id rather have it centered if there is a way.
|
|
|
|
|
The text must be centered if the box grows to fit the text
You can use \n if you want CR's and manually "box" lengthy text that way.
Glen Harvy
|
|
|
|
|
Hi Guys,
I’m creating an animation program and have built a Bezier spline motion editor. The user-controllable curve plots time(x) against value(y). So my challenge is to retrieve the 'y' value from a given 'x' on the curve. However, all the articles I've been able to find/understand only give a formula for calculating an x or y from 't' - the percentage along the given cubic bezier curve.
As 't' is more concentrated around areas which heavily curve (to make a smooth curve), it's not possible to calculate y from x. So I'm using what seems to be a recognised work around and iteratively guessing at which 't' value produces x, continually reducing the difference until I find the correct 't' which produces my required x. I then use this 't' to calculate y.
This all works perfectly well. However, this is an animation program so I need to optimize this process. My current technique requires up to 15 iterations before it finds an accurate value for 't'. I found an article online by Don Lanaster, “Some more cubic spline math BEZMATH.PS”. He mentions using the Newton-Raphelson method to reduce this process down to 3 iterations. Apparently this technique uses the slope of the curve to make the approximation of 't' more accurate. However, the formula he uses doesn't match the formula I currently have working to calculate a value on the curve. I'm sure I'm misunderstanding it!
At this point I have to confess I am a Math dummy. I can work my way around practical mathematical issues as long as I don’t have to resort to long formulas full of ancient Greek!
Here's an extract from Don's article:
--- Quote ----
Let's use a better ploy to get our approximation to close quickly. It is called the NEWTON-RAPHELSON method, but is much simpler than it sounds. Say we get an error of x - x1. x1 is the current x for our current guess. At x1, our spline curve has a slope. Find the slope.
The slope is expressed as rise/run. Now, on any triangle...
rise = run x (rise/run)
This gives us a very good improvement for our next approximation. It turns out that the "adjust for slope" method converges very rapidly. Three passes are usually good enough. If our curve has an equation of...
x = At^3 + Bt^2 + Ct + D
...its slope will be...
x' = 3At^2 +2Bt + C
And the dt/dx slope will be its inverse or 1/(3At^2 + 2Bt +C). This is easily calculated. The next guess will be...
nextguess = currentt + (curentx - x)(currentslope)
----- end quote ----
So here's the function I call iteratively with varying values for 't' and it returns 'x' for me to compare with what I want:
public float CalcBezierValue(float t, float A, float B, float C, float D)
{
t = 1 - t; // Reverse the normalised percentage
float F1 = t * t * t; // These vars used purely for visual clarity
float F2 = 3 * t * t * (1 - t);
float F3 = 3 * P * (1 - t) * (1 - t);
float F4 = (1 - t) * (1 - t) * (1 - t);
return A * F1 + B * F2 + C * F3 + D * F4;
}
As you can see the base formula which produces the return value is quite different from the one in the article (x = At^3 + Bt^2 + Ct + D). Consequently I’m failing to comprehend how to calculate the slope value or its inverse which seem to be required to reduce the number of calls to this function.
Can anyone help me?
Many thanks for your time,
Simon
-- modified at 12:02 Wednesday 13th September, 2006
|
|
|
|
|
You choose wrrong forum brother try it in google groups but math
when i want to read something good just seat and type it
|
|
|
|
|
Thanks for the tip. I've posted on there too.
|
|
|
|
|
|
There is a Maths forum here as well.
As of how to accomplish this, have you ever tried Google? Failing that try
|
|
|
|
|
Guys,
Thanks so much for everyone's feedback. From all the feedback on this and other forums I have the answer.
The function CalcBezierValue() computes the cubic Bézier curve as the polynomial:
x = A*t^3 + 3*B*(t^2)*(1-t) + 3*C*t*(1-t)^2 + D*(1-t)^3
To use the technique in the article I need the derivative:
x' = 3*A*t^2 + 6*B*t*(1-t) - 3*B*t^2 + 3*C*(1-t)^2 - 6*C*t*(1-t) - 3*D*(1-t)^2
The final code looks like this:
// Calc the derivative value of the curve at the specified percentage (rather than the polynomial)
public float CalcBezierDerivative(float P, float A, float B, float C, float D)
{
P = 1 - P; // Reverse the normalised percentage
float tR = 3 * A * (P * P);
float tS = 6 * B * P * (1 - P);
float tT = 3 * B * (P * P);
float tU = 3 * C * ((1 - P) * (1 - P));
float tV = 6 * C * P * (1 - P);
float tW = 3 * D * ((1 - P) * (1 - P));
return tR + tS - tT + tU - tV - tW;
}
Many thanks for all your responses.
Simon
|
|
|
|
|
i want to implement zoomin opertion in C# for that i used picturebox control which is contained in a panel control but in mouse click event of picturebox i just increased the height and width of the picturebox so its just moving right even i set the autoscroll of panel control and its autoscrollposition to point containing e.x,e.y but its not working perfectly.
so now i want to position the picturebox image where i clicked, after the zooming effect applied the zoomed area should be shown so pls if any body knows help me or otherwise is there any method to implement zoom operations with the controls i used or with any other way pls help that is important and urgent.
thanx in advance.
|
|
|
|
|
Hello
1- Take the X, and Y coordinates in the MouseUP event handler relative top the current width, and height of your picturebox
2- use a graphics object to scale the image, ie. mygraphics.ScaleTransform() giving the X, and Y zooming factors.
3- Use the same Graphics object to draw the image to the picturebox.image.
Regards
|
|
|
|
|
thanx for u r response, i tried what ever u sent but it didn't work. I don't know why image is remain same after writing the code in mouseup event of picturebox also, and i have one more doubt that the control used in some applications and elsewhere to perform zoom operations is picturebox or anything else ? but pls help me to perform the zoomoperations
thanks once again in advance.
|
|
|
|
|
kalaveer wrote: I don't know why image is remain same after writing the code in mouseup event of picturebox also
Posting that code will do a great help in debugging it!!
kalaveer wrote: i have one more doubt that the control used in some applications and elsewhere to perform zoom operations is picturebox or anything else ?
Well, each applications implements zooming the way that suits the dev team. You want to make a custom control and do all the code yourself, it should be much better, but will take way much more time and efoort. What I provided to you was the simplest way to make zooming works. More advanced ways are provided in articles not forums.
Regards
|
|
|
|
|
Hello,
i have two treeViews. treeView1 and treeView2.
I want to copy (the nodes) from treeView2 into treeView1... (treeView1 = treeView2)it happen also...
But, i see nothing in my treeView1....
what do I have to make?
thx i-p-g-i
|
|
|
|
|
how do u fill treeview2?? (from database ,xml???)
suggestion:
While u fill treeview2 at same time fill treeview1 with same nodes which u fill treeview2
|
|
|
|
|
// fill the TreeView (TreeView2 is public)
for (int i....)
{
treeview2.Nodes.Add(myObject.returnString)
}
TreeView treeView1 = new TreeView();
treeView1 = TreeView2;
treeView1.Refresh();
...
But I see Nothing in treeView1... but in the monitoring nodes are present...
|
|
|
|
|
TreeView treeView1 = new TreeView();<br />
for (int i....)<br />
{<br />
treeview2.Nodes.Add(myObject.returnString);<br />
treeview1.Nodes.Add(myObject.returnString);<br />
}
|
|
|
|
|
Was well meant of you...
I habe buid my own class with an collection of Nodes...
Thanks for the assistance...
|
|
|
|