 |
|
 |
This is really great engine!!!
I have one question....I'm having User Control whit List View and Image List on it. I use it to read and show pictures with captions from some file. This reading is automatized through code, so, when I add new picture into my file, I automatic see her in my List View on my User Control.
Can I add whole User Control, whit list of containing images, that each one separately represent an Item in my toolbox tab? In other words, I would like to read all my images from the file andd to represent them like toolbox items....Is this possible?
Do you have some idea how to do this?
|
|
|
|
 |
|
 |
Create tool but the question is after adding controls to the form how can use them,change properties use events,ect..
Thank you
|
|
|
|
 |
|
 |
Hy
Thank's for this control. It is exactly what I need for my application.
I have just one question.
Is it possible to delete the menu on the right click?
My users don't have to modify the toolbox but just take some controls and make a drag and drop on another control.
Thanks
PS. excuse my english, I'm french
|
|
|
|
 |
|
 |
hi,i want to know what happen when i drag an item,for example a textbox, from
toolbox?i mean;what is creating in background as textbox1,textbox2,textbox3,because i want to extract them to another form.and also if it is possible
plz guid me in the way of changing selectedObject to the current textBox1,2,3 or label1,2,3 that are dragged into the from in order to use propertiyGrid for them.
|
|
|
|
 |
|
 |
Hello,
I used your control, its cool, it works and is very easy to use !!
Great job..
Cheers,
Aseem Chiplonkar
Enough research will tend to support whatever theory !
|
|
|
|
 |
|
 |
Hi
I want to use toolbox. Its working fine. keep it up.
I want to know the following. Once I drag and drop a control (textbox) and then a label and switch between these controls (textbox and label) how do I know which control has the focus.
Kindly help me in regards to this.
Thanks in advance
|
|
|
|
 |
|
 |
How can I programatically add component from de IPToolbox to my DesignSurface?
|
|
|
|
 |
|
 |
Great control but RightToLeft functionality is missing.
Computer Science is no more about computers than Astronomy is about telescopes.
- E. W. Dijkstra
|
|
|
|
 |
|
 |
It is not possible to drag a tab to another tab. Instead to be moved to the tab I drag it to it is placed in its parent
|
|
|
|
 |
|
 |
Can i able to include the controls in the run time by this one?
I want to develop an application which provide the user to include controls in "run time" by drag and drop option. Can any one help me in this?
Raghava
|
|
|
|
 |
|
 |
Hi!
The support for using a keyboard on the control has been up in another message, is tis something you can add to the control?
Great work you have done with the control, thx a lot.
|
|
|
|
 |
|
 |
This is an excellent piece of software. Well done!
There is someone in my head but it's not me - Pink Floyd
|
|
|
|
 |
|
|
 |
|
|
 |
|
 |
Hi! Greate control! Thanks you a lot. By the way I tried to read the help, but it doesn't work. All URLs are not valid? Can you help me please with a help? Привет земляку!!!!
|
|
|
|
 |
|
 |
Hi
I got some warnings regarding the use of SerializeItem in your code..
Is this correct?
And the image files are there now but they look strange.. the background of the image files is not transparant anymore, it's black.
The image files I added are from png files.
This is vb.. I load my image icon with this code, it wokrs fine .
Myiteme.image = CType(resources.GetObject("Test.Image"), System.Drawing.Image)
So when loading the image with code it looks fine, but loading with xml I get the black backgrounds
|
|
|
|
 |
|
 |
Hi, Neno
Yes, Obsolete warnings are correct, try to avoid using of those methods in your code.
[Neno] wrote: And the image files are there now but they look strange.. the background of the image files is not transparant anymore, it's black.
The image files I added are from png files.
That's the problem that I've not included serialization of images by default in previous versions - from the runtime I can't determine what type of the image is associated with the Item, so I've hardcoded to serialize it to BMP format. But bmp is lossy format compared to png, so the backgroud of the image is lost.
To solve the problem, you have to serialize images manually.
Inherit from the Item class, override Image property and add an XmlIgnore attribute for it, then override methods SerializeToXml and DeserializeXml like that:
[System.Xml.Serialization.XmlIgnore]
public override System.Drawing.Image Image
{
get { return base.Image; }
set { base.Image = value; }
}
protected override System.Xml.XmlElement SerializeToXml(System.Xml.XmlDocument document)
{
System.Xml.XmlElement xml = base.SerializeToXml(document);
using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
{
Image.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
stream.Flush();
xml.SetAttribute("Image", Convert.ToBase64String(stream.ToArray()));
}
}
protected override void DeserializeXml(XmlElement element)
{
base.DeserializeXml(element);
System.Xml.XmlAttribute imageAttribute = element.Attributes["Image"];
if (imageAttribute != null)
{
System.IO.MemoryStream stream = new System.IO.MemoryStream(Convert.FromBase64String(attribute.Value));
this.Image = System.Drawing.Image.FromStream(stream);
}
}
You can omit overriding of Image property and DeserializeXml method, but in that case image would be serialized twice, though only the second would be saved to XML
|
|
|
|
 |
|
 |
public partial class UserControl1 : UserControl
{
private UserControl1 _userCtl;
public UserControl1 UserCtl
{
get { return _userCtl; }
set { _userCtl = value; }
}
public UserControl1()
{
InitializeComponent();
}
}
In RealTime:
....
class Form1:Form{
public Form1(){
InitializeComponent();//-2 UserControl1 are (uc1 and uc2) and 1 property grid
propertygrid1.selectobject=uc1;
//now in RealTime I whant set in uc1.UserCtl - some as uc2 BUT IN DropDownList I look none?
//pleas help me
}
}
....
|
|
|
|
 |
|
 |
Hi! In your example you have this code to save the settings to xml this.toolbox1.Save("toolbox.xml"); I use the same function in vb to save my settings but I when doing that the image on the items dosen't get saved. I got a imges on the item when running the program
Here is the xml file after a save. <code> <ToolboxConfig> <Toolbox general="False" itemHeight="20" tabHeight="16" autoScroll="True" allowToolboxItems="True" allowNested="False" drawLevel="False" showAll="False" showIcons="True" showPointer="False"> <Category text="Avvikande poster" opened="True" deletable="False"> <Item text="Test" tip="Test" /> <Item text="Test2" tip="Test2" /> </Category> </Toolbox> </ToolboxConfig> </code> Must I add the item in a certain way to get it to work? I get my image from the froms resx file not the global. /Neno
|
|
|
|
 |
|
 |
Hi, Neno!
You're right, images are not serialized by default, you should serialize them yourself.
Just inherit from the Toolbox, and override methods SerializeItem and DeserializeItem (check the HostToolbox.Serializer.cs file to see how it's done).
By default, only Text, Visible, Enabled and Tooltip properties are serialized.
P.S. I've noticed that the serialization isn't well done , it should be re-engineered
|
|
|
|
 |
|
 |
Ok. I a little new when it comes to serialize items. Is it possible to add this functions so i's done automaticallywhen using the save function. But in you XML file there are image suport. I'm not exactly sure if I understand how to do this.
Can I add a row like this one to serialize the image in the SerializeItem function tabItem.SetAttribute(Serializer_Text, hostItem.Text); and one in the DeserializeItem.
someting like this?? but what should xxxxx be?? and the code in the DeserializeItem how do I fix the value from string to image. internal const string Serializer_Image = "Image"; protected override void SerializeItem(XmlElement category, Toolbox.Item item) { HostItem hostItem = item as HostItem; if (hostItem != null) { --- Your code------ tabItem.SetAttribute(Serializer_Image, xxxxxxxx); } else base.SerializeItem(category, item); }
protected override void DeserializeItem(XmlElement item, ITab tab) { string stringValue; if (GetAttribute(item, Serializer_TypeName, out stringValue)) { Type type = Type.GetType(stringValue); if (type != null) { --- Your code------ if (GetAttribute(item, Serializer_Text, out stringValue)) { hostItem.Text = stringValue; } else if (GetAttribute(item, Serializer_Image, out stringValue)) { hostItem.Image = stringValue; } } } else base.DeserializeItem(item, tab); }
-- modified at 13:48 Thursday 24th May, 2007
|
|
|
|
 |
|
 |
I've just posted an updated article, where I've fixed serialization of Items, so now Images are saved by default. Just wait for a while
P.S. As images are binaries, they should be converted to string to serialize into XML format. It is done like that:
string attributeValue;
using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
{
image.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);
stream.Flush();
attributeValue = Convert.ToBase64String(stream.ToArray());
}
|
|
|
|
 |
|
 |
Great!!!
Thx m8!!
|
|
|
|
 |
|
 |
Just a quick tip: I found that when using the control the text had no antialiasing applied. So i just added the following to the OnPaint events of the ToolBox,ToolBox.Tab and ToolBox.Item classes:
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
And there it was perfect !!!
Great control man
|
|
|
|
 |
|
 |
Thanks
|
|
|
|
 |