473,657 Members | 2,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem serializing property on custom UserControl

I have a series of simple controls that I created to make some aspects of
Tablet PC programming a little easier. The "Tablet PC" aspects of the
controls are irrelevant to the problem I'm having, but I feel compelled to
mention it because it can be hard for someone to imagine my challenge when I
talk in hypotheticals.

Anyway, these controls each have an Ink property. For non-Tablet
developers, Ink is a class defined in the Tablet PC SDK (1.0+). I've
created a custom UI Editor for my Ink property and it works well at design
time, but as soon as I run the program the changes are gone. I can't seem
to figure out how to make the IDE (Visual Studio EA 2003) recognize the
change to the property and serialize the data.

I'm attaching my project code to this post because I can't really slim it
down and still have it do what I'm trying to do. Those of you who might be
able to help should be able to get past the extra nonsense pretty easily.
This is my first UI Editor so I'm sure the solution is pretty simple.

Here's how I created the editor:

1. First, I have the control (scratchLabel). If that doesn't go without
saying, please stop reading now - you can't help me. ;-)

2. I have a class called InkEditor which inherits from
System.Drawing. Design.UITypeEd itor.

3. In the InkEditor class I have overidden the EditValue method to
display a form which captures the ink. This form works on non-Tablet PC
machines as well. Here is the code for that method:

public override object
EditValue(Syste m.ComponentMode l.ITypeDescript orContext context,
IServiceProvide r provider, object value)

{

InkEditorDialog inkedit = new InkEditorDialog ();

if (value != null)

{

inkedit.Ink = (Ink)value;

}

else

{

inkedit.Ink = new Ink();

}

IWindowsFormsEd itorService winFormEditorSe rvice =
(IWindowsFormsE ditorService)pr ovider.GetServi ce(typeof(IWind owsFormsEditorS ervice));

if (DialogResult.O K == winFormEditorSe rvice.ShowDialo g(inkedit))

{

value = inkedit.Ink;

}

return value;

}

4. In the scratchLabel class (my control), I've put the following
attribute on my Ink property.

[DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Visible),Sy stem.ComponentM odel.Editor
(typeof(InkEdit or),typeof(Syst em.Drawing.Desi gn.UITypeEditor ))]

5. I probably should have mentioned it earlier, but my scratchLabel
class is tagged with the [Serializable()] attribute and implements the
ISerializable interface.

6. The following serialization code is included, but it doesn't seem to
ever get called.

public scratchLabel (SerializationI nfo info, StreamingContex t context)

{

InitializeCompo nent();

try

{

//deserialize class

this.Ink = (Ink)info.GetVa lue ("Ink",typeof(M icrosoft.Ink.In k));

}

catch (Exception ex)

{

throw ex;

}

}

//serializes class

void ISerializable.G etObjectData(Se rializationInfo info, StreamingContex t
context)

{

info.AddValue ("Ink",this.Ink );

}

So the million dollar question is, what am I missing? There must be
something really simple that I need to include to let the IDE know to save
the data.

Thanks for your help.

Rhy Mednick

P.S. The source code for the group of controls in development, for those
interested, is at http://chickenscratch.sourceforge.net and
http://inkmenu.sourceforge.net.


Nov 16 '05 #1
0 3299

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

Similar topics

4
2031
by: DraguVaso | last post by:
Hi, I'm having some weird behaviour, and I can't find any solution to this. I made a UserControl (uclCommands) which contains a Toolbar (ToolBar1) with Modifiers = Public. I put this usercontrol on my form and call it Ucl1. In the Property Window in the Windows Forms Designer I change Ucl1.ToolBar1.ButtonSize to a bigger value.
1
4019
by: Rhy Mednick | last post by:
I'm creating a custom control (inherited from UserControl) that is displayed by other controls on the form. I would like for the control to disappear when the user clicks outside my control the same way a menu does. To do this my control needs to get notified when the user tried to click off of it. The Leave and LostFocus events of the UserControl work most of the time but not always. For example, if they click on a part of the form...
0
3143
by: Chris Ericoli | last post by:
Hi, I am working with an 'in session' ado dataset with an asp.net application. My dataset is comprised of two tables, one of which maintains a few calculated datacolumns. For some reason these datacolumns do not trigger their expression when other columns from which the expressions are derived are updated. Below is a basic example of what I am doing. User enters values into an asp.net form and clicks a button. Retrieve dataset from...
5
4308
by: amatuer | last post by:
hi i have a link from page1 to page2. this link uses a querystring to transfer data. usually i have no problems using querystring t transfer data. bt for the first time page2 does not display.an eror page displays. i had a look at the properties of the error page to see if the url is correct and i noticed somthng iv never seen before.this is it:...
9
2064
by: norvinl | last post by:
Hi, I'm serializing a class and using shared memory / deserialization to send it to other processes. I can serialize with one app and deserialize with another instance of the same app. But if I try to deserialize with another different app, I get an exception (the assembly RegionViewer is the app that serialized the
2
697
by: she_prog | last post by:
I have a class derived from UserControl. I need to serialize an object of this class, but only some properties of it, as not all properties are serializable (some of the properties coming from UserControl are like that). When serializing, how could I ignore all the properties coming from the UserControl class? I know there is XmlIgnoreAttribute, but how could I set it to every property of UserControl, as it is not my class? Thank you...
5
20107
by: Nirdesh | last post by:
Hi, I am serializing a custom class holding some data for my project. This data internally contains a class which contains an event public delegate void MemberModifiedEventHandler(object sender, MemberModifiedEventArgs e); /// <summary>
4
1834
by: Jeff | last post by:
hi asp.net 2.0 I have created a custom web control, here is it's header: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="EditUserBox.ascx.cs" Inherits="Controls_EditUserBox" %> In another custom web user control, I use this web control: <%@ Register Src="~/Controls/EditUserBox.ascx" TagName="Eub" TagPrefix="mb"
9
2563
tlhintoq
by: tlhintoq | last post by:
Situation: A Windows Form with a single User Control containing 4 custom controls. This lets me drop the User Control on its own form to make it a dialog, or make it part of a larger configuration dialog with several such User Controls. Each custom control has a property for COM port name (serial port). Each custom control has a method for writing the settings. The user control has a GetEnumeration structure so it can be easily referenced...
0
8323
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,...
0
8838
Oralloy
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...
0
8739
jinu1996
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...
1
8513
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,...
0
8613
tracyyun
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...
0
5638
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();...
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
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...

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.