在RICHTEXTBOX中,存在图片及文字。用鼠标选择图片及文字后,如何将选中的图片保存为磁盘文件?如果要使用到Clipboard,应该如何写程序,请给出具体的例子,谢谢

解决方案 »

  1.   

    RichTextBox控件
      RichTextBox控件使用集合支持嵌入的对象。每个嵌入控件中的对象都表示为一个[1]对象。这允许文档中创建的控件可以包含其他控件或文档。例如,可以创建一个包含报表、Microsoft Word文档或任何在系统中注册的其他OLE对象的文档。要在RichTextBox控件中插入对象,可以简单地拖住一个文件(如使用Windows 95的Explorer)或其他应用程序(如Microsoft Word)中所用文件的加亮部分(选择部分),将其直接放到该RichTextBox控件上。   RichTextBox控件支持剪贴板和OLE对象的OLE拖放功能。当从剪贴板粘贴对象时,就在当前的插入点插入该对象。如果对象是拖放到控件中,则插入点将跟随鼠标指针位置变动,直到释放开鼠标,然后在鼠标释放处插入对象。   要打印RichTextBox控件中的所有或部分文本,使用SelPrint方法。因为RichTextBox控件是数据绑定控件,可以将其与Data控件绑定到Microsoft Access数据库的Binary或Memo数据域,或其他数据库中类似的数据域(如SQL Server中的TEXT数据类型的数据域)。   RichTextBox控件支持几乎所有的TextBox控件中的属性、事件和方法,如MaxLength, MultiLine, ScrollBars, SelLength, SelStart和SelText。使用TextBox控件的应用程序很容易改为使用RichTextBox控件。然而,RichTextBox控件并没有普通TextBox控件的64K字符能力的限制。
    编辑本段属性
      Appearance属性(ActiveX控件[2]),BackColor,ForeColor属性(ActiveX控件),BorderStyle属性(ActiveX控件),Enabled属性(ActiveX控件),HideSelection属性(ActiveX控件),MousePointer属性(ActiveX控件),OLEDragMode属性(ActiveX控件),OLEDropMode属性(ActiveX控件),SelLength, SelStart,SelText属性(ActiveX控件),Text属性(ActiveX控件),Height,Width属性(ActiveX控件),Index属性(ActiveX控件),Left, Top属性(ActiveX控件),Tag属性(ActiveX控件),Visible属性(ActiveX控件),Object属性(ActiveX控件),DisableNoScroll属性,SelHangingIndent, SelIndent, SelRightIndent属性,BulletIndent属性,SelAlignment属性,SelBold, SelItalic, SelStrikethru, SelUnderline属性,SelCharOffset属性,SelColor属性,SelFontName属性,SelFontSize属性,SelBullet属性,SelTabCount,SelTabs属性,SelRTF属性,RightMargin属性,AutoVerbMenu属性(RichTextBox控件),SelProtected属性,MaxLength属性(RichTextBox控件),MultiLine属性(RichTextBox控件),ScrollBars属性(RichTextBox控件),OLEObjects属性,DataChanged属性,DataField属性,FileName属性(RichTextBox控件),TextRTF属性,AutoVerbMenu属性(RichTextBox控件),Top属性,DataMember属性,DataFormat属性,DataBindings属性,TabIndex属性,DragIcon属性,DragMode属性,hWnd属性,Locked属性,Causes Validation属性,MouseIcon属性,TabStop属性,HelpContextID属性,Name属性,Parent属性,Font属性,Container属性,ToolTipText属性,DataSource属性,WhatsThisHelpID属性。
    编辑本段方法
      OLEDrag方法(ActiveX控件),Refresh方法(ActiveX控件),Find方法,GetLineFromChar方法,LoadFile方法,SaveFile方法,SelPrint方法,Span方法,Upto方法,SetFocus方法,Drag方法,Move方法,ZOrder方法,ShowWhatsThis方法。
    编辑本段事件
      SelChange事件,DragDrop事件,DragOver事件,GotFocus事件,KeyDown,KeyUp事件,KeyPress事件,LostFocus事件,MouseDown, MouseUp事件,MouseMove事件,Validate事件,OLECompleteDrag事件(ActiveX控件),OLEDragDrop事件(ActiveX控件),OLEDragOver事件(ActiveX控件),OLEGiveFeedback事件(ActiveX控件),OLESetData事件(ActiveX控件),OLEStartDrag事件(ActiveX控件),Change事件(ActiveX控件),Click事件(ActiveX控件),DblClick事件(ActiveX控件),KeyDown,KeyUp事件(ActiveX控件),KeyPress事件(ActiveX控件)。   ~~~~~~~~~   RichTextBox 事件   更新:2010 年 6 月(修正)   RichTextBox 类型公开以下成员。   事件   名称 说明 
    ContextMenuClosing 在控件上的任何上下文菜单关闭之前发生。 (继承自 FrameworkElement。) 
    ContextMenuOpening 在控件上的任何上下文菜单打开时发生。 (继承自 FrameworkElement。) 
    DataContextChanged 仅当此控件的数据上下文更改时才发生。 (继承自 FrameworkElement。) 
    DragEnter 在输入系统报告将此控件作为拖动目标的基础拖动事件时发生。 (继承自 UIElement。) 
    DragLeave 在输入系统报告将此控件作为拖动来源的基础拖动事件时发生。 (继承自 UIElement。) 
    DragOver 在输入系统报告将此控件作为潜在放置目标的基础拖动事件时发生。 (继承自 UIElement。) 
    Drop 在输入系统报告将此控件作为放置目标的基础放置事件时发生。 (继承自 UIElement。) 
    FocusableChanged 当 Focusable 属性的值更改时发生。 (继承自 UIElement。) 
    GiveFeedback 在输入系统报告涉及此控件的基础拖放事件时发生。 (继承自 UIElement。) 
    GotFocus 在此控件获得逻辑焦点时发生。 (继承自 UIElement。) 
    GotKeyboardFocus 在键盘焦点位于此控件上时发生。 (继承自 UIElement。) 
    GotMouseCapture 在此控件捕获鼠标时发生。 (继承自 UIElement。) 
    GotStylusCapture 在此控件捕获手写笔时发生。 (继承自 UIElement。) 
    Initialized 初始化此 FrameworkElement 时发生。此事件与 IsInitialized 属性的值从 false(或未定义)更改为 true 的情况相符。 (继承自 FrameworkElement。) 
    IsEnabledChanged 在此控件的 IsEnabled 属性值更改时发生。 (继承自 UIElement。) 
    IsHitTestVisibleChanged 在此控件的 IsHitTestVisible 依赖项属性值更改时发生。 (继承自 UIElement。) 
    IsKeyboardFocusedChanged 在此控件的 IsKeyboardFocused 属性值更改时发生。 (继承自 UIElement。) 
    IsKeyboardFocusWithinChanged 在此控件的 IsKeyboardFocusWithinChanged 属性值更改时发生。 (继承自 UIElement。) 
    IsMouseCapturedChanged 在此控件的 IsMouseCaptured 属性值更改时发生。 (继承自 UIElement。) 
    IsMouseCaptureWithinChanged 在此控件的 IsMouseCaptureWithinProperty 值更改时发生。 (继承自 UIElement。) 
    IsMouseDirectlyOverChanged 在此控件的 IsMouseDirectlyOver 属性值更改时发生。 (继承自 UIElement。) 
    IsStylusCapturedChanged 在此控件的 IsStylusCaptured 属性值更改时发生。 (继承自 UIElement。) 
    IsStylusCaptureWithinChanged 在此控件的 IsStylusCaptureWithin 属性值更改时发生。 (继承自 UIElement。) 
    IsStylusDirectlyOverChanged 在此控件的 IsStylusDirectlyOver 属性值更改时发生。 (继承自 UIElement。) 
    IsVisibleChanged 在此控件的 IsVisible 属性值更改时发生。 (继承自 UIElement。) 
    KeyDown 在焦点位于此控件上并且用户按下键时发生。 (继承自 UIElement。) 
    KeyUp 在焦点位于此控件上并且用户释放键时发生。 (继承自 UIElement。) 
    LayoutUpdated 在与当前 Dispatcher 关联的各种可视控件的布局更改时发生。 (继承自 UIElement。) 
    Loaded 在控件已布局、已呈现且可用于交互时发生。 (继承自 FrameworkElement。) 
    LostFocus 在此控件失去逻辑焦点时发生。 (继承自 UIElement。) 
    LostKeyboardFocus 在键盘焦点不再位于此控件上时发生。 (继承自 UIElement。) 
    LostMouseCapture 在此控件失去鼠标捕获时发生。 (继承自 UIElement。) 
    LostStylusCapture 在此控件失去手写笔捕获时发生。 (继承自 UIElement。) 
    MouseDoubleClick 当单击鼠标按钮两次或更多次时发生。 (继承自 Control。) 
    MouseDown 在指针悬停于此控件上并且用户按下任意鼠标按钮时发生。 (继承自 UIElement。) 
    MouseEnter 在鼠标指针进入此控件的边界时发生。 (继承自 UIElement。) 
    MouseLeave 在鼠标指针离开此控件的边界时发生。 (继承自 UIElement。) 
    MouseLeftButtonDown 在鼠标指针悬停于此控件上并且用户按下鼠标左键时发生。 (继承自 UIElement。) 
    MouseLeftButtonUp 在鼠标指针悬停于此控件上并且用户释放鼠标左键时发生。 (继承自 UIElement。) 
    MouseMove 在鼠标指针悬停于此控件上并且用户移动该鼠标指针时发生。 (继承自 UIElement。) 
    MouseRightButtonDown 在鼠标指针悬停于此控件上并且用户按下鼠标右键时发生。 (继承自 UIElement。) 
    MouseRightButtonUp 在鼠标指针悬停于此控件上并且用户释放鼠标右键时发生。 (继承自 UIElement。) 
    MouseUp 在用户在此控件上释放任意鼠标按钮时发生。 (继承自 UIElement。) 
    MouseWheel 在鼠标指针悬停于此控件上并且用户滚动鼠标滚轮时发生。 (继承自 UIElement。) 
    PreviewDragEnter 在输入系统报告将此控件作为拖动目标的基础拖动事件时发生。 (继承自 UIElement。) 
    PreviewDragLeave 在输入系统报告将此控件作为拖动来源的基础拖动事件时发生。 (继承自 UIElement。) 
    PreviewDragOver 在输入系统报告将此控件作为潜在放置目标的基础拖动事件时发生。 (继承自 UIElement。) 
    PreviewDrop 在输入系统报告将此控件作为放置目标的基础放置事件时发生。 (继承自 UIElement。) 
    PreviewGiveFeedback 在开始拖放操作时发生。 (继承自 UIElement。) 
    PreviewGotKeyboardFocus 在键盘焦点位于此控件上时发生。 (继承自 UIElement。) 
    PreviewKeyDown 在焦点位于此控件上并且用户按下键时发生。 (继承自 UIElement。) 
    PreviewKeyUp 在焦点位于此控件上并且用户释放键时发生。 (继承自 UIElement。) 
    PreviewLostKeyboardFocus 在键盘焦点不再位于此控件上时发生。 (继承自 UIElement。) 
    PreviewMouseDoubleClick 当用户单击鼠标按钮两次或更多次时发生。 (继承自 Control。) 
    PreviewMouseDown 在指针悬停于此控件上并且用户按下任意鼠标按钮时发生。 (继承自 UIElement。) 
    PreviewMouseLeftButtonDown 在鼠标指针悬停于此控件上并且用户按下鼠标左键时发生。 (继承自 UIElement。) 
    PreviewMouseLeftButtonUp 在鼠标指针悬停于此控件上并且用户释放鼠标左键时发生。 (继承自 UIElement。) 
    PreviewMouseMove 在鼠标指针悬停于此控件上并且用户移动该鼠标指针时发生。 (继承自 UIElement。) 
    PreviewMouseRightButtonDown 在鼠标指针悬停于此控件上并且用户按下鼠标右键时发生。 (继承自 UIElement。) 
    PreviewMouseRightButtonUp 在鼠标指针悬停于此控件上并且用户释放鼠标右键时发生。 (继承自 UIElement。) 
    PreviewMouseUp 在鼠标指针悬停于此控件上并且用户释放任意鼠标按钮时发生。 (继承自 UIElement。) 
    PreviewMouseWheel 在鼠标指针悬停于此控件上并且用户滚动鼠标滚轮时发生。 (继承自 UIElement。) 
    PreviewQueryContinueDrag 在拖放操作过程中键盘或鼠标按钮的状态发生变化时发生。 (继承自 UIElement。) 
    PreviewStylusButtonDown 在指针悬停于此控件上并且用户按下手写笔按钮时发生。 (继承自 UIElement。) 
    PreviewStylusButtonUp 在指针悬停于此控件上并且用户释放手写笔按钮时发生。 (继承自 UIElement。) 
    PreviewStylusDown 在手写笔悬停于此控件上并接触数字化仪时发生。 (继承自 UIElement。) 
    PreviewStylusInAirMove 在手写笔掠过控件但并未实际接触数字化仪时发生。 (继承自 UIElement。) 
    PreviewStylusInRange 在手写笔悬停于此控件上方并位于数字化仪的检测范围之内时发生。 (继承自 UIElement。) 
    PreviewStylusMove 在手写笔掠过控件时发生。若要引发此事件,在数字化仪检测到手写笔时必须移动手写笔;否则,将改为引发 PreviewStylusInAirMove。 (继承自 UIElement。) 
    PreviewStylusOutOfRange 当手写笔距离要检测的数字化仪过远时发生。 (继承自 UIElement。) 
    PreviewStylusSystemGesture 在用户执行若干手写笔笔势之一时发生。 (继承自 UIElement。) 
    PreviewStylusUp 在用户将悬停于此控件上的手写笔从数字化仪上移开时发生。 (继承自 UIElement。) 
    PreviewTextInput 在此控件以与设备无关的方式获取文本时发生。 (继承自 UIElement。) 
    QueryContinueDrag 在拖放操作过程中键盘或鼠标按钮的状态发生变化时发生。 (继承自 UIElement。) 
    QueryCursor 在请求显示光标时发生。每次鼠标指针移至新位置时都会在一个控件上引发此事件,这意味着光标对象可能需要根据其新位置进行更改。 (继承自 UIElement。) 
    RequestBringIntoView 当在此控件上调用 BringIntoView 时发生。 (继承自 FrameworkElement。) 
    SelectionChanged 在文本选定内容更改后发生。 (继承自 TextBoxBase。) 
    SizeChanged 当此控件上的 ActualHeight 或 ActualWidth 属性的值发生更改时发生。 (继承自 FrameworkElement。) 
    SourceUpdated 当此控件上的任何现有属性绑定的源值发生更改时发生。 (继承自 FrameworkElement。) 
    StylusButtonDown 在指针悬停于此控件上并且用户按下手写笔按钮时发生。 (继承自 UIElement。) 
    StylusButtonUp 在指针悬停于此控件上并且用户释放手写笔按钮时发生。 (继承自 UIElement。) 
    StylusDown 在手写笔悬停于此控件上并接触数字化仪时发生。 (继承自 UIElement。) 
    StylusEnter 在手写笔进入此控件的边界时发生。 (继承自 UIElement。) 
    StylusInAirMove 在手写笔掠过控件但并未实际接触数字化仪时发生。 (继承自 UIElement。) 
    StylusInRange 在手写笔悬停于此控件上方并位于数字化仪的检测范围之内时发生。 (继承自 UIElement。) 
    StylusLeave 在手写笔离开此控件的边界时发生。 (继承自 UIElement。) 
    StylusMove 在手写笔掠过此控件时发生。若要引发此事件,手写笔位于数字化仪上时必须移动。否则,将改为引发 StylusInAirMove。 (继承自 UIElement。) 
    StylusOutOfRange 在手写笔悬停于此控件上方并位于数字化仪的检测范围之外时发生。 (继承自 UIElement。) 
    StylusSystemGesture 在用户执行若干手写笔笔势之一时发生。 (继承自 UIElement。) 
    StylusUp 在用户将悬停于此控件上的手写笔从数字化仪上移开时发生。 (继承自 UIElement。) 
    TargetUpdated 当此控件上的任何属性绑定的目标值发生更改时发生。 (继承自 FrameworkElement。) 
    TextChanged 在文本控件中的内容更改时发生。 (继承自 TextBoxBase。) 
    TextInput 在此控件以与设备无关的方式获取文本时发生。 (继承自 UIElement。) 
    ToolTipClosing 在控件上的任何工具提示关闭之前发生。 (继承自 FrameworkElement。) 
    ToolTipOpening 当控件上的任意工具提示打开时发生。 (继承自 FrameworkElement。) 
    Unloaded 当从加载的控件的元素树中移除元素时发生。 (继承自 FrameworkElement。) 
    页首   另请参见   参考RichTextBox 类   System.Windows.Controls 命名空间
      

  2.   

    1, 选择颜色
    颜色面板用WrapPanel最合适不过了,只要按规律把R,G,B(红绿蓝)不用组合全部塞入到Panel里就好了。
    <UserControl xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"  x:Class="Vega.Controls.ColorControl"    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"    xmlns:mc="http://schemas.openxmlformats.org/up-compatibility/2006"    mc:Ignorable="d"    d:DesignHeight="240" d:DesignWidth="360">    <toolkit:WrapPanel x:Name="panel" Width="360" /></UserControl>
    public partial class ColorControl : UserControl    {        public EventHandler SelectColor;        public ColorControl()        {            InitializeComponent();            int granularity = 51;            for (int r = 0; r <= 255; r += granularity)            {                for (int g = 0; g <= 255; g += granularity)                {                    for (int b = 0; b <= 255; b += granularity)                    {                        var rectangle =new Rectangle                        {                            Width = 20,                            Height = 20,                            Cursor = Cursors.Hand,                            Fill = new SolidColorBrush(Color.FromArgb(255, (byte)r, (byte)g, (byte)b))                        };                        rectangle.MouseLeftButtonUp += new MouseButtonEventHandler(rectangle_MouseLeftButtonUp);                        this.panel.Children.Add(rectangle);                    }                }            }        }        private void rectangle_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)        {            this.Visibility = System.Windows.Visibility.Collapsed;            if (this.SelectColor != null)            {                this.SelectColor(sender, e);            }        }    }
      

  3.   

    添加图片:
      public string Source        {            get { return (string)GetValue(SourceProperty); }            set { SetValue(SourceProperty, value); }        }        public int ImageWidth        {            get { return (int)GetValue(ImageWidthProperty); }            set { SetValue(ImageWidthProperty, value); }        }        public int ImageHeight        {            get { return (int)GetValue(ImageHeightProperty); }            set { SetValue(ImageHeightProperty, value); }        }        public static readonly DependencyProperty SourceProperty =            DependencyProperty.Register("Source", typeof(string), typeof(ImageAttributeWindow), new PropertyMetadata("http://"));        public static readonly DependencyProperty ImageWidthProperty =            DependencyProperty.Register("ImageWidth", typeof(int), typeof(ImageAttributeWindow), new PropertyMetadata(100));        public static readonly DependencyProperty ImageHeightProperty =            DependencyProperty.Register("ImageHeight", typeof(int), typeof(ImageAttributeWindow), new PropertyMetadata(100));
    窗口布局:
    <controls:ChildWindow xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"  x:Class="Vega.Controls.ImageAttributeWindow"           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"            xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"           Width="504" Height="178"            Title="图片属性" Name="imageAttributeWindow">    <toolkit:BusyIndicator x:Name="busyIndicator">        <Grid x:Name="LayoutRoot" Margin="2">            <Grid.RowDefinitions>                <RowDefinition Height="10" />                <RowDefinition Height="*" />                <RowDefinition Height="40" />            </Grid.RowDefinitions>            <Grid Grid.Row="1" Name="grid1">                <Grid.RowDefinitions>                    <RowDefinition Height="25" />                    <RowDefinition Height="25" />                    <RowDefinition Height="25" />                </Grid.RowDefinitions>                <Grid.ColumnDefinitions>                    <ColumnDefinition Width="50" />                    <ColumnDefinition Width="*" />                </Grid.ColumnDefinitions>                <TextBlock HorizontalAlignment="Right" Text="源地址:" VerticalAlignment="Center" />                <TextBlock HorizontalAlignment="Right" Text="宽度:" VerticalAlignment="Center" Grid.Row="1" />                <TextBlock HorizontalAlignment="Right" Text="宽度:" VerticalAlignment="Center" Grid.Row="2" />                <TextBox Grid.Column="1" Margin="2,2,60,2" Text="{Binding Path=Source, Mode=TwoWay, ElementName=imageAttributeWindow}" />                <Button Content="上传" Width="50" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="2" Name="uploadButton" Click="uploadButton_Click" />                <toolkit:NumericUpDown HorizontalAlignment="Left" Grid.Column="1" Grid.Row="1" Margin="2,2,0,0" Value="{Binding Path=ImageWidth, Mode=TwoWay, ElementName=imageAttributeWindow}" Maximum="1000" Height="22" VerticalAlignment="Top" />                <toolkit:NumericUpDown HorizontalAlignment="Left" Grid.Column="1" Grid.Row="2" Margin="2" Value="{Binding Path=ImageHeight, Mode=TwoWay, ElementName=imageAttributeWindow}" Maximum="1000" />            </Grid>            <Button x:Name="CancelButton" Content="取消" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="2" />            <Button x:Name="OKButton" Content="确定" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" Grid.Row="2" />        </Grid>    </toolkit:BusyIndicator></controls:ChildWindow>
    上传图片: private void uploadButton_Click(object sender, RoutedEventArgs e)        {            var fileDialog = new OpenFileDialog()            {                Filter = "图片(.jpg)|*.jpg|图片(.jpeg)|*.jpeg|图片(.png)|*.png",                Multiselect = false            };            var result = fileDialog.ShowDialog();            if (result.HasValue && result.Value)            {                using (var stream = fileDialog.File.OpenRead())                {                    var imgSource = new BitmapImage();                    imgSource.SetSource(stream);                    var bitmap = new WriteableBitmap(imgSource);                    this.ImageWidth = bitmap.PixelWidth;                    this.ImageHeight = bitmap.PixelHeight;                    stream.Seek(0, SeekOrigin.Begin);                    var bytes = new byte[stream.Length];                    stream.Read(bytes, 0, bytes.Length);                    this.busyIndicator.IsBusy = true;                    var op = this.uploadContext.Upload(bytes, fileDialog.File.Extension);                    op.Completed += (opSender, opE) => {                        var source = Application.Current.Host.Source;                        this.Source = String.Format("{0}://{1}:{2}{3}", source.Scheme, source.Host, source.Port, op.Value);                        this.busyIndicator.IsBusy = false;                    };                }            }        }silvelight 客户端有加上通过WriteableBitmap读取宽度和高度方法,读取到长和宽之后记得归位stream.Seek(0, SeekOrigin.Begin);不然stream.Read不到,因为指针已经到尾部了。
    调用调用图片的窗口:
    private void imageButton_Click(object sender, RoutedEventArgs e)        {            var window = new ImageAttributeWindow();            window.Closed += (senderObj, ea) =>             {                if (!window.DialogResult.HasValue || !window.DialogResult.Value)                {                    return;                }                InlineUIContainer container = new InlineUIContainer();                container.Child = new Image()                {                    Stretch = Stretch.Uniform,                    Width = window.ImageWidth,                    Height = window.ImageHeight,                    Source = new BitmapImage(new Uri(window.Source,UriKind.Absolute))                };                this.richTextBox.Selection.Insert(container);            };            window.Show();        }最后  I'm OK
      

  4.   

    用Clipboard.GetFormat() 方法判断剪贴板中内容的类型.然后分别处理.
      

  5.   

    再放一个RTF控件
    richtextbox2.text=""
    richtextbox2.textrtf=richtextbox1.selrtf
    richtextbox2.save .....
      

  6.   


    想到过用Clipboard,但是具体如何处理,请给出例子,谢谢
      

  7.   


    请详细说明richtextbox2.save...
      

  8.   

    本帖最后由 bcrun 于 2010-10-29 10:08:52 编辑
      

  9.   


    将控件的内容保存到别的控件,比如PictureBox,如何保存,请给一个解决办法。谢谢
      

  10.   

    问题已经解决,为了感谢参加的朋友,现将思路贴上来:1、将选中部分放到另外一个RTB中,去除文字;
    2、获取这个RTB的DC;
    3、用BitBlt将RTB的DC中的图片,画到PICTUREBOX控件中;
    4、保存PICTUREBOX控件中的图片
      

  11.   

    bitblt应该是获取可见部分吧,如果图片特别大,还可以吗?
      

  12.   

    save是控件本身自带的方法啊,后面是文件名和类型二个参数.
    我懒得写.
      

  13.   


    是的,只能获取RICHTEXTBOX的可见部分,图片特别大,不行。问题只能说解决了一部分。
      

  14.   

    我问的是VB6中的RICHTEXTBOX,没有这个方法呀。有一个SaveFile方法,不过这个方法好像不管用。