|
Hello Friends,
Can anyone know any way of calling default mail client of the PC, if user clicks on contact list from my application.I dont want to send mail from my application.I want to simply call any default mail client and pass on the email address and a message for subject to that mail client.
Mail clinet can be anything like outlook express or any application like outlook express.
Thanks in advance.
Pranoti
|
|
|
|
|
|
MS Toolbar Control in mscomctl.ocx has a HotImageList property where as the .NET ToolBar doesn't. Are there any disadvantages or problems using the MS Toolbar Control, or any other COM Components and distributing the mscomctl.ocx with my .NET application?
Jerzy
|
|
|
|
|
Does anyone know if it is possible to change the colour of the text in a text box?
I have tried textBox1.forecolor = System.drawing.color.red;
and also changing the color in the textbox properties but it doesn't seem to work!
Am I missing something?
Thanks
Paddy
|
|
|
|
|
Hmmm... Your question caught me as setting the ForeColor property in the designer should work, in fact it works on my box . However if you would like to change the color programtically you can do:
<code>
this.textBox1.ForeColor = Color.Aqua;
You should see call kinds of different colors in the intellisence once you type Color. You may also need to prepend this. in front of your textBox1
HTH
Nick Parker
|
|
|
|
|
Thanks for the quick reply Nick.
I don't know why it wont work for me!
Do you need to add Using Systems.color or anything like that at the start of your code?
Paddy
|
|
|
|
|
Try pasting this code in exactly, I just made this up really quickly.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace ChangeColor
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
this.textBox1.ForeColor = System.Drawing.Color.Aqua;
this.textBox1.Location = new System.Drawing.Point(72, 80);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(104, 20);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "textBox1";
this.button1.Location = new System.Drawing.Point(16, 128);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(104, 24);
this.button1.TabIndex = 1;
this.button1.Text = "Change To Red";
this.button1.Click += new System.EventHandler(this.button1_Click);
this.button2.Location = new System.Drawing.Point(128, 128);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(104, 24);
this.button2.TabIndex = 2;
this.button2.Text = "Change To Green";
this.button2.Click += new System.EventHandler(this.button2_Click);
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(256, 221);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button2,
this.button1,
this.textBox1});
this.Name = "Form1";
this.Text = "Change textBox1 Color";
this.ResumeLayout(false);
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
this.textBox1.ForeColor = Color.Red;
}
private void button2_Click(object sender, System.EventArgs e)
{
this.textBox1.ForeColor = Color.DarkGreen;
}
}
}
HTH
Nick Parker
|
|
|
|
|
Thanks for the help.
I'm in poxy work at the moment with no visual studio so I wont get a chance to try adding it to my code till lunch time!
Do you know if the textBox.ForeColor changes all the text in the texbox or can I make different words different colors by changing the forecolor before I append text to the texbox?
Thanks,
Paddy.
|
|
|
|
|
Paddy wrote:
Do you know if the textBox.ForeColor changes all the text in the texbox or can I make different words different colors by changing the forecolor before I append text to the texbox?
If you wish to use different colors for different words you would have to use a control such as the RichTextBox control which supports formatting. The text field is only a single color unless you make your own text control and draw it yourself.
Rocky Moore
|
|
|
|
|
Thanks for the help,
Is it difficult to implement a RichTextBox control?
Paddy
|
|
|
|
|
You just declare a RichTextBox object or you could find it in the Toolbox.
To change the color/font or something you just use SelectionFont/SelectionColor property to change the color/font of selected text.
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
Thanks Rickard,
I'll give that a try later, doesn't sound to difficult.
Paddy
|
|
|
|
|
Paddy wrote:
doesn't sound to difficult.
Believe me! It's too easy!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
Thanks I'll give it a try when I get out here!
|
|
|
|
|
I am trying to cycle through a particular file, preferably 5 bytes at a time, I have this code so far but it doesn't work correctly. Any ideas.
string a;
byte b = new Byte();
ArrayList arrText = new ArrayList();
a = "test.txt";
StreamReader objReader = new StreamReader(a);
while (b != null)
{
b = (byte)objReader.Read();
arrText.Add(b);
}
objReader.Close();
Any help? Thanks
Nick Parker
|
|
|
|
|
Nick
StreamReader.Read Method reads the next character from the input stream and advances the character position by one character.
That's from MSDN
In .NET a character is not a byte but two bytes. Maybe that's the problem.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Ok, here is the unequivocal question, how do I cycle through bytes of a file? Thanks for your response Nish.
Nick Parker
|
|
|
|
|
Nick Parker wrote:
Ok, here is the unequivocal question, how do I cycle through bytes of a file? Thanks for your response Nish.
Use the BinaryReader class and call ReadByte
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
|
IMHO you should use ReadBytes instead of ReadByte , then you can read all 5 at once instead of 1 at a time.
James
Simplicity Rules!
|
|
|
|
|
James T. Johnson wrote:
IMHO you should use ReadBytes instead of ReadByte, then you can read all 5 at once instead of 1 at a time.
While that's true, internally they'd both be using 128 byte or higher read ahead buffers I think. But then you are very much correct of course
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
|
First of all am I in the right Forum?
I'm thinking of making a simple peer to peer game in C# using remoting and WinForms. I would most likely need to send simple things like X,Y coordinates to each peer. My question is how should I accomplish this? The only method I can think of is storing each player's coordinates in a simple file then have each peer read each others coordinate file. This approach I beleive would operate poorly and would be extremely slow. I know there must be another way, does anyone here know how other games communicate or how I might go about doing this? Thanks for your time.
|
|
|
|
|
You could make a server module that people would sign into and have it control the sessions. This would be like what Unreal Tournement uses (I belive). Once the server is running on a computer, then the others could sign in and use other features such as finding players to play with, watching games already in progress, or replacing someone else in a running game. It seems more sensible to have a host in charge of communications which could be placed on another computer if the load is heavy so as not to slow any one down who is playing.
Rocky Moore
|
|
|
|
|
If you go to http://www.gotdotnet.com/team/csharp, you'll find my implementation of Spacewar!, which uses UDP over sockets.
The source is included; look on the information page.
|
|
|
|