예제 #1
0
파일: VGText.cs 프로젝트: zhjh-stack/ogama
 /// <summary>
 /// Initializes a new instance of the VGText class.
 /// Clone Constructor. Creates new text that is
 /// identical to the given <see cref="VGText"/>.
 /// </summary>
 /// <param name="cloneText">Text element to clone.</param>
 private VGText(VGText cloneText)
     : base(
         cloneText.ShapeDrawAction,
         cloneText.Pen,
         cloneText.Brush,
         cloneText.Font,
         cloneText.FontColor,
         cloneText.Bounds,
         cloneText.StyleGroup,
         cloneText.Name,
         cloneText.ElementGroup,
         cloneText.Sound)
 {
     this.textFontColor = cloneText.TextFontColor;
     this.text          = cloneText.StringToDraw;
     this.textAlignment = cloneText.Alignment;
     this.textFont      = cloneText.TextFont == null ? this.Font : (Font)cloneText.TextFont.Clone();
     this.LineSpacing   = cloneText.LineSpacing != 0 ? cloneText.LineSpacing : 1.0f;
     this.Padding       = cloneText.Padding;
 }
예제 #2
0
    /// <summary>
    ///   This method creates the initialization trial.
    /// </summary>
    private void InitializeFirstTrial()
    {
      var coll = new StopConditionCollection();
      var stc = new TimeStopCondition(5000);
      coll.Add(stc);

      this.preparedSlideOne.Slide = new Slide(
        "OgamaDummyStartTrial6gsj2",
        Color.Gray,
        Images.CreateRecordInstructionImage(
          Document.ActiveDocument.ExperimentSettings.WidthStimulusScreen,
          Document.ActiveDocument.ExperimentSettings.HeightStimulusScreen),
        coll,
        new StopConditionCollection(),
        string.Empty,
        Document.ActiveDocument.PresentationSize);
      var wait = new VGText(
        ShapeDrawAction.None,
        "Initializing ...",
        new Font("Verdana", 40f),
        Color.WhiteSmoke,
        HorizontalAlignment.Center,
        1,
        6,
        Pens.Red,
        Brushes.Red,
        SystemFonts.MenuFont,
        Color.Black,
        new RectangleF(100, 100, 400, 200),
        VGStyleGroup.None,
        "Text",
        string.Empty,
        null);
      this.preparedSlideOne.Slide.VGStimuli.Add(wait);

      // Reset the cursor position to initial location if applicable
      var newPoint = new Point(
        this.presentationBounds.Left + this.presentationBounds.Width / 2,
        this.presentationBounds.Top + this.presentationBounds.Height / 2);
      Cursor.Position = newPoint;

      Cursor.Hide();
      this.hiddenCursor = true;

      // Prepare preparation slide 
      this.preparedSlideOne.Trial = new Trial("DummyTrial", -1);
      this.preparedSlideOne.Trial.Add(this.preparedSlideOne.Slide);
      this.preparedSlideOne.Timer.Period = 2000;
      this.preparedSlideOne.Timer.Mode = TimerMode.OneShot;
      this.preparedSlideOne.Timer.SynchronizingObject = this;
      this.preparedSlideOne.Timer.Tick += this.TimerTick;

      this.DrawToBuffer(this.preparedSlideOne);
      this.PresentPreparedSlide();

      // Prepare first slide of trial list
      this.preparedSlideTwo.Trial = this.trials[0];
      this.preparedSlideTwo.Slide = this.trials[0][0];
      this.preparedSlideTwo.Timer.Period = 200;
      this.preparedSlideTwo.Timer.Mode = TimerMode.OneShot;
      this.preparedSlideTwo.Timer.SynchronizingObject = this;
      this.preparedSlideTwo.Timer.Tick += this.TimerTick;
      this.InitializeNextSlide(this.preparedSlideTwo);
      this.DrawToBuffer(this.preparedSlideTwo);
      this.PrepareScreenCapture(-1);
    }
예제 #3
0
파일: VGText.cs 프로젝트: DeSciL/Ogama
 /// <summary>
 /// Initializes a new instance of the VGText class.
 /// Clone Constructor. Creates new text that is
 /// identical to the given <see cref="VGText"/>.
 /// </summary>
 /// <param name="cloneText">Text element to clone.</param>
 private VGText(VGText cloneText)
   : base(
   cloneText.ShapeDrawAction,
   cloneText.Pen,
   cloneText.Brush,
   cloneText.Font,
   cloneText.FontColor,
   cloneText.Bounds,
   cloneText.StyleGroup,
   cloneText.Name,
   cloneText.ElementGroup,
   cloneText.Sound)
 {
   this.textFontColor = cloneText.TextFontColor;
   this.text = cloneText.StringToDraw;
   this.textAlignment = cloneText.Alignment;
   this.textFont = cloneText.TextFont == null ? this.Font : (Font)cloneText.TextFont.Clone();
   this.LineSpacing = cloneText.LineSpacing != 0 ? cloneText.LineSpacing : 1.0f;
   this.Padding = cloneText.Padding;
 }
예제 #4
0
    /// <summary>
    /// Starts new textual shape by setting the <see cref="VGText"/>
    /// in the <see cref="newShape"/> field.
    /// Then calls <see cref="StartCreation(Cursor)"/>.
    /// </summary>
    /// <param name="text">The <see cref="VGText"/> to be added to the <see cref="Picture"/></param>
    public void NewTextStart(VGText text)
    {
      Point position = this.Location;
      position.Offset(
        (int)((this.Width / 2) - (text.Size.Width / 2)),
        (int)((this.Height / 2) - (text.Size.Height / 2)));
      text.Location = position;
      this.newShape = text;

      this.StartCreation(CustomCursors.Text);
    }