Exemple #1
0
        private GeoVectorHotSpot dirWidthHotSpot, dirHeightHotSpot; // Hotspot für Richtung

        public ShowPropertyPicture(Picture picture, IFrame Frame) : base(Frame)
        {
            this.picture        = picture;
            attributeProperties = picture.GetAttributeProperties(Frame);
            base.resourceId     = "Picture.Object";

            location = new GeoPointProperty("Picture.Location", Frame, true);
            location.GetGeoPointEvent     += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetRefPoint);
            location.SetGeoPointEvent     += new CADability.UserInterface.GeoPointProperty.SetGeoPointDelegate(OnSetRefPoint);
            location.ModifyWithMouseEvent += new ModifyWithMouseDelegate(OnModifyLocationWithMouse);
            width = new LengthProperty("Picture.Width", Frame, true);
            width.GetLengthEvent += new LengthProperty.GetLengthDelegate(OnGetWidth);
            width.SetLengthEvent += new LengthProperty.SetLengthDelegate(OnSetWidth);
            height = new LengthProperty("Picture.Height", Frame, true);
            height.GetLengthEvent += new LengthProperty.GetLengthDelegate(OnGetHeight);
            height.SetLengthEvent += new LengthProperty.SetLengthDelegate(OnSetHeight);
            dirWidth = new GeoVectorProperty("Picture.DirWidth", Frame, true);
            dirWidth.GetGeoVectorEvent    += new GeoVectorProperty.GetGeoVectorDelegate(OnGetDirWidth);
            dirWidth.SetGeoVectorEvent    += new GeoVectorProperty.SetGeoVectorDelegate(OnSetDirWidth);
            dirWidth.ModifyWithMouseEvent += new ModifyWithMouseDelegate(OnModifyDirWidthWithMouse);
            dirHeight = new GeoVectorProperty("Picture.DirHeight", Frame, true);
            dirHeight.GetGeoVectorEvent    += new GeoVectorProperty.GetGeoVectorDelegate(OnGetDirHeight);
            dirHeight.SetGeoVectorEvent    += new GeoVectorProperty.SetGeoVectorDelegate(OnSetDirHeight);
            dirHeight.ModifyWithMouseEvent += new ModifyWithMouseDelegate(OnModifyDirHeightWithMouse);
            path = new StringProperty(picture.Path, "Picture.Path");
            path.GetStringEvent += new StringProperty.GetStringDelegate(OnGetPath);
            path.SetStringEvent += new StringProperty.SetStringDelegate(OnSetPath);
            path.SetContextMenu("MenuId.Picture.Path", this);
            keepAspectRatio = new BooleanProperty("Picture.KeepAspectRatio", "YesNo.Values");
            double p = picture.DirectionWidth.Length / picture.Bitmap.Width * picture.Bitmap.Height / picture.DirectionHeight.Length;

            keepAspectRatio.BooleanValue         = Math.Abs(1.0 - p) < 1e-6;
            keepAspectRatio.BooleanChangedEvent += new BooleanChangedDelegate(OnKeepAspectRatioChanged);
            rectangular = new BooleanProperty("Picture.Rectangular", "YesNo.Values");
            rectangular.BooleanValue         = Precision.IsPerpendicular(picture.DirectionWidth, picture.DirectionHeight, false);
            rectangular.BooleanChangedEvent += new BooleanChangedDelegate(OnRectangularChanged);
            dirWidthHotSpot           = new GeoVectorHotSpot(dirWidth);
            dirWidthHotSpot.Position  = picture.Location + picture.DirectionWidth;
            dirHeightHotSpot          = new GeoVectorHotSpot(dirHeight);
            dirHeightHotSpot.Position = picture.Location + picture.DirectionHeight;
        }