Click here to Skip to main content
14,487,217 members

Managed C++/CLI

 
GeneralRe: Communicating with top level form Pin
led mike18-Jul-06 8:38
Memberled mike18-Jul-06 8:38 
GeneralRe: Communicating with top level form Pin
mrhonus18-Jul-06 9:17
Membermrhonus18-Jul-06 9:17 
GeneralRe: Communicating with top level form Pin
led mike18-Jul-06 9:36
Memberled mike18-Jul-06 9:36 
GeneralRe: Communicating with top level form Pin
mrhonus18-Jul-06 10:32
Membermrhonus18-Jul-06 10:32 
GeneralRe: Communicating with top level form Pin
led mike18-Jul-06 11:01
Memberled mike18-Jul-06 11:01 
QuestionCall java from C++ Pin
Vamp18-Jul-06 1:36
MemberVamp18-Jul-06 1:36 
AnswerRe: Call java from C++ Pin
MonjSam21-Jul-06 13:14
MemberMonjSam21-Jul-06 13:14 
Questionabout Event Handler Pin
mertadin16-Jul-06 23:34
Membermertadin16-Jul-06 23:34 
hi everybody.I am newbie in managed c++.I have few questions for you.how do i send data to serial port with using event handler. Before sending the data, do I need to create an object class for serial port or is it already in windows library.I mean in .NET 2005 with framework 2.0 there is a namespace System::IO::Port but I use framework 1.1 with .net 2003 and i haven`t find something like that.

I post what I write below without comments sorry about it Frown | :(

Moreover when the mouse cursor is in the panel coordinates cpu usage rises 100% what should i do to decrease that usage

thanks a lot for your help
Note: Sorry about my pour english Frown | :(

public __gc class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitForm();
InitializeComponent();
MouseWheel+=new MouseEventHandler(this,Wheeled);
panel1->MouseUp += newMouseEventHandler(this,Joystick_MouseUp);
panel1->MouseMove += new MouseEventHandler(this,Joystick_MouseMove);
panel1->MouseDown += new MouseEventHandler(this,Joystick_MouseDown);

this->panel1->SetStyle( ControlStyles::AllPaintingInWmPaint, true);
this->panel1->SetStyle( ControlStyles::DoubleBuffer, true );
}

protected:
void Dispose(Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super::Dispose(disposing);
}
private: System::Windows::Forms::Panel * panel1;
private: System::Windows::Forms::Label * label1;
private: System::Windows::Forms::Button * button1;
private: System::Windows::Forms::Button * button2;
private: System::Windows::Forms::Button * button3;
private: System::Windows::Forms::Button * button4;
private: System::Windows::Forms::Button * button5;
private: System::Windows::Forms::Button * button6;
private: System::Windows::Forms::Button * button7;
private: System::Windows::Forms::Button * button8;
private: System::Windows::Forms::Button * button9;
private: System::Windows::Forms::Button * button10;
private: System::Windows::Forms::Button * button11;
private: System::Windows::Forms::Button * button12;
private: System::Windows::Forms::Button * button13;
private: System::Windows::Forms::Button * button14;
private: System::Windows::Forms::Button * button15;
private: System::Windows::Forms::Button * button16;
private: System::Windows::Forms::Button * button17;
private: System::Windows::Forms::OpenFileDialog * openFileDialog1;
private: System::Windows::Forms::VScrollBar * vScrollBar1;
private: System::Windows::Forms::TextBox * textBox1;




private: static int x=40;//x degeri
private: static int y=88;//y degeri

private: double diameter;
private: Pen* rubberband;
private: Graphics* g;
private: Point offset;
private: LineCap endCap;
private: bool mouseLock;
private: bool mouseDown;
private: double magnitude;
private: int radius;
private: SolidBrush* insideColor;
private: Point cursorLocation;






private:
///
/// Required designer variable.
///

System::ComponentModel::Container * components;

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

void InitializeComponent(void)
{
System::Resources::ResourceManager * resources = new System::Resources::ResourceManager(__typeof(HaloControl::Form1));
this->panel1 = new System::Windows::Forms::Panel();
this->label1 = new System::Windows::Forms::Label();
this->button1 = new System::Windows::Forms::Button();
this->button2 = new System::Windows::Forms::Button();
this->button3 = new System::Windows::Forms::Button();
this->button5 = new System::Windows::Forms::Button();
this->vScrollBar1 = new System::Windows::Forms::VScrollBar();
this->textBox1 = new System::Windows::Forms::TextBox();
this->button6 = new System::Windows::Forms::Button();
this->button7 = new System::Windows::Forms::Button();
this->button8 = new System::Windows::Forms::Button();
this->button9 = new System::Windows::Forms::Button();
this->button10 = new System::Windows::Forms::Button();
this->button11 = new System::Windows::Forms::Button();
this->button12 = new System::Windows::Forms::Button();
this->button13 = new System::Windows::Forms::Button();
this->button14 = new System::Windows::Forms::Button();
this->button15 = new System::Windows::Forms::Button();
this->button16 = new System::Windows::Forms::Button();
this->button17 = new System::Windows::Forms::Button();
this->openFileDialog1 = new System::Windows::Forms::OpenFileDialog();
this->SuspendLayout();
//
// panel1
//
this->panel1->BackColor = System::Drawing::SystemColors::Desktop;
this->panel1->Cursor = System::Windows::Forms::Cursors::Cross;
this->panel1->Location = System::Drawing::Point(272, 136);
this->panel1->Name = S"panel1";
this->panel1->Size = System::Drawing::Size(160, 160);
this->panel1->TabIndex = 0;
this->panel1->Paint += new System::Windows::Forms::PaintEventHandler(this, panel1_Paint);
//
// label1
//
this->label1->BackColor = System::Drawing::SystemColors::Desktop;
this->label1->Image = (__try_cast<system::drawing::image *="">(resources->GetObject(S"label1.Image")));
this->label1->Location = System::Drawing::Point(16, 16);
this->label1->Name = S"label1";
this->label1->Size = System::Drawing::Size(152, 64);
this->label1->TabIndex = 1;
//
// button1
//
this->button1->BackColor = System::Drawing::SystemColors::Desktop;
this->button1->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button1.BackgroundImage")));
this->button1->Cursor = System::Windows::Forms::Cursors::PanWest;
this->button1->Location = System::Drawing::Point(224, 208);
this->button1->Name = S"button1";
this->button1->Size = System::Drawing::Size(40, 25);
this->button1->TabIndex = 2;
this->button1->Click += new System::EventHandler(this, button1_Click);
//
// button2
//
this->button2->BackColor = System::Drawing::SystemColors::Desktop;
this->button2->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button2.BackgroundImage")));
this->button2->Cursor = System::Windows::Forms::Cursors::PanEast;
this->button2->Location = System::Drawing::Point(440, 208);
this->button2->Name = S"button2";
this->button2->Size = System::Drawing::Size(40, 25);
this->button2->TabIndex = 3;
//
// button3
//
this->button3->BackColor = System::Drawing::SystemColors::Desktop;
this->button3->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button3.BackgroundImage")));
this->button3->Cursor = System::Windows::Forms::Cursors::PanNorth;
this->button3->Location = System::Drawing::Point(336, 88);
this->button3->Name = S"button3";
this->button3->Size = System::Drawing::Size(25, 40);
this->button3->TabIndex = 4;
//
// button5
//
this->button5->BackColor = System::Drawing::SystemColors::Desktop;
this->button5->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button5.BackgroundImage")));
this->button5->Cursor = System::Windows::Forms::Cursors::PanSouth;
this->button5->Location = System::Drawing::Point(336, 304);
this->button5->Name = S"button5";
this->button5->Size = System::Drawing::Size(25, 40);
this->button5->TabIndex = 11;
//
// vScrollBar1
//
this->vScrollBar1->BackColor = System::Drawing::SystemColors::Desktop;
this->vScrollBar1->Location = System::Drawing::Point(512, 160);
this->vScrollBar1->Maximum = 40;
this->vScrollBar1->Name = S"vScrollBar1";
this->vScrollBar1->Size = System::Drawing::Size(24, 112);
this->vScrollBar1->TabIndex = 7;
this->vScrollBar1->Value = 20;
this->vScrollBar1->Scroll += new System::Windows::Forms::ScrollEventHandler(this, vScrollBar1_Scroll);
//
// textBox1
//
this->textBox1->BackColor = System::Drawing::SystemColors::InactiveCaptionText;
this->textBox1->Location = System::Drawing::Point(32, 216);
this->textBox1->Name = S"textBox1";
this->textBox1->Size = System::Drawing::Size(176, 20);
this->textBox1->TabIndex = 9;
this->textBox1->Text = S"textBox1";
//
// button6
//
this->button6->BackColor = System::Drawing::SystemColors::Desktop;
this->button6->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button6.BackgroundImage")));
this->button6->Cursor = System::Windows::Forms::Cursors::Default;
this->button6->Location = System::Drawing::Point(624, 152);
this->button6->Name = S"button6";
this->button6->Size = System::Drawing::Size(40, 25);
this->button6->TabIndex = 12;
//
// button7
//
this->button7->BackColor = System::Drawing::SystemColors::Desktop;
this->button7->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button7.BackgroundImage")));
this->button7->Cursor = System::Windows::Forms::Cursors::Default;
this->button7->Location = System::Drawing::Point(680, 152);
this->button7->Name = S"button7";
this->button7->Size = System::Drawing::Size(40, 25);
this->button7->TabIndex = 13;
//
// button8
//
this->button8->BackColor = System::Drawing::SystemColors::Desktop;
this->button8->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button8.BackgroundImage")));
this->button8->Cursor = System::Windows::Forms::Cursors::Default;
this->button8->Location = System::Drawing::Point(568, 272);
this->button8->Name = S"button8";
this->button8->Size = System::Drawing::Size(40, 25);
this->button8->TabIndex = 14;
//
// button9
//
this->button9->BackColor = System::Drawing::SystemColors::Desktop;
this->button9->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button9.BackgroundImage")));
this->button9->Cursor = System::Windows::Forms::Cursors::Default;
this->button9->Location = System::Drawing::Point(680, 192);
this->button9->Name = S"button9";
this->button9->Size = System::Drawing::Size(40, 25);
this->button9->TabIndex = 15;
//
// button10
//
this->button10->BackColor = System::Drawing::SystemColors::Desktop;
this->button10->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button10.BackgroundImage")));
this->button10->Cursor = System::Windows::Forms::Cursors::Default;
this->button10->Location = System::Drawing::Point(624, 192);
this->button10->Name = S"button10";
this->button10->Size = System::Drawing::Size(40, 25);
this->button10->TabIndex = 4;
//
// button11
//
this->button11->BackColor = System::Drawing::SystemColors::Desktop;
this->button11->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button11.BackgroundImage")));
this->button11->Cursor = System::Windows::Forms::Cursors::Default;
this->button11->Location = System::Drawing::Point(568, 192);
this->button11->Name = S"button11";
this->button11->Size = System::Drawing::Size(40, 25);
this->button11->TabIndex = 4;
//
// button12
//
this->button12->BackColor = System::Drawing::SystemColors::Desktop;
this->button12->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button12.BackgroundImage")));
this->button12->Cursor = System::Windows::Forms::Cursors::Default;
this->button12->Location = System::Drawing::Point(568, 232);
this->button12->Name = S"button12";
this->button12->Size = System::Drawing::Size(40, 25);
this->button12->TabIndex = 16;
//
// button13
//
this->button13->BackColor = System::Drawing::SystemColors::Desktop;
this->button13->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button13.BackgroundImage")));
this->button13->Cursor = System::Windows::Forms::Cursors::Default;
this->button13->Location = System::Drawing::Point(624, 232);
this->button13->Name = S"button13";
this->button13->Size = System::Drawing::Size(40, 25);
this->button13->TabIndex = 4;
//
// button14
//
this->button14->BackColor = System::Drawing::SystemColors::Desktop;
this->button14->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button14.BackgroundImage")));
this->button14->Cursor = System::Windows::Forms::Cursors::Default;
this->button14->Location = System::Drawing::Point(680, 232);
this->button14->Name = S"button14";
this->button14->Size = System::Drawing::Size(40, 25);
this->button14->TabIndex = 4;
//
// button15
//
this->button15->BackColor = System::Drawing::SystemColors::Desktop;
this->button15->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button15.BackgroundImage")));
this->button15->Cursor = System::Windows::Forms::Cursors::Default;
this->button15->Location = System::Drawing::Point(624, 72);
this->button15->Name = S"button15";
this->button15->Size = System::Drawing::Size(96, 25);
this->button15->TabIndex = 17;
//
// button16
//
this->button16->BackColor = System::Drawing::SystemColors::Desktop;
this->button16->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button16.BackgroundImage")));
this->button16->Cursor = System::Windows::Forms::Cursors::Default;
this->button16->Location = System::Drawing::Point(624, 272);
this->button16->Name = S"button16";
this->button16->Size = System::Drawing::Size(96, 25);
this->button16->TabIndex = 18;
//
// button17
//
this->button17->BackColor = System::Drawing::SystemColors::Desktop;
this->button17->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button17.BackgroundImage")));
this->button17->Cursor = System::Windows::Forms::Cursors::Default;
this->button17->Location = System::Drawing::Point(568, 152);
this->button17->Name = S"button17";
this->button17->Size = System::Drawing::Size(40, 25);
this->button17->TabIndex = 19;
//
// Form1
//
this->AutoScaleBaseSize = System::Drawing::Size(5, 13);
this->BackColor = System::Drawing::SystemColors::ControlDarkDark;
this->ClientSize = System::Drawing::Size(744, 358);
this->Controls->Add(this->button17);
this->Controls->Add(this->button16);
this->Controls->Add(this->button15);
this->Controls->Add(this->button12);
this->Controls->Add(this->button9);
this->Controls->Add(this->button8);
this->Controls->Add(this->button7);
this->Controls->Add(this->button6);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->vScrollBar1);
this->Controls->Add(this->button5);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Controls->Add(this->label1);
this->Controls->Add(this->panel1);
this->Controls->Add(this->button10);
this->Controls->Add(this->button11);
this->Controls->Add(this->button13);
this->Controls->Add(this->button14);
this->Font = new System::Drawing::Font(S"Franklin Gothic Book", 8.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, (System::Byte)0);
this->ForeColor = System::Drawing::SystemColors::ControlText;
this->Icon = (__try_cast<system::drawing::icon *="">(resources->GetObject(S"$this.Icon")));
this->Name = S"Form1";
this->Text = S"Form1";
this->ResumeLayout(false);

}
void InitForm()
{
//pen
this->rubberband = new Pen(Color::Blue, 5);

//point offset
//this->offset= Point(,0);
this->insideColor = new SolidBrush(Color::Thistle);
this->mouseDown = false;
this->mouseLock = false;
}
private: System::Void Joystick_MouseUp(Object* sender, MouseEventArgs* e)
{
mouseDown = false;
if(!mouseLock)
{
this->panel1->Refresh();//Invalidate();
}
}
private: System::Void Wheeled (Object *sender,MouseEventArgs* e)
{

// i will use here later

}
private: System::Void Joystick_MouseMove(Object* sender, MouseEventArgs* e)
{

//static Point offset;
offset = System::Drawing::Point(e->X,e->Y);

if(e->Button == MouseButtons::Left || e->Button == MouseButtons::Right)
{
String *text = new String("");
//text = text->Concat( S" Veli ", S" Veli" );
text = text->Concat(offset.X.ToString(), S",", offset.Y.ToString());
this->textBox1->Text = text;
}
if(mouseDown)
{
offset.X = e->X;
offset.Y = e->Y;
this->panel1->Refresh();// same as Invalidate(System::Drawing::Rectangle(0,0,160,160), false);
}
else if( !mouseLock)
{
offset.X = radius;
offset.Y = radius;
this->panel1->Refresh();
}
//this->Invalidate(System::Drawing::Rectangle(100,100,150,150), false);
}

private: System::Void Joystick_MouseDown(Object* sender, MouseEventArgs* e)
{
if(e->Button == MouseButtons::Left)
{
mouseDown = true;
mouseLock = false;
offset.X = e->X;
offset.Y = e->Y;
this->panel1->Refresh();// same as Invalidate();
}
else if(e->Button == MouseButtons::Right)
mouseLock = true;
}

/* GUI joystick (mouse stick) in panel */
private: System::Void panel1_Paint(System::Object * sender, PaintEventArgs * e)
{

this->g = e->Graphics;
GraphicsPath* serge = new GraphicsPath();
SolidBrush *sb = new SolidBrush(Color::Cornsilk);
SolidBrush *sb2= new SolidBrush(Color::Blue);
serge->AddEllipse(this->panel1->ClientRectangle);
g->FillEllipse(sb2,System::Drawing::Rectangle(0,0,160,160));
g->FillEllipse(sb,System::Drawing::Rectangle(5,5,150,150));
this->panel1->Region = new System::Drawing::Region(serge);
g->DrawLine(rubberband,offset.X,offset.Y,80,80);

// in order to solve flickering i have to use double buffering
this->SetStyle( ControlStyles::AllPaintingInWmPaint, true);
this->SetStyle( ControlStyles::UserPaint, true);
this->SetStyle( ControlStyles::DoubleBuffer, true );
}

};
}
QuestionHow to embed a resource in the assembly? Pin
Super Lloyd13-Jul-06 19:57
MemberSuper Lloyd13-Jul-06 19:57 
AnswerRe: How to embed a resource in the assembly? Pin
Super Lloyd13-Jul-06 20:05
MemberSuper Lloyd13-Jul-06 20:05 
QuestionVC7 Preprocessor variables not working. Pin
Dave_Roach13-Jul-06 1:43
MemberDave_Roach13-Jul-06 1:43 
QuestionRe: VC7 Preprocessor variables not working. Pin
Jun Du13-Jul-06 2:10
MemberJun Du13-Jul-06 2:10 
AnswerRe: VC7 Preprocessor variables not working. Pin
Dave_Roach13-Jul-06 3:08
MemberDave_Roach13-Jul-06 3:08 
GeneralRe: VC7 Preprocessor variables not working. [modified] Pin
Sebastian Schneider13-Jul-06 22:09
MemberSebastian Schneider13-Jul-06 22:09 
AnswerRe: VC7 Preprocessor variables not working. Pin
Jonathan [Darka]13-Jul-06 4:10
professionalJonathan [Darka]13-Jul-06 4:10 
GeneralRe: VC7 Preprocessor variables not working. Pin
Dave_Roach13-Jul-06 4:57
MemberDave_Roach13-Jul-06 4:57 
GeneralRe: VC7 Preprocessor variables not working. Pin
Jonathan [Darka]13-Jul-06 5:10
professionalJonathan [Darka]13-Jul-06 5:10 
GeneralRe: VC7 Preprocessor variables not working. Pin
Dave_Roach13-Jul-06 5:20
MemberDave_Roach13-Jul-06 5:20 
Questioncannot convert void * to System::Data::DataColumn Pin
arvindbhateja13-Jul-06 1:04
Memberarvindbhateja13-Jul-06 1:04 
AnswerRe: cannot convert void * to System::Data::DataColumn Pin
Jun Du13-Jul-06 2:09
MemberJun Du13-Jul-06 2:09 
GeneralRe: cannot convert void * to System::Data::DataColumn [modified] Pin
arvindbhateja13-Jul-06 2:29
Memberarvindbhateja13-Jul-06 2:29 
GeneralRe: cannot convert void * to System::Data::DataColumn Pin
Jun Du13-Jul-06 3:52
MemberJun Du13-Jul-06 3:52 
GeneralRe: cannot convert void * to System::Data::DataColumn Pin
arvindbhateja13-Jul-06 4:00
Memberarvindbhateja13-Jul-06 4:00 
GeneralRe: cannot convert void * to System::Data::DataColumn Pin
Jun Du13-Jul-06 4:55
MemberJun Du13-Jul-06 4:55 
GeneralRe: cannot convert void * to System::Data::DataColumn [modified] Pin
arvindbhateja13-Jul-06 5:00
Memberarvindbhateja13-Jul-06 5:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.