Example #1
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            string          text1   = value as string;
            ThumbnailViewer viewer1 = (ThumbnailViewer)context.PropertyDescriptor.GetValue(context.Instance);

            if (text1 != null)
            {
                text1 = text1.Trim();
                if (text1.Length != 0)
                {
                    if (culture == null)
                    {
                        culture = CultureInfo.CurrentCulture;
                    }
                    char     ch1        = culture.TextInfo.ListSeparator[0];
                    string[] textArray1 = text1.Split(new char[] { ch1 });

                    viewer1.Collapsed         = Boolean.Parse(textArray1[0]);
                    viewer1.Visible           = Boolean.Parse(textArray1[1]);
                    viewer1.ShowBrowseButton  = Boolean.Parse(textArray1[2]);
                    viewer1.ThumbnailFileType = (ThumbnailFileType)int.Parse(textArray1[3]);
                }
                return(viewer1);
            }
            return(base.ConvertFrom(context, culture, value));
        }
Example #2
0
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == null)
     {
         throw new ArgumentNullException("destinationType");
     }
     if (value is ThumbnailViewer)
     {
         if (destinationType == typeof(string))
         {
             ThumbnailViewer ImageViewer1 = (ThumbnailViewer)value;
             if (culture == null)
             {
                 culture = CultureInfo.CurrentCulture;
             }
             string        text1      = culture.TextInfo.ListSeparator + " ";
             TypeConverter converter1 = TypeDescriptor.GetConverter(typeof(Boolean));
             string[]      textArray1 = new string[4];
             int           num1       = 0;
             textArray1[num1++] = converter1.ConvertToString(context, culture, ImageViewer1.Visible);
             textArray1[num1++] = converter1.ConvertToString(context, culture, ImageViewer1.Collapsed);
             textArray1[num1++] = converter1.ConvertToString(context, culture, ImageViewer1.ShowBrowseButton);
             textArray1[num1++] = converter1.ConvertToString(context, culture, ImageViewer1.ThumbnailFileType);
             return(string.Join(text1, textArray1));
         }
         if (destinationType == typeof(InstanceDescriptor))
         {
             ThumbnailViewer ImageViewer2 = (ThumbnailViewer)value;
             return(new InstanceDescriptor(typeof(ThumbnailViewer).GetConstructor(new Type[] { typeof(bool), typeof(bool), typeof(bool), typeof(ThumbnailFileType) }), new object[] { ImageViewer2.Visible, ImageViewer2.Collapsed, ImageViewer2.ShowBrowseButton, ImageViewer2.ThumbnailFileType }));
         }
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
Example #3
0
        public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (propertyValues == null)
            {
                throw new ArgumentNullException("propertyValues");
            }
            ThumbnailViewer ImageViewer1 = (ThumbnailViewer)context.PropertyDescriptor.GetValue(context.Instance);

            ImageViewer1.Visible           = (bool)propertyValues["Visible"];
            ImageViewer1.Collapsed         = (bool)propertyValues["Collapsed"];
            ImageViewer1.ShowBrowseButton  = (bool)propertyValues["ShowBrowseButton"];
            ImageViewer1.ThumbnailFileType = (ThumbnailFileType)propertyValues["ThumbnailFileType"];


            return(ImageViewer1);
        }
        public NuGenMediImageCtrl()
        {
            thumbnailProxy = new ThumbnailViewer(true,false,true,ThumbnailFileType.AllImages);
            sliceProxy = new SliceViewer(true,false);
            tabBarProxy = new TabBar(true,false,true);

            thumbnailProxy.Ctrl = this;
            sliceProxy.Ctrl = this;
            tabBarProxy.Ctrl = this;

            startMenu = new PhotoMenu(this);
            startMenuCollection = new StartMenuCollection();
            startMenuCollection.Init(startMenu);

            InitializeComponent();


            //tabPageCollection = new TabPageCollection();
            //tabPageCollection.Init(this.internalTabBar);

            this.ribbonGroup1.ngMediImage = this;
            this.ribbonGroup2.ngMediImage = this;
            this.ribbonGroup3.ngMediImage = this;
            this.framesRibbonGroup.ngMediImage = this;
            this.ribbonGroup5.ngMediImage = this;
            this.ribbonGroup6.ngMediImage = this;
            this.browseButtonGroup.ngMediImage = this;

            this.thumbnailViewer.NgMediImage = this;
            this.sliceViewer.NgMediImage = this;
            this.viewerPane.NgMediImage = this;

            this.bottomTabBar.NgMediImage = this;

            this.tbAnnotations.NgMediImage = this;
            this.tbContrast.NgMediImage = this;
            this.tbOperations.NgMediImage = this;
            this.tbStart.NgMediImage = this;
            this.tbZoom.NgMediImage = this;
            
            btnAnnotColor.NgMediImage = this;
            btnAnnotFillColor.NgMediImage = this;
            btnBrowse.NgMediImage = this;
            btnCircle.NgMediImage = this;
            btnContrastBrightness.NgMediImage = this;
            btnEmboss.NgMediImage = this;
            btnFlipHoriz.NgMediImage = this;
            btnLine.NgMediImage = this;
            btnLut.NgMediImage = this;
            btnMeasurementUnits.NgMediImage = this;
            btnNext.NgMediImage = this;
            btnOverLay.NgMediImage = this;
            btnPlay.NgMediImage = this;
            btnPrev.NgMediImage = this;
            btnRotateLeft.NgMediImage = this;
            btnRotateRight.NgMediImage = this;
            btnShowHeader.NgMediImage = this;
            btnShowZoomBox.NgMediImage = this;
            btnSmooth.NgMediImage = this;
            btnSuggestedContrast.NgMediImage = this;
            btnZoom100.NgMediImage = this;
            btnZoomBoxSize.NgMediImage = this;
            btnZoomBoxZoomLevel.NgMediImage = this;
            btnZoomFit.NgMediImage = this;
            ribbonButton1.NgMediImage = this;
            ribbonButton2.NgMediImage = this;
            ribbonButton3.NgMediImage = this;
            ribbonButton4.NgMediImage = this;



            this.FileLoaded += new FileLoadedEventHandler(NuGenMediImageCtrl_FileLoaded);
            this.trkZoom.Invalidate();
            this.trkFrame.Invalidate();

            this.picBoxMain.DrawArea.ActiveTool = Genetibase.NuGenAnnotation.DrawArea.DrawToolType.Ellipse;
        }