|
Hi there!
If i understood correctly you want for example
Button1.Text = "5/29/06"
Button2.Text = "5/30/06"
and so on... for complete week!
This isn't very difficult (just a small example)
private void Form1_Load(object sender, EventArgs e)
{
button1.Text = DateTime.Today.ToString();
button2.Text = DateTime.Today.AddDays(1).ToString();
button3.Text = DateTime.Today.AddDays(2).ToString();
}
the AddDays increase the actual Date by the value you paste in... hope that's what you asked for... the ToString() converts the date into a text string, so that the button can handle it!
Bye!
FreewareFire is in the House!
|
|
|
|
|
|
Hi everyone.
I've written a small app to help my wife rename her thousands of images. She used to do it by hand 0.o.
Anyhow, the app seemed to work just as it should, until we noticed that I had programmed it to check on creation date, and not on "image / picture taken" date. So when she retrieves the images from the camera they all get current date.
I've noticed that when I browse pictures with win XP, there's a column called "Picture or Image taken". (I've got it in norwegian, so I'm not sure what it says in english).
Does anyone know how to extract this data? Which class / methods to use to get the "Picture taken" date.
Big thanx in advance!
-Larantz-
|
|
|
|
|
|
Thanx for the reply.
I'll check it out as soon as i get back from work.
Hope the "date time" field returned from this class is the "picture taken" property I'm after,
and not just creation time.
*fingers crossed*
-Larantz-
|
|
|
|
|
If your camera's like my camera, I'm pretty sure it is
|
|
|
|
|
Im trying to read the myapplication.exe.config file using the ConfigurationManager class.
the myapplication.exe.config file looks like that -
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="LogDirectory" value="C:\Documents and Settings\\logs\" />
<add key="LogFileName" value="MYLOG.log" />
</appSettings>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network
host="localhost"
port="25"
defaultCredentials="true"
/>
</smtp>
</mailSettings>
</system.net>
</configuration>
in the code i defined the configuration file and managed to get the net section by -
System.Configuration.Configuration ConfigurationFile = ConfigurationManager.OpenExeConfiguration(@"C:\Documents and Settings\myapplication.exe.config");
ConfigurationSection netSection = ConfigurationFile.GetSection(@"system.net/mailSettings/smtp");
but how do i get the host and the post ???
thanks
Shaul zak
Software engineer
www.Unipier.co.il
-- modified at 14:57 Sunday 28th May, 2006
|
|
|
|
|
please anyone ??
Shaul zak
Software engineer
www.Unipier.co.il
|
|
|
|
|
Hi there!
I'm currently have a problem:
I've looked about 2 days about any solution and failed...
I want to execute an application outside of my program and want that this application gets an mdi child in my own form.
For example:
I start my own program... Then I execute Notepad... Now i want that Notepad gets an mdi child in my program. I've looked at SetParent, but i can't get a working solution. If someone has some Code or any suggestion, please let me know!
Thank you!
FreewareFire is in the House!
|
|
|
|
|
just so far... i got it...
add that dll call:
[DllImport("user32.dll", SetLastError = true)]
private static extern long SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
and then use something like that:
Process[] AllProcesses = Process.GetProcesses();
foreach (Process xProcess in AllProcesses)
{
if (xProcess.ProcessName == "notepad")
{
SetParent(xProcess.MainWindowHandle, this.Handle);
}
}
don't forget to set IsMdiContainer to true!
FreewareFire is in the House!
|
|
|
|
|
Hello!
I'm trying to create a color wheel like this one, but I can't get it just right. I've managed to get a star, a cube and pretty much every shape except the one found in that link. I'm using GDI+.
I have some code here:
protected override void OnPaint(PaintEventArgs e)<br />
{<br />
Graphics g = e.Graphics;<br />
SolidBrush b = new SolidBrush(Color.Transparent);<br />
<br />
Point[] points = new Point[4];<br />
Colors.HSL hsl = new Colors.HSL();<br />
hsl.S = 1;<br />
hsl.L = 1;<br />
<br />
for (int i = 0; i < 23; i++)<br />
{<br />
points[0].X = Convert.ToInt32(Math.Floor(Math.Sin(i - 7.5) * 24)) + (this.Width / 2);<br />
points[0].Y = Convert.ToInt32(Math.Floor(Math.Cos(i - 7.5) * 24)) + (this.Height / 2);<br />
<br />
points[1].X = Convert.ToInt32(Math.Floor(Math.Sin(i + 7.5) * 24)) + (this.Width / 2);<br />
points[1].Y = Convert.ToInt32(Math.Floor(Math.Cos(i + 7.5) * 24)) + (this.Height / 2);<br />
<br />
points[2].X = Convert.ToInt32(Math.Floor(Math.Sin(i - 7.5) * 100)) + (this.Width / 2);<br />
points[2].Y = Convert.ToInt32(Math.Floor(Math.Cos(i - 7.5) * 100)) + (this.Height / 2);<br />
<br />
points[3].X = Convert.ToInt32(Math.Floor(Math.Sin(i + 7.5) * 100)) + (this.Width / 2);<br />
points[3].Y = Convert.ToInt32(Math.Floor(Math.Cos(i + 7.5) * 100)) + (this.Height / 2);<br />
<br />
hsl.H += 0.043;<br />
b.Color = Colors.HSL_to_RGB(hsl);<br />
<br />
g.FillPolygon(b,points,System.Drawing.Drawing2D.FillMode.Alternate);<br />
}<br />
}
The problem is the part with point[x]... part, I don't know how to get it right. It would be great if someone could show me how to create a ball with 24 diffrent hues, theory or code it doesn't matter.
Regards,
Martin
-- modified at 14:22 Sunday 28th May, 2006
|
|
|
|
|
Assuming you will overpaint the interior in the next step the following will work:
Point[] points = new Point[3];
int stepCount = 24;
double degreePerStep = 2 * Math.PI / stepCount;
int width = this.ClientSize.Width;
int height = this.ClientSize.Height;
for (int i = 0; i < stepCount; i++)
{
double sizeFactor = i % 2 == 0 ? 2.0 : 2.2;
points[0].X = (int)(width / 2.0);
points[0].Y = (int)(height / 2.0);
points[1].X = points[0].X + (int)((Math.Sin((i + 0.5) * degreePerStep)) * width / sizeFactor);
points[1].Y = points[0].Y + (int)((Math.Cos((i + 0.5) * degreePerStep)) * height / sizeFactor);
points[2].X = points[0].X + (int)((Math.Sin((i - 0.5) * degreePerStep)) * width / sizeFactor);
points[2].Y = points[0].Y + (int)((Math.Cos((i - 0.5) * degreePerStep)) * height / sizeFactor);
b.Color = colors[i % colors.Length];
g.FillPolygon(b, points, System.Drawing.Drawing2D.FillMode.Alternate);
}
I also suggest using antialiasing:
g.SmoothingMode = SmoothingMode.HighQuality;
and don't forget to dispose the your brush .
|
|
|
|
|
Thank you very much! I will dispose the brush, don't worry . I will try it when I get the time to, I have to go now.
- Martin
-- modified at 10:37 Monday 29th May, 2006
|
|
|
|
|
I really appreciate the code you gave me, but I don't entirely understand what's happening in there so I don't know how to make any modifications to the code. What I want to do is to make the parts end a little earlier, so that they don't meet in the middle. At the moment this is what's happening.
Thanks in advance!
- Martin
-- modified at 12:18 Tuesday 6th June, 2006
|
|
|
|
|
Hello,
I have a form which opens a second, new form and stays active in the background.
In the second form I want to pass a value to the open, active form by clicking on a button.
How can I do this?
TNX!
|
|
|
|
|
The easiest way to do what you want is to pass your FIRST form into the SECOND form. You can do this through the second Form's constructor when you create it in Form1.
Form2 myForm2 = new Form2(myForm1);
Or you can create an accessor on Form2:
myForm2.form1 = myForm1;
Once Form2 knows about Form1, you will then call your special method in Form1 when the user clicks on the button.
Another option is to create a delegate on Form1 which gets called when the button is pressed. Rather than passing in the entire Form1 or setting the Form1 accessor, you will set the delegate to use. Design-wise, this may be the better approach, but a few extra minutes to implement.
|
|
|
|
|
I don't really understand your explanation (what to do?).
But I was thinking, it isn't really necessary to pass a value ..
It's enough, that i close the second form by pressing a button, but i have to recognize that event in the first form, so I can react on that event.
So: Can somebody give me some example code to react when a form (which is created in an active form) is closed?
TNX!
|
|
|
|
|
Create a win app project
with two Froms : Form1 and Form2
In the Main() have Form1 as a parameter in Application.Run() method, like so
static void Main(string[] args) {
Application.Run(new Form1());
}
In The Second Form
Add a Button and a TextBox control.
Add public property that will be accessed from Form1 to retrieve a value assigned in Form2. I used string but of course you can use whatever type you need.
public string FormVariable {
get {
return Int32.Parse(this.txtIntValue.Text);
}
}
Code button click event
private void button1_Click(object sender, System.EventArgs e) {
this.DialogResult = DialogResult.OK;
}
In The First Form
Add a Button and code its click event.
private void button1_Click(object sender, System.EventArgs e) {
using (Form2 frm2 = new Form2()) {
System.Windows.Forms.DialogResult dr = frm2.ShowDialog(this);
string result = frm2.FormVariable;
MessageBox.Show("Form2 variable value: " + result,
"Message Called from Form1");
}
}
Run The App
Form1 will get displayed, click on its button.
Form2 will get displayed.
In Form2 type a value in the TextBox and click on the button.
Form2 will close and you'll see a message box showing you the value you typed in Form2.
This is obviously one of the possible solutions...
Let me know if it helps or if you have any queries.
Alex B. Clarke
-- modified at 14:04 Sunday 28th May, 2006
|
|
|
|
|
TNX!
That helped me out
|
|
|
|
|
Thanks for letting me know.
Alex B. Clarke
|
|
|
|
|
Good. Glad someone else answered properly. I was under the impression you were trying to accomplish something else. I thought you wanted Form2 to remain open and clicking on the button in Form2 changed some values or output in Form1.
|
|
|
|
|
Hi,
How to perform delete with datagridview.Please provide me code for this delete operation.
Thanks in advance.
|
|
|
|
|
You have to delete the datarow from the underlying datasource. The gridview will update itself to the new situation.
DataTable.Rows[index].Delete();
Simple as that
WM.
What about weapons of mass-construction?
|
|
|
|
|
<br />
datagridview.Rows.Clear();<br />
|
|
|
|
|
My code:
New line:
TLNode tln1 = new TLNode(1, treeList1.Nodes, new_item.Name_Link.Text, new_item.Link.Text);
treeList1.Nodes.Add(tln1);
This is new folder:
TLNode tln1 = new TLNode(1, treeList1.Nodes, new_folder.textEdit_New_Folder.Text, "");
tln1.HasChildren = true;
TLNode tln_children = new TLNode(2, tln1.Nodes, "", "");
tln1.Nodes.Add(tln_children);
treeList1.Nodes.Add(tln1);
If TreeList hot have folder - Ok! (new node can have focus)
If TreeList have folder and it is close - Ok! (new node can have focus)
If TreeList have open folder - new line in TreeList not can have focus.
Help me please!
|
|
|
|