.NETGURU
Extending System.Windows.Forms.Button class
Messages   Related Types
This message was discovered on microsoft.public.dotnet.languages.vc.

Post a new message to this list...

Markus Eßmayr
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

Reply to this message...
 
    
Markus Eßmayr
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::PaintEventArgs* 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:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Mick Doherty
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:Click here to reveal e-mail address...
[Original message clipped]

---
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

Reply to this message...
 
 
System.Windows.Forms.PaintEventArgs




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification