|
Yes. The user simply changes them in his "Display settings". In case you have never seen this you can find it in the "Display" Icon in "Control Panel"
led mike
|
|
|
|
|
If you want to work with .NET 3.0, then you can easily change gradients and drawing styles of standard windows controls using WPF.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hello...
I make a new control and put it in a new form. How can I detect, if the control is loaded in Visual Studio Designer or directly in Runtime ?
Because if the control is loaded in designer, it shows some stranges behaviour. That's why, I want to cancel it, if the control is in designer.
Thx...
|
|
|
|
|
Hi there
Assuming you're talking about WinForms here: There is a DesignMode property, which can be evaluated. Do note, however, that you cannot use the property in the designer - this is why I usually use OnLoad . Here's a sample, which also plays nicely with controls you're going to extend:
///
/// Inits the base class and registers event listeners.
///
/// <param name="e" />
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!DesignMode)
{
//your internal initialization logic
InitControlInternal();
//the template method below - for extending classes
InitControl();
initControlCompleted = true;
}
}
///
/// An empty template method which is being invoked after the
/// control has been loaded during <see cref="OnLoad">.
///
/// <remarks>The base class does not invoke this method if
/// the control is in design mode.
protected virtual void InitControl()
{
//this method is supposed to be overridden. Initialization of
//the base class itself happens in InitControlInternal
}
HTH,
Philipp
|
|
|
|
|
Hai
I have a mulit line textbox on each time I enter data into it from another text box it should enter data in a new line in the mulitiline textbox
Thanks & Regards
|
|
|
|
|
If the length of the string in the multiline textbox is greater than 0, append the Environment.NewLine and the value from the other textbox.
|
|
|
|
|
Hai
I have two forms opened in my mdiparent form I want to pass the value from textbox of 1st form to textbox of the 2nd form I cannot create a new instance of the 2nd form since I want to send to the same opened instance, I tried by changing the property to public but cannot be acessed with out creating a new instace pls help me to pass the values to the same opened instance of the form
Thanks & Regards
|
|
|
|
|
declare a variable as static ..........if this doenst works take a class declare static variables in it assing the values to the stat variable while u r in first form then use them in next form.......................please dont mind ...make u r question clear
regards
sindhu tiwari
its me sid
|
|
|
|
|
sindhutiwari wrote: declare a variable as static
What if there is more than one instance of the form class?
sindhutiwari wrote: make u r question clear
What about your answer. For the most part it was a clear as mud.
|
|
|
|
|
|
Don't try passing values between forms. A neater architectural approach, is to abstract the data model from the actual visual representation of the value. One way to do this is to implement something called the Model View Controller[^] pattern.
|
|
|
|
|
have a public variable in mdi window,
once you open the child forms, in the form load assign the control to mdi public variables
instead of access the form2 text box , access the mdi variable.
regards
Elayaraja.S
|
|
|
|
|
I am using C#, GDI+.
I have drawn the line (using DrawLine()) from point(10,10) to point(20,20). The center point of the line is (15,15). Suppose i Rotate At(10,10) the line for 30 degrees.
How to calculate the center point after rotating?
|
|
|
|
|
For a line from (a_x,a_y) to (b_x,b_y) this is very simple.
The center is always ( (a_x+b_x)/2, (a_y+b_y)/2 )
So either you have the new endpoints and use this formula or
you apply your transformation to the old centerpoint (yes you can do this in .net)
|
|
|
|
|
Hello to all,
My name is Manoj kumar. I am facing a problem related with Tcp. I want to bring .txt file from remote computer using Tcp server. On remote maching a program is running which uses Tcp client to transfer the .txt file. The client port is 5003 and the ip address is 192.168.1.12.
|
|
|
|
|
This seems straightforward:
Use a tcplistener to check for incomming connections.
After accepting a connection just send the content of the .txt file using ASCII or Unicode - encoding (there are Encoders in System.Text - namespace) over the accepted socket and close the connection.
On the client just use a TcpClient to connect to the server and use the class-methods to read all the stream, decode it with the same encoder you used (ASCII/Unicode/whatever) and you've got it.
|
|
|
|
|
Hi there,
I've been having a problem for days regarding the following bit of code. Basically, I have a web service which looks like this...
<br />
[WebMethod]<br />
public DataSet TestMethod1(string input)<br />
{<br />
DataSet ds;<br />
ds = new DataSet();<br />
ds.Tables.Add("HIHI");<br />
return ds; <br />
}<br />
...and some code that calls it which looks like this
<br />
HttpWebRequest httpRequest;<br />
HttpWebResponse httpResponse;<br />
byte[] inputs=null;<br />
UTF8Encoding encoding = new UTF8Encoding();; <br />
for(int i=0;i<3;i++)<br />
{ <br />
httpRequest = (HttpWebRequest)HttpWebRequest.Create("http://localhost/StaticSer/Service1.asmx/TestMethod1");<br />
httpRequest.Method = "POST";<br />
httpRequest.Credentials = new NetworkCredential("", "", "");<br />
httpRequest.KeepAlive = true;<br />
httpRequest.AllowWriteStreamBuffering = true;<br />
httpRequest.AllowAutoRedirect = true;<br />
httpRequest.ContentType = "application/x-www-form-urlencoded";<br />
<br />
if(i==0)<br />
inputs = encoding.GetBytes(@"INPUT=someInput_1");<br />
<br />
if(i==1)<br />
inputs = encoding.GetBytes(@"INPUT=someInput_2");<br />
<br />
if(i==2)<br />
inputs = encoding.GetBytes(@"INPUT=someInput_3");<br />
<br />
httpRequest.ContentLength = inputs.Length;<br />
httpRequest.GetRequestStream().Write(inputs, 0, inputs.Length);<br />
httpResponse = (HttpWebResponse)httpRequest.GetResponse();<br />
<br />
httpResponse.Close();<br />
httpRequest=null;<br />
httpResponse = null; <br />
}<br />
The problem is that it runs perfectly fine the first time in the loop, but times out on httpRequest.GetRequestStream().Write(inputs, 0, inputs.Length); thereafter.
I am using vs2003 at the moment, and the strange thing is that the code above seem to work perfectly fine in vs2005.
Another thing I've discovered is that the above code works if the web service takes no inputs, e.g.
public DataSet TestMethod1() and
....<br />
inputs = encoding.GetBytes("");<br />
....
I'm guessing it might have something to do with httpRequest not releasing resources after the first run, but am at a lost to know how to be sure. I'd appreciate it if someone could give me some pointers. Thanks
|
|
|
|
|
You have to close the stream from your request:
httpRequest.GetRequestStream().Close();
In fact, I would recommend the following code:
<code>
using (Stream requestStream = httpRequest.GetRequestStream())
{
requestStream.Write(inputs, 0, inputs.Length);
}</code>
-----
You seem eager to impose your preference of preventing others from imposing their preferences on others. -- Red Stateler, Master of Circular Reasoning and other fallacies
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
God is the only being who, to rule, does not need to exist. -- Charles Baudelaire
|
|
|
|
|
Hi
I have developed a Client-Server application using socket.When Client side application executes on another system an error occures(Only one usage of each socket address (protocol/network address/port) is normally permitted).But already a TcpListener application has been executed on that system .I need both application to be executed simultaneously.
How to solve this problem???Plz help me.......
Thanks
Smithakrishnan
|
|
|
|
|
Hi!
You can use both applications "on the same time and same system", but just not on the same port. You'll have to reconfigure the port for one of the applications, no way around it!
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi,
I have a problem that connects to my database (on the same machine) using the usual c#/vs connectionString. When I publish it, that string is still the same (i.e. the name of the machine doesn't change). Yea, I think I've hardcoded the connectionString. But how can I softcode it using VS? How can I make it so that the connectionString takes the name of the current machine it is residing on or better, the application would prompt for where the database is.
Any help is appreciated? Or even just point me to articles.
Thanks.
|
|
|
|
|
Just use the app.config - file to set up your connection-strings.
It's easy to administrate and flexible (all you will need is a text-editor).
If this is not what you want, use a static connection string and use
string.replace
to replace your computer name with the one you get from System.Net.Dns.GetHostName()
(I don't recommend this - normaly another DB will require another login etc.)
|
|
|
|
|
Theres a ConnectionStringBuilder class in the framework somewhere that acts like a dictionary. Then you can add the machine name on at runtime.
|
|
|
|
|
Specify localhost as the server?
I use custom configuration files; if the program can't find the file it pops up a dialog to get the names of the server and database from the user then stores that information in the configuration file.
|
|
|
|
|
Hi All,
I am using Dundas for creating Chart. i am facing one problem. i have created one bar chart with one series. Now some bars are coming with one color.Now what i want is to set the color dynamically of all datapoints with different color.How will i achieve it when i have only one series. Can anybody tell me how can i set the different color for all the datapoints in single series.
Thanks in Advance
Avesh
|
|
|
|