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

Win Control and designtime refresh

Hi all

Im currently constructing a Windows control that inherits from RichTextBox,
but I'm having a bit of trouble with updating the control at design time.

The senario is SIMPLIFIED as follows:

My RichTextBox control :

Public Class Crtb
Inherits RichTextBox

private _indentifiers() as Identifier ' An array of Indentifier objects

Public Sub RefreshRtb
' Refreshes the Box acording to the Identifiers
End Sub

Public Overloads Sub AddIndentifier(ByVal characters As String, ByVal
color As System.Drawing.Color)
ReDim Preserve Me._indentifiers(Me._indentifiers.GetUpperBound(0) + 1)
Me._indentifiers(Me._indentifiers.GetUpperBound(0) ) = New
Identifier(characters, color)
End Sub

End Class
An Identifier Class holding a KeyWord as _formatCharacters and a Color to
use in the RTB for this keyword:

< Serializable()> _
Public Class Identifier
Private _formatCharacters As String
Private _color As System.Drawing.Color

Public Property FormatCharacters() As String
......
Public Property Color() As System.Drawing.Color
.....
Public Sub New()
Me._formatCharacters = ""
Me._color = System.Drawing.Color.Blue
End Sub

Public Sub New(formatCharacters As String, color as System.Drawing.Color)
me._formatCharacters = formatCharacters
me._color = color
End Sub

End Class
This is very simplified but should give a picture of the senario.

Now when adding a control to a form I can edit the Identifiers property
array at design time, and so add new Identifiers and e.g. change the color of
the existing ones.

My problem is that I want the RTB control to refresh itself on designtime
when I change e.g. a color property of one of the Identifiers objects in the
array. This can be done by adding an event to the Identifier class and
thereafter adding a handle that calls Refresh for this event each time a new
Identifier is added to The RTB.

This though gives me a big problem since an eventhandler is not able to be
serialized, which meens that the refresh functionallity disappears when I run
the app and return to design mode. As far as I know the control saves it's
state in the resx file, but since the event handlers can't be serialized this
part of the control is lost.

This is a senario that is used in many controls out there, so I hope that
someone is able to tell me how to get this designtime refresh functionallity
in some other way.

Thanks in advance

Allan
Nov 21 '05 #1
0 1070

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

Similar topics

4
by: Weinand Daniel | last post by:
i'd like to monitor changes of the "Control.Name" porperty during designtime. if the user changes the name in designer my event musst fire. i have created a own button control. with an event...
4
by: RL Stevenson | last post by:
Often I want to change the Enable or Visibility on a control when some other control on the form changes. Or maybe I need to make a change to the DataSource on a combo box when the user makes a...
2
by: Allan Bredahl | last post by:
Hi all Im currently constructing a Windows control that inherits from RichTextBox, but I'm having a bit of trouble with updating the control at design time. The senario is SIMPLIFIED as...
0
by: Allan Bredahl | last post by:
Hi all Im currently constructing a Windows control that inherits from RichTextBox, but I'm having a bit of trouble with updating the control at design time. The senario is SIMPLIFIED as...
0
by: Mike | last post by:
Hi. I want to refresh the design time control html when a property is changed. I've used NotifyParent(true) attribute but doesn't work. My control inherit from System.Web.UI.Control. How can i...
1
by: Kenneth Siewers Møller | last post by:
Hi there I have a custom label control (GradientLabel) which enherits from Label and basically just paints the background of a label in a gradient. In my code I have the following for the...
10
by: Yuk Tang | last post by:
Another step on the road to enlightenment, aka producing a UI. I've added a webbrowser control to a form, and I want it to fill the space of the form. Playing around with docking, left, top,...
2
by: rotsj | last post by:
Hello, I would like to make my own dropdownlist and add a collection as a generic List. When I enter items @ designtime, @ runtime they are gone. Can anyone tell me please what the problem...
2
by: Johnny Jörgensen | last post by:
I would like to be able to tell whether my component code is executed when I instanciate a control in runtime or in designtime. Can anybody give me a clua as to how you can do that? Cheers,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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.