473,382 Members | 1,442 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,382 software developers and data experts.

Extending System.Windows.Forms.Button class

Hello,

I'm writing an extension class for the winforms button control using MC++.
I created a class, derived from System::Windows::Forms::Button.
In my class I want to extend the functionality of the Image-property, so I
added the followind functions:

public __gc class ExtendedButton : public System::Windows::Forms::Button
{
public:
__property System::Drawing::Image* get_Image();
__property void set_Image(System::Drawing::Image* value);
};

System::Drawing::Image* ExtendedButton::get_Image()
{
return System::Windows::Forms::Button::get_Image();
}

void ExtendedButton::set_Image(System::Drawing::Image* value)
{
System::Windows::Forms::Button::set_Image(value);
}

My problem is, that VS2003 runs into an endless loop when I add that control
in a form.
It then consumes very much CPU and memory, and it doesn't stop itself.

What did I do wrong?
There must be a way!

Thanks in advance!
Max
Nov 17 '05 #1
2 2068
Hello,

as I didn't get answer to this question, and it's very important for me, I
tried some other way to to that.
My current approach overrides the OnPaint method and performs some stuff
that should be ok for me.

The problem is, that my OnPain method isn't called.

Heres some source code:
public __gc class EnhancedButton : public System::Windows::Forms::Button
{
public:
// ... some methods
protected:
void OnPaint(System::Windows::Forms::PaintEventArgs* pevent);
private:
// ... some methods and member variables
};

void EnhancedButton::OnPaint(System::Windows::Forms::Pa intEventArgs* pevent)
{
// ... do some stuff

// ... call OnPaint of the base class
System::Windows::Forms::Button::OnPaint(pevent);
return;
}

Has anybody an idea?

Thanks in advance!
Max

}
"Markus Eßmayr" <essmayr/at/racon-linz.at> wrote in message
news:eB**************@tk2msftngp13.phx.gbl...
Hello,

I'm writing an extension class for the winforms button control using MC++.
I created a class, derived from System::Windows::Forms::Button.
In my class I want to extend the functionality of the Image-property, so I
added the followind functions:

public __gc class ExtendedButton : public System::Windows::Forms::Button
{
public:
__property System::Drawing::Image* get_Image();
__property void set_Image(System::Drawing::Image* value);
};

System::Drawing::Image* ExtendedButton::get_Image()
{
return System::Windows::Forms::Button::get_Image();
}

void ExtendedButton::set_Image(System::Drawing::Image* value)
{
System::Windows::Forms::Button::set_Image(value);
}

My problem is, that VS2003 runs into an endless loop when I add that control in a form.
It then consumes very much CPU and memory, and it doesn't stop itself.

What did I do wrong?
There must be a way!

Thanks in advance!
Max

Nov 17 '05 #2
I don't really understand the C++ code, but if it helps, I did do some
Custom Drawing in a Inherited Button in VB.net and C#.
You'll find the source at http://dotnetrix.co.uk/buttons.html

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Markus Eßmayr" <essmayr/at/racon-linz.at> wrote in message
news:uq*************@TK2MSFTNGP11.phx.gbl...
Hello,

as I didn't get answer to this question, and it's very important for me, I
tried some other way to to that.
My current approach overrides the OnPaint method and performs some stuff
that should be ok for me.

The problem is, that my OnPain method isn't called.

Heres some source code:
public __gc class EnhancedButton : public System::Windows::Forms::Button
{
public:
// ... some methods
protected:
void OnPaint(System::Windows::Forms::PaintEventArgs* pevent);
private:
// ... some methods and member variables
};

void EnhancedButton::OnPaint(System::Windows::Forms::Pa intEventArgs*
pevent)
{
// ... do some stuff

// ... call OnPaint of the base class
System::Windows::Forms::Button::OnPaint(pevent);
return;
}

Has anybody an idea?

Thanks in advance!
Max

}
"Markus Eßmayr" <essmayr/at/racon-linz.at> wrote in message
news:eB**************@tk2msftngp13.phx.gbl...
Hello,

I'm writing an extension class for the winforms button control using
MC++.
I created a class, derived from System::Windows::Forms::Button.
In my class I want to extend the functionality of the Image-property, so
I
added the followind functions:

public __gc class ExtendedButton : public System::Windows::Forms::Button
{
public:
__property System::Drawing::Image* get_Image();
__property void set_Image(System::Drawing::Image* value);
};

System::Drawing::Image* ExtendedButton::get_Image()
{
return System::Windows::Forms::Button::get_Image();
}

void ExtendedButton::set_Image(System::Drawing::Image* value)
{
System::Windows::Forms::Button::set_Image(value);
}

My problem is, that VS2003 runs into an endless loop when I add that

control
in a form.
It then consumes very much CPU and memory, and it doesn't stop itself.

What did I do wrong?
There must be a way!

Thanks in advance!
Max


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004
Nov 17 '05 #3

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

Similar topics

3
by: Terrence | last post by:
I am doing some of the C# walkthroughs to transition from VB to C#. When I try to execute static void Main() { Aplication.Run(new Form1()) } I raise a 'System.NullReferenceException" in...
0
by: monkey king | last post by:
I have a given dll file(PDFCreator.dll) - probably generated by VC++. I want to use its method(PDFCreator()) in dotNet environment. It works well in WindiowsApplication, but bad in WebApplication...
0
by: Fidias Gil de Montes | last post by:
In a Distributed Windows application, I receive the following message when the client calls the server: ************** Exception Text ************** System.InvalidCastException: Unable to cast...
18
by: jrhoads23 | last post by:
Hello, I am trying to find a way to tell if an .NET windows forms Button (System.Windows.Forms.Button) is "depressed" (pushed down). For my application, I can not use a check box control set to...
4
by: rajendra | last post by:
how to extend existing windows forms control like if i want to add new add method to combo box ,how to go abt. it? can anyone help me abt. this
4
by: Liverpool fan | last post by:
I have a windows application written using VB .NET that encompasses a countdown timer modal dialog. The timer is a System.Timers.Timer with an interval of 1 second. AutoReset is not set so accepts...
2
by: =?Utf-8?B?TmF0aGFuIFdpZWdtYW4=?= | last post by:
Hi, I am wondering why the .NET Framework is quite different from Win32 API when it comes to displaying system modal message boxes. Consider the four following types of system modal message...
0
by: sdanda | last post by:
Hai i am working on vb.net. In my application I created four forms.Those are first.vb,f1.vb,f2.vb and f3.vb In firstvb I added 3 checkboxes and a "display" button.The 3 checkboxes are used to...
2
by: WP | last post by:
Hello, I making and Windows Forms program and I have a dialog with two buttons. I have set the DialogResult property for these buttons to DialogResult.OK and DialogResult.No, respectively (however,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.