Example #1
0
        private void AddThumb()
        {
            TemperatureSign ts    = new TemperatureSign();
            Thumb           thumb = new Thumb();

            thumb.Width  = 15;
            thumb.Height = 15;
            thumb.Style  = FindResource("thumbStyle") as Style;
            thumb.Name   = "thumb";
            thumb.SnapsToDevicePixels = true;
            thumb.DragDelta          += Thumb_DragDelta;
            thumb.DragCompleted      += Thumb_DragCompleted;
            thumb.Foreground          = new SolidColorBrush(Colors.Transparent);
            myCanvas.Children.Add(thumb);
            thumb.Visibility = Visibility.Collapsed;
        }
Example #2
0
        private void PointTheCanvas()
        {
            #region  钮变红

            Button datebutton = GetChildObject <Button>(tableheadGrid, "datebutton1");
            datebutton.Foreground = redSB;
            dateButtonName        = datebutton.Name;

            Button timebutton = GetChildObject <Button>(timepointGrid, "timebutton10");
            timebutton.Foreground = redSB;
            timeButtonName        = timebutton.Name;

            temTextBox.IsReadOnly   = true;
            ThrobTextBox.IsReadOnly = true;

            #endregion

            #region 入院第一天

            TextBlock first = new TextBlock();
            first.TextWrapping = TextWrapping.Wrap;
            first.Width        = 13;
            first.Foreground   = redSB;
            first.Background   = new SolidColorBrush(Colors.White);
            first.Text         = "入院丨" + "五时十分";
            myCanvas.Children.Add(first);

            #endregion

            TemperatureSign ts = new TemperatureSign();

            #region 体温

            for (int i = 0; i < Temdt.Rows.Count; i++)
            {
                Grid       grid    = ts.GetTemX();
                int        noTem   = Convert.ToInt32(Temdt.Rows[i]["no"]);
                int        idTem   = Convert.ToInt32(Temdt.Rows[i]["id"]);
                int        timeTem = Convert.ToInt32(Temdt.Rows[i]["time"]);
                double     tem     = Convert.ToDouble(Temdt.Rows[i]["temperature"]);
                StackPanel sp      = new StackPanel();
                TextBlock  tb1     = new TextBlock();
                tb1.FontWeight = FontWeights.Heavy;
                tb1.Text       = "日期:" + DateTime.Today.AddDays(idTem + 1).ToShortDateString();
                TextBlock tb2 = new TextBlock();
                tb2.Text = "时间:" + timeTem.ToString();
                TextBlock tb3 = new TextBlock();
                tb3.Text = "体温:" + tem.ToString();
                tb3.Name = "temText";
                sp.Children.Add(tb1);
                sp.Children.Add(tb2);
                sp.Children.Add(tb3);
                string gridname = "temGrid" + (idTem + 1).ToString() + ((timeTem - 3) / 4).ToString();
                grid.Name        = gridname;
                grid.DataContext = noTem;
                grid.Tag         = tem;
                grid.ToolTip     = sp;
                myCanvas.Children.Add(grid);
                double leftTem = idTem * 85 + (timeTem - 3) / 4 * (85 / 6) + 2;
                double topTem  = (42 - tem) * 64 - (tem - 37);
                grid.SetValue(Canvas.LeftProperty, leftTem);
                grid.SetValue(Canvas.TopProperty, topTem);
                //XX偏移量是4
                if (i == 0)
                {
                    startpoint = new Point(leftTem + 4, topTem + 4);
                }
                else
                {
                    endpoint = new Point(leftTem + 4, topTem + 4);

                    PointNewPoint(startpoint, endpoint, "path" + gridname);

                    startpoint = endpoint;
                }
            }
            #endregion

            #region  搏
            for (int j = 0; j < Throbdt.Rows.Count; j++)
            {
                Ellipse    ellipse   = ts.GetEllipse();
                int        noThrob   = Convert.ToInt32(Throbdt.Rows[j]["no"]);
                int        idThrob   = Convert.ToInt32(Throbdt.Rows[j]["id"]);
                int        timeThrob = Convert.ToInt32(Throbdt.Rows[j]["time"]);
                int        throb     = Convert.ToInt32(Throbdt.Rows[j]["throb"]);
                StackPanel sp        = new StackPanel();
                TextBlock  tb1       = new TextBlock();
                tb1.FontWeight = FontWeights.Heavy;
                tb1.Text       = "日期:" + DateTime.Today.AddDays(idThrob + 1).ToShortDateString();
                TextBlock tb2 = new TextBlock();
                tb2.Text = "时间:" + timeThrob.ToString();
                TextBlock tb3 = new TextBlock();
                tb3.Text = "脉搏:" + throb.ToString();
                tb3.Name = "throbText";
                sp.Children.Add(tb1);
                sp.Children.Add(tb2);
                sp.Children.Add(tb3);
                string throbname = "throbEp" + (idThrob + 1).ToString() + ((timeThrob - 3) / 4).ToString();
                ellipse.Name                 = throbname;
                ellipse.DataContext          = noThrob;
                ellipse.MouseLeftButtonDown += Ellipse_MouseLeftButtonDown;
                ellipse.Tag     = throb;
                ellipse.ToolTip = sp;
                myCanvas.Children.Add(ellipse);
                double leftThrob = idThrob * 85 + (timeThrob - 3) / 4 * (85 / 6) + 2;
                double topThrob  = ((180 - throb) * 64 - (throb - 80)) / 20;
                ellipse.SetValue(Canvas.LeftProperty, leftThrob);
                ellipse.SetValue(Canvas.TopProperty, topThrob);

                if (j == 0)
                {
                    startpoint = new Point(leftThrob + 4, topThrob + 4);
                }
                else
                {
                    endpoint = new Point(leftThrob + 4, topThrob + 4);

                    PointNewPoint(startpoint, endpoint, "path" + throbname);

                    startpoint = endpoint;
                }
            }
            #endregion
        }