示例#1
0
        public D2DRender(FooTextBox textbox, double width, double height, Image image)
        {
            this.fontFamily        = textbox.FontFamily;
            this.fontSize          = textbox.FontSize;
            this.fontWeigth        = textbox.FontWeight;
            this.fontStyle         = textbox.FontStyle;
            this.Foreground        = ToColor4(textbox.Foreground);
            this.Background        = ToColor4(textbox.Background);
            this.ControlChar       = ToColor4(textbox.ControlChar);
            this.Hilight           = ToColor4(textbox.Hilight);
            this.Comment           = ToColor4(textbox.Comment);
            this.Url               = ToColor4(textbox.URL);
            this.Keyword1          = ToColor4(textbox.Keyword1);
            this.Keyword2          = ToColor4(textbox.Keyword2);
            this.Literal           = ToColor4(textbox.Literal);
            this.InsertCaret       = ToColor4(textbox.InsertCaret);
            this.OverwriteCaret    = ToColor4(textbox.OverwriteCaret);
            this.LineMarker        = ToColor4(textbox.LineMarker);
            this.UpdateArea        = ToColor4(textbox.UpdateArea);
            this.LineNumber        = ToColor4(textbox.LineNumber);
            this.HilightForeground = ToColor4(textbox.HilightForeground);
            this.store             = textbox.TextStore;

            this.CreateDevice();

            this.ConstructRenderAndResource(width, height);
            this.InitTextFormat(this.fontFamily.Source, (float)this.fontSize, this.GetDWFontWeigth(this.fontWeigth), this.GetDWFontStyle(this.fontStyle));

            this.imageSource = new D3DImage();
            this.imageSource.Lock();
            this.imageSource.SetBackBuffer(D3DResourceType.IDirect3DSurface9, this.surface9.NativePointer);  //設定しないとロード時に例外が発生する
            this.imageSource.Unlock();

            image.Source = this.imageSource;
        }
示例#2
0
 public FooTextBoxRangeProvider(FooTextBox textbox, int start, int length, FooTextBoxAutomationPeer peer)
 {
     this.textbox = textbox;
     this.start   = start;
     this.end     = start + length;
     _peer        = peer;
 }
        internal bool ProcessKeyDown(FooTextBox textbox, KeyEventArgs e, bool isCtrl, bool isShift)
        {
            if (this.popup.IsOpen == false)
            {
                if (e.Key == Key.Space && isCtrl)
                {
                    this.OpenCompleteBox(string.Empty);
                    e.Handled = true;

                    return(true);
                }
                return(false);
            }

            switch (e.Key)
            {
            case Key.Escape:
                this.RequestCloseCompleteBox();
                textbox.Focus();
                e.Handled = true;
                return(true);

            case Key.Down:
                if (this.listBox1.SelectedIndex + 1 >= this.listBox1.Items.Count)
                {
                    this.listBox1.SelectedIndex = this.listBox1.Items.Count - 1;
                }
                else
                {
                    this.listBox1.SelectedIndex++;
                }
                this.listBox1.ScrollIntoView(this.listBox1.SelectedItem);
                e.Handled = true;
                return(true);

            case Key.Up:
                if (this.listBox1.SelectedIndex - 1 < 0)
                {
                    this.listBox1.SelectedIndex = 0;
                }
                else
                {
                    this.listBox1.SelectedIndex--;
                }
                this.listBox1.ScrollIntoView(this.listBox1.SelectedItem);
                e.Handled = true;
                return(true);

            case Key.Tab:
            case Key.Enter:
                this.RequestCloseCompleteBox();
                CompleteWord selWord = (CompleteWord)this.listBox1.SelectedItem;
                this.SelectItem(this, new SelectItemEventArgs(selWord, this.inputedWord, this.Document));
                e.Handled = true;
                return(true);
            }

            return(false);
        }
示例#4
0
        public WPFRender(FooTextBox textbox, double width, double height, FrameworkElement image)
        {
            this.ChangedRenderResource += (s, e) => { };
            this.ChangedRightToLeft    += (s, e) => { };

            this.FontFamily          = textbox.FontFamily;
            this.FontSize            = textbox.FontSize;
            this.ForegroundColor     = textbox.Foreground;
            this.BackgroundColor     = textbox.Background;
            this.ControlCharColor    = textbox.ControlChar;
            this.HilightColor        = textbox.Hilight;
            this.CommentColor        = textbox.Comment;
            this.UrlColor            = textbox.URL;
            this.Keyword1Color       = textbox.Keyword1;
            this.Keyword2Color       = textbox.Keyword2;
            this.LiteralColor        = textbox.Literal;
            this.InsertCaretColor    = textbox.InsertCaret;
            this.OverwriteCaretColor = textbox.OverwriteCaret;
            this.LineMarkerColor     = textbox.LineMarker;

            this.host = (VisualHost)image;
        }
示例#5
0
 public FooTextBoxRangeProvider(FooTextBox textbox, FooTextBoxAutomationPeer peer)
     : this(textbox, 0, textbox.Document.Length, peer)
 {
 }
示例#6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="owner"></param>
 public FooTextBoxAutomationPeer(FooTextBox owner)
     : base(owner)
 {
     this.fooTextBox = owner;
 }