示例#1
0
        public void InitAfter()
        {
            DG.ClipGeometry = backgrounds.CurrentBackground.Rect;

            OldCol.Add(backgrounds.CurrentBackground.Drawing);
            OldCol.Add(Old.DrawingName);
            OldCol.Add(Old.DrawingText);

            NewCol.Add(backgrounds.CurrentBackground.Drawing);
            NewCol.Add(New.DrawingName);
            NewCol.Add(New.DrawingText);

            VisualText.Source = new DrawingImage(DG);
        }
示例#2
0
        public static DrawingCollection GetCollection()
        {
            DrawingCollection tempList = null;

            using (SqlConnection myConnection = new SqlConnection(AppConfiguration.ConnectionString))
            {
                using (SqlCommand myCommand = new SqlCommand("usp_GetDrawing", myConnection))
                {
                    myCommand.CommandType = CommandType.StoredProcedure;

                    myCommand.Parameters.AddWithValue("@QueryId", SelectTypeEnum.GetCollection);

                    myConnection.Open();
                    using (SqlDataReader myReader = myCommand.ExecuteReader())
                    {
                        if (myReader.HasRows)
                        {
                            tempList = new DrawingCollection();
                            while (myReader.Read())
                            {
                                tempList.Add(FillDataRecord(myReader));
                            }
                        }
                        myReader.Close();
                    }
                }
            }
            return(tempList);
        }
示例#3
0
        protected override Size ArrangeOverride(Size arrangeBounds)
        {
            Debug.Print("Arrange");

            var columns = (int)(arrangeBounds.Width / m_tileSize);
            var rows    = (int)(arrangeBounds.Height / m_tileSize);

            if (columns != m_columns || rows != m_rows)
            {
                m_columns = columns;
                m_rows    = rows;

                var bmp = m_symbolBitmapCache.GetBitmap(SymbolID.Undefined, Colors.Black, false);

                var drawingCollection = new DrawingCollection();

                for (int y = 0; y < m_rows; ++y)
                {
                    for (int x = 0; x < m_columns; ++x)
                    {
                        var imageDrawing = new ImageDrawing(bmp, new Rect(new Point(x * m_tileSize, y * m_tileSize),
                                                                          new Size(m_tileSize, m_tileSize)));
                        drawingCollection.Add(imageDrawing);
                        imageDrawing = new ImageDrawing(bmp, new Rect(new Point(x * m_tileSize, y * m_tileSize),
                                                                      new Size(m_tileSize, m_tileSize)));
                        drawingCollection.Add(imageDrawing);
                    }
                }

                var drawingGroup = new DrawingGroup();
                drawingGroup.Children = drawingCollection;
                m_drawing             = drawingGroup;
            }

            Render();

            return(base.ArrangeOverride(arrangeBounds));
        }
示例#4
0
        protected override Size ArrangeOverride(Size arrangeBounds)
        {
            Debug.Print("Arrange");

            var columns = (int)(arrangeBounds.Width / m_tileSize);
            var rows = (int)(arrangeBounds.Height / m_tileSize);

            if (columns != m_columns || rows != m_rows)
            {
                m_columns = columns;
                m_rows = rows;

                var bmp = m_symbolBitmapCache.GetBitmap(SymbolID.Undefined, Colors.Black, false);

                var drawingCollection = new DrawingCollection();

                for (int y = 0; y < m_rows; ++y)
                {
                    for (int x = 0; x < m_columns; ++x)
                    {
                        var imageDrawing = new ImageDrawing(bmp, new Rect(new Point(x * m_tileSize, y * m_tileSize),
                            new Size(m_tileSize, m_tileSize)));
                        drawingCollection.Add(imageDrawing);
                        imageDrawing = new ImageDrawing(bmp, new Rect(new Point(x * m_tileSize, y * m_tileSize),
                            new Size(m_tileSize, m_tileSize)));
                        drawingCollection.Add(imageDrawing);
                    }
                }

                var drawingGroup = new DrawingGroup();
                drawingGroup.Children = drawingCollection;
                m_drawing = drawingGroup;
            }

            Render();

            return base.ArrangeOverride(arrangeBounds);
        }
        /// <summary>
        /// Dispose() closes this DrawingContext for any further additions, and 
        /// returns it's content to the object that created it.
        /// </summary> 
        /// <remarks> 
        /// Further Draw/Push/Pop calls to this DrawingContext will result in an
        /// exception.  This method also matches any outstanding Push calls with 
        /// a cooresponding Pop.  Multiple calls to Dispose will not result in
        /// an exception.
        /// </remarks>
        protected override void DisposeCore() 
        {
            // Dispose may be called multiple times without throwing 
            // an exception. 
            if (!_disposed)
            { 
                //
                // Match any outstanding Push calls with a Pop
                //
 
                if (_previousDrawingGroupStack != null)
                { 
                    int stackCount = _previousDrawingGroupStack.Count; 
                    for (int i = 0; i < stackCount; i++)
                    { 
                        Pop();
                    }
                }
 
                //
                // Call CloseCore with the root DrawingGroup's children 
                // 

                DrawingCollection rootChildren; 

                if (_currentDrawingGroup != null)
                 {
                    // If we created a root DrawingGroup because multiple elements 
                    // exist at the root level, provide it's Children collection
                    // directly. 
                    rootChildren = _currentDrawingGroup.Children; 
                }
                else 
                {
                    // Create a new DrawingCollection if we didn't create a
                    // root DrawingGroup because the root level only contained
                    // a single child. 
                    //
                    // This collection is needed by DrawingGroup.Open because 
                    // Open always replaces it's Children collection.  It isn't 
                    // strictly needed for Append, but always using a collection
                    // simplifies the TransactionalAppend implementation (i.e., 
                    // a seperate implemention isn't needed for a single element)
                    rootChildren = new DrawingCollection();

                    // 
                    // We may need to opt-out of inheritance through the new Freezable.
                    // This is controlled by this.CanBeInheritanceContext. 
                    // 

                    rootChildren.CanBeInheritanceContext = CanBeInheritanceContext; 

                    if (_rootDrawing != null)
                    {
                        rootChildren.Add(_rootDrawing); 
                    }
                } 
 
                // Inform our derived classes that Close was called
                CloseCore(rootChildren); 

                _disposed = true;
            }
        }