コード例 #1
0
        public int ToLinear(PresentationSpaceDim InDim)
        {
            int lx = InDim.Width * (mRow - 1);

            lx += mColumn;
            return(lx);
        }
コード例 #2
0
 public PresentationSpace(DisplayLocation CursorLocation, PresentationSpaceDim Dim,
                          IEnumerable <PresentationSpaceField> Fields)
 {
     this.Dim            = Dim;
     this.CursorLocation = CursorLocation;
     this.Fields         = new LinkedList <PresentationSpaceField>();
     foreach (var item in Fields)
     {
         this.Fields.AddLast(item);
     }
 }
コード例 #3
0
        /// <summary>
        /// get the DrawContext of a control from its OnRender method.
        /// </summary>
        /// <param name="DrawContext"></param>
        public void DrawText(DrawingContext DrawContext)
        {
            double emSize        = 12;
            var    formattedText = new FormattedText(
                this.Text,
                CultureInfo.GetCultureInfo("en-us"),
                System.Windows.FlowDirection.LeftToRight,
                new Typeface("Lucida Console"),
                emSize,
                System.Windows.Media.Brushes.Black);

            var charSx = PresentationSpaceField.CalcCharSize(emSize);

            // advance the fld location past the attribute byte.
            var    psDim = new PresentationSpaceDim(24, 80);
            var    loc   = psDim.IncDisplayLocation(this.Location);
            double y     = (loc.Row - 1) * charSx.Height;
            double x     = (loc.Column - 1) * charSx.Width;

            // Draw the formatted text string to the DrawingContext of the control.
            DrawContext.DrawText(formattedText, new System.Windows.Point(x, y));
        }