Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

call from c++ to gui create in c#

michaeldunemichaeldune Member Posts: 103
hi all
i created gui in c# i was exe.
now i want to create api/lib/dll to call from c++ aplication that runs in windows ce what steps i need to take and how to call the functions from windows ce here is the code in c#
---------------------------------------
the aplication just have two buttons when pressed create rectangle
instead i want to remove this two buttons in the futere and create the ructungle using function call
[button_red_Click.....]
when i recive some event from manager function when keyboard pressed for example
--------
i suppose i need to remove the main etc ...
what i need to write in c++ code ?
=========================================
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;


namespace AlphaBlender
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;


private Button button_red;
private Button button_blue;

private static Color backColor = Color.White;
private Color barColor = Color.Red;
private int x = 20;


public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//

SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.DoubleBuffer,
true);
}

///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

// Note - in a fit of bad coding practice, I converted
// the radioButton event handlers to all point to a single
// event handler. So I'm lazy...
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.button_red = new System.Windows.Forms.Button();
this.button_blue = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button_red
//
this.button_red.BackColor = System.Drawing.Color.Red;
this.button_red.Location = new System.Drawing.Point(104, 453);
this.button_red.Name = "button_red";
this.button_red.Size = new System.Drawing.Size(75, 23);
this.button_red.TabIndex = 0;
this.button_red.Text = "button_red";
this.button_red.UseVisualStyleBackColor = false;
this.button_red.Click += new System.EventHandler(this.button_red_Click);
//
// button_blue
//
this.button_blue.BackColor = System.Drawing.Color.CornflowerBlue;
this.button_blue.Location = new System.Drawing.Point(222, 453);
this.button_blue.Name = "button_blue";
this.button_blue.Size = new System.Drawing.Size(75, 23);
this.button_blue.TabIndex = 1;
this.button_blue.Text = "button_blue";
this.button_blue.UseVisualStyleBackColor = false;
this.button_blue.Click += new System.EventHandler(this.button_blue_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(412, 510);
this.Controls.Add(this.button_blue);
this.Controls.Add(this.button_red);
this.ForeColor = System.Drawing.Color.Black;
this.Name = "Form1";
this.Text = "Dune GUI";
this.ResumeLayout(false);

}
#endregion

///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}



private void button_red_Click(object sender, EventArgs e)
{
barColor = Color.Red;
x = x + 20;
Refresh();
}
private void button_blue_Click(object sender, EventArgs e)
{
barColor = Color.Blue;
x = x + 20;
Refresh();
}
private Rectangle backRectangle = new Rectangle(20, 20, 20, 22);


protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
SolidBrush backBrush = new SolidBrush(barColor);
e.Graphics.FillRectangle(backBrush, backRectangle);
backRectangle.X = x;

}
}
}
Sign In or Register to comment.