Example #1
0
        public PropertyItem GetPropertyItem(int propid)
        {
            int              propSize;
            IntPtr           property;
            PropertyItem     item         = new PropertyItem();
            GdipPropertyItem gdipProperty = new GdipPropertyItem();
            Status           status;

            status = GDIPlus.GdipGetPropertyItemSize(nativeObject, propid,
                                                     out propSize);
            GDIPlus.CheckStatus(status);

            /* Get PropertyItem */
            property = Marshal.AllocHGlobal(propSize);
            try {
                status = GDIPlus.GdipGetPropertyItem(nativeObject, propid, propSize, property);
                GDIPlus.CheckStatus(status);
                gdipProperty = (GdipPropertyItem)Marshal.PtrToStructure(property,
                                                                        typeof(GdipPropertyItem));
                GdipPropertyItem.MarshalTo(gdipProperty, item);
            }
            finally {
                Marshal.FreeHGlobal(property);
            }
            return(item);
        }
Example #2
0
 internal static void MarshalTo(GdipPropertyItem gdipProp, PropertyItem prop)
 {
     prop.Id    = gdipProp.id;
     prop.Len   = gdipProp.len;
     prop.Type  = gdipProp.type;
     prop.Value = new byte [gdipProp.len];
     Marshal.Copy(gdipProp.value, prop.Value, 0, gdipProp.len);
 }