473,796 Members | 2,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2272
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
*************fr mButton **************
namespace TestEvents

{

public partial class frmButton : Form

{
public delegate void ButtonEventHand ler(object sender,ButtonEv entArgs e);

public event ButtonEventHand ler ButtonEvent;

public frmButton()

{

InitializeCompo nent();
}

private void button1_Click(o bject sender, EventArgs e)

{

ButtonEventArgs b = new ButtonEventArgs ();

b.MyProperty = "Payload string";

ButtonEvent(thi s, b);

}

}

}

******frmPictur e************** *

namespace TestEvents

{

public partial class frmPicture : Form

{

public frmButton myForm;

public frmPicture()

{

InitializeCompo nent();

myForm = new frmButton();

myForm.ButtonEv ent += new frmButton.Butto nEventHandler(m yForm_ButtonEve nt);

myForm.Show();
}

void myForm_ButtonEv ent(object sender, ButtonEventArgs e)

{

MessageBox.Show (e.MyProperty);

}
}

}

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

namespace TestEvents

{

class ButtonEventArgs :System.EventAr gs
{

private String mstrPayload;
public String MyProperty

{

get { return mstrPayload; }

set { mstrPayload = value; }

}
}

}
"pool" <vf********@gma il.com> wrote in message
news:11******** *************@u 72g2000cwu.goog legroups.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
2454
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 just run scriptname.py (NOT python -i scriptname.py) and inside of scriptname.py I decide that I want to fall back to the interactive prompt? I've searched and so far the only thing I've come up with is to use pdb, but
2
7813
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 finding it a bit cumbersome. It works, but if I switch from the interactive window to the plot window and back, the plot window gets trashed.
2
587
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 to provide users with a mechanism to change the order of items that are listed on the page.For example, the _New York Times_ website (http://www.nytimes.com) lists a bunch of top news articles, and normally these are ordered by purely mechanical...
1
2146
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 them? or any good controls I could use to look at the code for that do something similar (please not code from code project, can't access the site from here currently, work network is blocking the site for some reason) thanks!
2
2013
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 listener in my site to capture a "STATUS_CD" returned by www.payMe.com. It is working fine. 3. "WebForm3.aspx" is interactive page, responsibe to display the STATUS CODE "POSTED" by "WebForm2.aspx". 4. My goal is to use "WebForm2.aspx" to call...
0
1188
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 several posts which recommend adobe interactive forms. However, will this require the adobe forms server for capturing the image? Another option I have is to use a regular asp.net form to capture the data and have a back end process recreate the...
0
1209
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 rendering processes in Python. I am aware of the CGKit project, which does this and a lot more, but it is over-complex for our needs, and also does not work in the context of a pure command-line Python script, only as an alternative scripting language...
1
4234
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 forms in the main form, which I would like to auto select records as you scroll one way or another. This would populate fields in the main form which linked by a query re-populates the graph via a setvalue macro, currently activated via the combo...
1
1201
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 upload ascii text to templating system of some kind. My options: I could try to roll this from scratch. I could use Textpattern I could use Drupal (written in php..........)
2
3085
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 asp-form reads the data of the datafields and write them into the database again. Now I want to implement an improved ASP.NET version with VB.NET and I found iText.net. - FDF seems to be completly outdated?
0
9530
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10459
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10236
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10182
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10017
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6793
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.