i have been on application that consist of two forms
1st Form = Primary Form
2nd Form = Secondary Form ( Consists of three Track bars with names R, G ,B)
i m trying for few days to change the Background Color of Primary form simultaneously , whenever i move the trackbar in Secondary form
Problem:
i used .Show() to get hold of Primary form, and from secondary form ,i m able to change color of Primary Form but the Problem is that .Show() pops up the new primary form every time i move the trackbar
is there a way through which i can send trackbar values to Primary form and can change the Background Color of Primary Form ,
the link to my application is here
[html]http://www.4shared.com/get/314190370/5ec62112/color_2_forms.html[/html]
please help me , i need to implement this behavior in my assignment
Form1 = Blank Form ( i want to change Form1 Color )
Form2 Code is given below ( Consists of Three Track bar )
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace color_2_forms
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public void UpdateMe()
{
Form1 frm = new Form1();
frm.Show();
int R = trackBar1.Value;
int G = trackBar2.Value;
int B = trackBar3.Value;
frm.BackColor = Color.FromArgb(R,G,B);
textBox1.Text = " ( " + trackBar1.Value.ToString() + " , "
+ trackBar2.Value.ToString() +","
+ trackBar3 .Value .ToString () + " ) ";
}
private void trackBar1_Scroll(object sender, EventArgs e)
{
Form1 frm = new Form1();
UpdateMe();
}
private void trackBar2_Scroll(object sender, EventArgs e)
{
Form1 frm = new Form1();
UpdateMe();
}
private void trackBar3_Scroll(object sender, EventArgs e)
{
Form1 frm = new Form1();
UpdateMe();
}
}
}
|
Please HELP me