473,394 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Interactive Forms

This has probably been asked before, but I cannot seem to find what i
need with the searches I have tried.

I am trying to learn C# for a project at work that I will probably be
moving on to. I am trying to figure out to create a form which will
interact with a graphics. In other words, I would like to create a form
with buttons and other components on it, and have events from that form
cause stuff to be drawn (lines, arcs, etc) in another form.

If someone could point me to a simple example of this, I would be most
appreciative.

Thanks

Mar 8 '06 #1
1 2256
Bob
Hi,
You can use custom events to achieve this.
Two forms
frmButtons and frmPicture
Linked as follows.
frmPicture declare a public variable say myButtonForm of type frmButton
frmPicture is start up form
This is just the ground work so that frmPicture can respond to events raised
by frmButton.

Now...On frmButton create custom events that deliver the 'goods'.
Note ButtonEventaAgs class. You can put whatever payload you like into this.
Have the buttons etc on frmButton raise these events with the appropriate
payloads
Write eventhandlers on frmPicture for the events:
Sample Code Follows:

Pushing button on frmButton delivers string payload to frmPicture which
displays it.
HTH
Bob
*************frmButton **************
namespace TestEvents

{

public partial class frmButton : Form

{
public delegate void ButtonEventHandler(object sender,ButtonEventArgs e);

public event ButtonEventHandler ButtonEvent;

public frmButton()

{

InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)

{

ButtonEventArgs b = new ButtonEventArgs();

b.MyProperty = "Payload string";

ButtonEvent(this, b);

}

}

}

******frmPicture***************

namespace TestEvents

{

public partial class frmPicture : Form

{

public frmButton myForm;

public frmPicture()

{

InitializeComponent();

myForm = new frmButton();

myForm.ButtonEvent += new frmButton.ButtonEventHandler(myForm_ButtonEvent);

myForm.Show();
}

void myForm_ButtonEvent(object sender, ButtonEventArgs e)

{

MessageBox.Show(e.MyProperty);

}
}

}

**********************Derived Eveent Arg class*******************

namespace TestEvents

{

class ButtonEventArgs:System.EventArgs
{

private String mstrPayload;
public String MyProperty

{

get { return mstrPayload; }

set { mstrPayload = value; }

}
}

}
"pool" <vf********@gmail.com> wrote in message
news:11*********************@u72g2000cwu.googlegro ups.com...
This has probably been asked before, but I cannot seem to find what i
need with the searches I have tried.

I am trying to learn C# for a project at work that I will probably be
moving on to. I am trying to figure out to create a form which will
interact with a graphics. In other words, I would like to create a form
with buttons and other components on it, and have events from that form
cause stuff to be drawn (lines, arcs, etc) in another form.

If someone could point me to a simple example of this, I would be most
appreciative.

Thanks

Mar 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Joe | last post by:
When you run "python -i scriptname.py" after the script completes you left at the interactive command prompt. Is there a way to have this occur from a running program? In other words can I...
2
by: Charles Krug | last post by:
List: I'm trying to us pylab to see what I'm doing with some DSP algorithms, in case my posts about convolution and ffts weren't giving it away. I've been using pylab's plot function, but I'm...
2
by: Ken Fine | last post by:
(originally posted to one of macromedia's groups; no help, so hopefully someone here can help me out. I'm using VBScript ASP.) When designing administrative interfaces to websites, we often need...
1
by: Brian Henry | last post by:
Hi, Is there any good tutorials out there on creating interactive custom controls that have clickable objects that are drawn through GDI+ and use the hit test method to determin what to do with...
2
by: WJ | last post by:
I have three ASPX pages: 1. "WebForm1.aspx" is interactive, responsible for calling a web site (https://www.payMe.com) with $$$. It is working fine. 2. "WebForm2.aspx" is non-interactive, a...
0
by: subirose | last post by:
Hi, For my web application I need to create an html input form form which I need to extract the entered data and also save the filled form as an image when the user submits the form. I have seen...
0
by: Simon Eves | last post by:
I am trying to write a Python module to embed the functionality of Maya (the 3D modelling and animation application from Autodesk, formerly Alias) for doing scripted scene manipulation and...
1
by: KPOJonesECC | last post by:
I am currently working on creating a visual calculator in an access form. The visual bit being a graph and the interactive bit (or what I would like) being that by moving sliders on a series of sub...
1
by: salmobytes | last post by:
I've been asked to create a website where various office secretaries, in a university biology department, can update selected pages by filling out forms. In other words where privileged users...
2
by: Toni Pohl | last post by:
Hi, some years ago I´ve implemented an classic ASP form which fills in data from a database into a PD-form. I used the free FDF Toolkit which worked very well. After submitting the PDF the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.