[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

preserve custom property value

Posted on 2004-10-25
5
Medium Priority
?
179 Views
Last Modified: 2010-04-23
I am extending PictureBox control and added the following code

    Private clrForeColor As Color = Color.Black

    <Browsable(True)> _
    Overrides Property ForeColor() As Color
        Get
            Return clrForeColor
        End Get
        Set(ByVal Value As Color)
            clrForeColor = Value
            MyBrush.Color = clrForeColor
            Me.Invalidate()
        End Set
    End Property

Whe I change my ForeColor property from the property window the color changes but when executing the application the color rturns to black. How o solve this problem?
0
Comment
Question by:f_asmaa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 19

Expert Comment

by:arif_eqbal
ID: 12399046
That's because your code executes only at run time

I think you need to create a custom control for that, extend the picture box using a new Windows Control Library Project and adding your code then use this new control.

0
 

Author Comment

by:f_asmaa
ID: 12399132
What do you mean by executing the code at run time??????
0
 
LVL 19

Expert Comment

by:arif_eqbal
ID: 12399195
How have you extended the Picture Box Control
It must be a class within your project

However when you access the property pages it is the basic PictureBox control isn't it
And not your extended class



0
 

Author Comment

by:f_asmaa
ID: 12399241
No I see the additional property that I added. I added a control library project to my application and added referenc to from my application.
0
 
LVL 25

Accepted Solution

by:
RonaldBiemans earned 500 total points
ID: 12399271
Hi, call the base class forecolor

<Browsable(True)> Public Overrides Property ForeColor() As Color
        Get
            Return clrForeColor
        End Get
        Set(ByVal Value As Color)
            clrForeColor = Value
            MyBrush.Color = clrForeColor
            Me.Invalidate()
'*****
            MyBase.ForeColor = Value
'*****
        End Set
    End Property
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question