Exemple #1
0
        /// <summary>
        /// YdHost内を描画する
        /// </summary>
        /// <param name="info"></param>
        protected virtual void Rendering(YdGeometryRenderInfo info)
        {
            DrawingVisual  v   = new DrawingVisual();
            DrawingContext ctx = v.RenderOpen();

            ctx.DrawGeometry(info.Brush, info.Pen, info.Geometry);
            ctx.Close();
            this.Children.Add(v);
        }
Exemple #2
0
        /// <summary>
        /// 図形情報が変更されたら再描画する
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            YdGeometryRenderInfo info = sender as YdGeometryRenderInfo;

            if (info != null)
            {
                this.Rendering(info);
            }
        }
Exemple #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            YdHost               h  = new YdHost();
            RectangleGeometry    rg = new RectangleGeometry(new Rect(new Point(10, 10), new Size(20, 20)));
            YdGeometryRenderInfo ri = new YdGeometryRenderInfo();

            ri.Geometry  = rg;
            ri.Brush     = new SolidColorBrush(Colors.BlueViolet);
            ri.Pen       = new Pen(new SolidColorBrush(Colors.RosyBrown), 1.0);
            h.RenderInfo = ri;
            this.ydCanvas.Children.Add(h);
        }