Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. drag and drop picture in richtextbox

drag and drop picture in richtextbox

Scheduled Pinned Locked Moved WPF
csharpquestiondatabasewpf
6 Posts 3 Posters 17 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    angels777
    wrote on last edited by
    #1

    how do i drag and drop a picture into richtextbox where i need to save that into the database sqlserver in wpf c# language?????.. also, how should i declare the the field in the datbase? thanks

    T 1 Reply Last reply
    0
    • A angels777

      how do i drag and drop a picture into richtextbox where i need to save that into the database sqlserver in wpf c# language?????.. also, how should i declare the the field in the datbase? thanks

      T Offline
      T Offline
      teejayem
      wrote on last edited by
      #2

      You need to hook the RichTextBox's Drop Event[^]. As far as the field in the database, if you are using sqlserver there is a datatype called 'image' that you can use. Here[^] is an example doing just that.

      Don't be overcome by evil, but overcome evil with good

      A 1 Reply Last reply
      0
      • T teejayem

        You need to hook the RichTextBox's Drop Event[^]. As far as the field in the database, if you are using sqlserver there is a datatype called 'image' that you can use. Here[^] is an example doing just that.

        Don't be overcome by evil, but overcome evil with good

        A Offline
        A Offline
        angels777
        wrote on last edited by
        #3

        hi.. thanks for reply.. but the link u provided is not i want.. the first link just provided me C# public event DragEventHandler Drop haha.. no more information.. also. i am doing this project in WPF i would like to know how do i drag in a picture or upload a picture into a RICHTEXTBOX where i am able to save the richtextbox's content into the database. just imagine writing a diary.. which got words and picture..after finish.. i save all into database. reallly thanks for the reply ..

        T 1 Reply Last reply
        0
        • A angels777

          hi.. thanks for reply.. but the link u provided is not i want.. the first link just provided me C# public event DragEventHandler Drop haha.. no more information.. also. i am doing this project in WPF i would like to know how do i drag in a picture or upload a picture into a RICHTEXTBOX where i am able to save the richtextbox's content into the database. just imagine writing a diary.. which got words and picture..after finish.. i save all into database. reallly thanks for the reply ..

          T Offline
          T Offline
          teejayem
          wrote on last edited by
          #4

          the first link that i provided was for the wpf richtextbox. I guess i need more information. Why do you want to use a richtextbox for this? why not a listbox or listview?

          Don't be overcome by evil, but overcome evil with good

          A 1 Reply Last reply
          0
          • T teejayem

            the first link that i provided was for the wpf richtextbox. I guess i need more information. Why do you want to use a richtextbox for this? why not a listbox or listview?

            Don't be overcome by evil, but overcome evil with good

            A Offline
            A Offline
            angels777
            wrote on last edited by
            #5

            hi.. thanks.. i found this link.. very useful.. hope it can help others as well.. http://blogs.vertigosoftware.com/alanl/archive/2006/11/30/4124.aspx?CommentPosted=true#commentmessage[^] however .. how do i save the pictures which is in wrappanel form into sql database? what i would like to do this to enable people to write diary.. as well as allow them to drag in the pictures into that wrap panel.. after they are done.. save into the database

            P 1 Reply Last reply
            0
            • A angels777

              hi.. thanks.. i found this link.. very useful.. hope it can help others as well.. http://blogs.vertigosoftware.com/alanl/archive/2006/11/30/4124.aspx?CommentPosted=true#commentmessage[^] however .. how do i save the pictures which is in wrappanel form into sql database? what i would like to do this to enable people to write diary.. as well as allow them to drag in the pictures into that wrap panel.. after they are done.. save into the database

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #6

              To save the RichTextBox, you could do this:

              myRichTextBox.SelectAll();
              
              using (MemoryStream ms = new MemoryStream())
              {
                myRichTextBox.Selection.Save(ms, DataFormats.Xaml);
                ms.Seek(0, SeekOrigin.Begin);
                using (StreamReader sr = new StreamReader(ms))
                {
                  string myXaml = sr.ReadToEnd();
                  SaveToDatabase(myXaml);
                }
              }
              

              Deja View - the feeling that you've seen this post before.

              My blog | My articles

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups