如何移动属于richTextBox的horizo​​ntalScrollBar [英] How to move a horizontalScrollBar which belong to a richTextBox

查看:62
本文介绍了如何移动属于richTextBox的horizo​​ntalScrollBar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个HcrollBars,其中一个连接到Form1.我可以将hScrollBar1移到中间位置(50),没有任何问题.另一个Horizo​​ntalScrollBar附加到richTextBox1的底部,但是我无法以编程方式移动它.

请帮帮我.

I have two HcrollBars ow which one is attached to Form1. I can move the hScrollBar1 to the midway position (50) without any problem. The other HorizontalScrollBar is attached to the bottom of richTextBox1, but I could not move it programatically.

Please help me.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            pp();
        }

        private void pp()
        {
            hScrollBar1.Value = 50;//<--- No Error

            // Property WordWrap is False for the next HScroll
            this.richTextBox1.HScrollBar.Value = 50;// <--- Error
            richTextBox1.HScroll.Value = 50;//<- Error Value not 
      //member 
        }

    }
}

推荐答案

我很困惑:没有这样的属性:System.Windows.Forms.RichTextBox.HScrollBar!
您可能混淆了一些东西.即使不给它赋值,也无法编译.

—SA
更新:
[SM]:只需添加指向RichTextBox类的所有可用属性的链接: MSDN: RichTextBox类 [ ^ ]

桑迪普(Sandeep),如果我疯了,您是否确定不存在此类财产? :-)
没有这样的属性,对吗?

—SA
I''m puzzled: there is not such property: System.Windows.Forms.RichTextBox.HScrollBar!!
You probably mixed up something. You could would not compile even if you don''t assign it a value.

—SA
UPDATE:
[SM]: Just adding a link to all available properties for RichTextBox class: MSDN: RichTextBox Class[^]

Sandeep, do you confirm that there is no such property, in case I''ve gone crasy? :-)
There is not such property, correct?

—SA


这篇关于如何移动属于richTextBox的horizo​​ntalScrollBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆