Hi,
I'm looking resources or tutorial where I can learn how to add
properties to other objects at design time for VB.NEt or C#.
I want to reproduce the same effect as when your drop the tooltip object
on a form. Once it's done, every object has a new property added to the
property box so we can write the tooltip text.
Syncfusion object does something like that when we drop a docking
manager tool. It adds 3 new properties to every object that can use this
resources.
I tried to find information but maybe because I don't know how to call
that effect, I was not succesfull to find information.
Thank you very much.
Miky
*** Sent via Developersdex http://www.developersdex.com *** 2 1728
The thing you need is an object that implements IExtenderProvid er.
An extender-provider can "extend" other object by appearing to add
properties to them at design time. Note that at runtime the process is
handled differently.
The object being extended has no knowlege of the new properties either.
After my signature you'll find a simple extender-provider that adds "status"
properties to menu items. These properties can be displayed in a status bar
chosen at design time.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
Imports System
Imports System.Componen tModel
Imports System.Collecti ons
Imports System.Drawing
Imports System.Windows. Forms
<ToolboxItem(Tr ue), _
ToolboxBitmap(G etType(MenuStat usExtender), "MenuStatusExte nder.bmp"), _
ProvideProperty ("StatusText ", "System.Windows .Forms.MenuItem ") _ _
Public Class MenuStatusExten der
Inherits Component
Implements IExtenderProvid er
Private _extendees As New Hashtable
Public Sub New()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
Dim mi As MenuItem
If Not Me.DesignMode Then
For Each mi In _extendees.Keys
RemoveHandler mi.Select, AddressOf Me.MenuStatusEx tender_Select
Next
End If
_extendees.Clea r()
MyBase.Dispose( disposing)
End Sub
Public Overridable Function CanExtend(ByVal extendee As [Object]) As Boolean
Implements IExtenderProvid er.CanExtend
Return TypeOf extendee Is MenuItem
End Function
Public Function GetStatusText(B yVal item As MenuItem) As String
If _extendees.Cont ainsKey(item) Then
Return CType(_extendee s(item), String)
Else
Return ""
End If
End Function
Public Sub SetStatusText(B yVal item As MenuItem, ByVal s As String)
If _extendees.Cont ainsKey(item) Then
_extendees(item ) = s
Else
If Not Me.DesignMode Then
AddHandler item.Select, AddressOf Me.MenuStatusEx tender_Select
End If
_extendees.Add( item, s)
End If
End Sub
Private Sub MenuStatusExten der_Select(ByVa l sender As Object, ByVal e As
EventArgs)
OnItemSelected( New ItemSelectEvent Args(_extendees (sender)))
End Sub
Private Sub OnItemSelected( ByVal e As ItemSelectEvent Args)
RaiseEvent ItemSelected(Me , e)
End Sub
Public Event ItemSelected As ItemSelectEvent Handler
End Class
Public Class ItemSelectEvent Args
Inherits EventArgs
Private _statusMessage As String
Protected Sub New()
End Sub
Public Sub New(ByVal message As String)
_statusMessage = message
End Sub
Public ReadOnly Property StatusMessage() As String
Get
Return _statusMessage
End Get
End Property
End Class
Public Delegate Sub ItemSelectEvent Handler(ByVal sender As Object, ByVal e
As ItemSelectEvent Args)
"Miky" <no****@virtuel com.com> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. .. Hi,
I'm looking resources or tutorial where I can learn how to add properties to other objects at design time for VB.NEt or C#.
I want to reproduce the same effect as when your drop the tooltip object on a form. Once it's done, every object has a new property added to the property box so we can write the tooltip text.
Syncfusion object does something like that when we drop a docking manager tool. It adds 3 new properties to every object that can use this resources.
I tried to find information but maybe because I don't know how to call that effect, I was not succesfull to find information.
Thank you very much.
Miky
*** Sent via Developersdex http://www.developersdex.com ***
Miky,
Take a look at the Extender Provider: http://msdn.microsoft.com/library/de...erprovider.asp
HTH,
-B
"Miky" <no****@virtuel com.com> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. .. Hi,
I'm looking resources or tutorial where I can learn how to add properties to other objects at design time for VB.NEt or C#.
I want to reproduce the same effect as when your drop the tooltip object on a form. Once it's done, every object has a new property added to the property box so we can write the tooltip text.
Syncfusion object does something like that when we drop a docking manager tool. It adds 3 new properties to every object that can use this resources.
I tried to find information but maybe because I don't know how to call that effect, I was not succesfull to find information.
Thank you very much.
Miky
*** Sent via Developersdex http://www.developersdex.com *** This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: pablo |
last post by:
Dear NewsGroupers,
I am relatively new to OOP and cannet get my head around this problem.
I have two classes. Class Child extends Parent.
There is no constructor for the Child class. So when I create a child object
the constructor for the parent object is called. That works fine.
But now I have the problem that I want to add an already existing Parent
object to create a new Child object. How can this be done?
|
by: manohar.shankar |
last post by:
Hi,
I have been searching on this topic for quite sometime and didnt get
any answer.
Is there a way I can extend/add methods/properties to a C# class during
runtime.
eg.,
I have class:
public class MyClass {
|
by: James Geurts |
last post by:
Hey all... I posted this in the vs.net ide group too, but people are not answering, so I figured that it might be more appropriate here. I'm not sure if I'm adding a designer to my code properly. I'm only adding it to the tree node, where each custom tree node is then added to a normal tree control
I'm trying to get an add-in to interact with the property window in VS.Net. Basically, I created a tool window containing a custom tree...
|
by: Richard Abraham |
last post by:
I have created a new class ServiceTimer based upon the .NET System.Timers.Timer class. This has a new property CollectionIntervalMinutes which I expected to be added to the 'Behavior' section of the class properties and also to be available as a 'Dynamic' property so that I could control it from the application config file. The new property is not shown, but the properties inherited from the base class are
I cannot find any reference to how...
|
by: Tim Marsden |
last post by:
Hi,
This is what I am doing, please comment if this is the correct way.
I need to add controls to a form dynamically.
Within the Page_Load event (is not Postback) I run a routine to create the
controls, and populate the dropdowns etc,
I use addhandler to define delegates to capture events raised by the
controls.
I store these controls in a hashtable.
| |
by: Dino M. Buljubasic |
last post by:
Is it possible to add my own property to a control?
For example, since MainMenu control does not have Background property, can I
add my own and use it to set the color.
Thank you,
Dino
--
|
by: cleo |
last post by:
In VB6 my practice was to set control properties at Run Time rather than
Design Time. I found setting property values in the code provided better
documentation, since much of this was hidden - and if there were problems
with a control dll setting values were preserved and not "lost" to the
domain of searching code using a DOS editor.
However, as I start work in VB.Net I'm questioning if I should continue my
practice of avoiding Design...
|
by: Dennis |
last post by:
I have a control which I wrote that has, of course, numerous properties.
These properties nicely show up at design time in the property window for the
user to set their value at design time. However, their are a few that
should be set only in code at run-time. How do I prevent these properties
from showing up in the Properties window at design time. Thanks for any
replys.
--
Dennis in Houston
|
by: Pete Kane |
last post by:
Hi All, does anyone know how to add TabPages of ones own classes at design time ? ideally when adding a new TabControl it would
contain tab pages of my own classes, I know you can achieve this with ListView columns so it should be doable, thanks
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |