Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

Gone 0

@Gone 0
About
Posts
4
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Copy/paste of generic collection
    G Gone 0

    You know what...it's working. It seems things like

    stream.Seek(0, SeekOrigin.Begin);

    are not a good idea. Thanks! By the way, your XACC project is really impressive. :omg: Kind, F.

    I thought about it,
    I stood up
    and I did it.
    The Netron Project

    C# csharp com json help question

  • Copy/paste of generic collection
    G Gone 0

    Ah! Interesting, though unorthodox idea. The logic is as follows; I first make a deep copy of the collection such that it's detached from the context. Since it's a copy of the collection is seemed logical to implement a 'Copy()' method. Of course, your suggestion is quite an interesting short-cut and I tried it out but...a Stream instance is not serializable and the pasting results in a 'null' value. On the other hand, an Image object is a kind of stream as well, no? :doh: The Clipboard has never been my favorite. Thanks a bunch for the idea! I have posted the question on Google, MSDN forums, here and you're the only one who has answered. :)

    I thought about it,
    I stood up
    and I did it.
    The Netron Project

    C# csharp com json help question

  • Column Click with right mouse button ?
    G Gone 0

    You need to override the OnMouseDown event and check the parameter

    if(e.Button == MouseButtons.Right)
    object obj = this.shapesListView.GetChildAtPoint(e.Location);
    ...

    Check out the following article for details.

    I thought about it,
    I stood up
    and I did it.
    The Netron Project

    C# tutorial question

  • Copy/paste of generic collection
    G Gone 0

    My copy/paste operation results in a MemoryStream full of '\0' characters on the Clipboard. Maybe my approach to copy/paste is wrong when handling generic types? All entries in the CollectionBase are, of course, ISerializable and the binary serialization to file fully works. The collection is, to sketch the context, a set of shapes and connections of a diagram (application), see the Netron project[^] for details. Thank you so much for you help. :rose: The copy operation:

    CollectionBase<IDiagramEntity> copy = MyDeepCopyOfTheCollectionViaSerialization();
    DataFormats.Format format =
    DataFormats.GetFormat(typeof(CollectionBase<IDiagramEntity> ).FullName);
    IDataObject dataObject = new DataObject();
    dataObject.SetData(format.Name, false, copy);
    Clipboard.SetDataObject(dataObject, false);

    where the MyDeepCopyOfTheCollectionViaSerialization() is :

    CollectionBase<T> newobj = null;
    MemoryStream stream = new MemoryStream();
    GenericFormatter<BinaryFormatter> f = new
    GenericFormatter<BinaryFormatter>();
    f.Serialize(stream, this);
    stream.Seek(0, SeekOrigin.Begin);
    newobj = f.Deserialize<CollectionBase<T>>(stream);
    stream.Close();
    return newobj;

    And finally the Paste operation is:

    IDataObject data = Clipboard.GetDataObject();
    string format = typeof(CollectionBase<IDiagramEntity> ).FullName;
    if (data.GetDataPresent(format))
    {
    //data.GetData(format) is a MemoryStream rather than a generic collection! X|
    }

    I thought about it,
    I stood up
    and I did it.
    The Netron Project

    -- modified at 10:59 Saturday 18th March, 2006

    C# csharp com json help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups