Example #1
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            string text1 = value as string;

            System.Windows.Forms.MessageBox.Show(text1);
            SliceViewer viewer1 = (SliceViewer)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]);
                }
                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 SliceViewer)
     {
         if (destinationType == typeof(string))
         {
             SliceViewer SliceViewer1 = (SliceViewer)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, SliceViewer1.Visible);
             textArray1[num1++] = converter1.ConvertToString(context, culture, SliceViewer1.Collapsed);
             return(string.Join(text1, textArray1));
         }
         if (destinationType == typeof(InstanceDescriptor))
         {
             SliceViewer SliceViewer2 = (SliceViewer)value;
             return(new InstanceDescriptor(typeof(SliceViewer).GetConstructor(new Type[] { typeof(bool), typeof(bool) }), new object[] { SliceViewer2.Visible, SliceViewer2.Collapsed }));
         }
     }
     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");
            }
            SliceViewer SliceViewer1 = (SliceViewer)context.PropertyDescriptor.GetValue(context.Instance);

            SliceViewer1.Visible   = (bool)propertyValues["Visible"];
            SliceViewer1.Collapsed = (bool)propertyValues["Collapsed"];

            return(SliceViewer1);
        }
        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;
        }