Click here to Skip to main content
15,915,336 members
Home / Discussions / C#
   

C#

 
GeneralAsynchronous Network Transfer Pin
sibish n b24-Mar-04 22:04
sibish n b24-Mar-04 22:04 
GeneralGenerate a Diagram from a Database, algorithms, approaches, tips... Pin
Braulio Dez24-Mar-04 21:12
Braulio Dez24-Mar-04 21:12 
Generalc# forms Pin
DougW4824-Mar-04 18:56
DougW4824-Mar-04 18:56 
GeneralRe: c# forms Pin
Heath Stewart24-Mar-04 20:16
protectorHeath Stewart24-Mar-04 20:16 
GeneralRe: c# forms Pin
DougW4825-Mar-04 0:02
DougW4825-Mar-04 0:02 
GeneralRe: c# forms Pin
Heath Stewart25-Mar-04 3:56
protectorHeath Stewart25-Mar-04 3:56 
GeneralRich Text Box (Visual c#.net) Pin
naresh_pandey1324-Mar-04 18:53
naresh_pandey1324-Mar-04 18:53 
GeneralRe: Rich Text Box (Visual c#.net) Pin
OmegaSupreme25-Mar-04 5:24
OmegaSupreme25-Mar-04 5:24 
You need to find the images :

Regex r = new Regex("<[^>]*\\n?.*=(\"|')?(?<imog>.*\\.jpg)(\"|')?.*?\\n?[^<]*>");	
MatchCollection Matches = r.Matches(rtb.Text);


and then replace them with an image

foreach (Match m in Matches)
{
	string imageName = m.Groups["imog"].Value;
	Image img = Image.FromFile(imageName);
	rtb.SelectionStart = m.Index;
   	rtb.SelectionLength = m.Length;
	Clipboard.SetDataObject(img);
    	rtb.Paste();
}


Warning though this code does not work properly. Problem one is the regular expression which I found off the web doesn't handle img tags very well.

Problem two is find the SelectionStart once you've started replacing the text.

I know this sucks but i thought it would give you a start.

HTH

Circumstances have overtaken man. His old languages are not sufficient to describe what is happening, and what is about to happen. To think in terms of a millennium or such tame concepts as the 'eleventh hour' is ridiculous.

Better that he should realize that he is in an era which might be accurately described as the 'eighth
day of the week'.
Idries Shah
GeneralRe: Rich Text Box (Visual c#.net) Pin
naresh_pandey1326-Mar-04 1:59
naresh_pandey1326-Mar-04 1:59 
GeneralRich Text Box Pin
naresh_pandey1324-Mar-04 18:51
naresh_pandey1324-Mar-04 18:51 
GeneralSmart Build Pin
blackthunder00124-Mar-04 18:09
blackthunder00124-Mar-04 18:09 
GeneralRe: Smart Build Pin
Heath Stewart24-Mar-04 20:11
protectorHeath Stewart24-Mar-04 20:11 
GeneralRe: Smart Build Pin
blackthunder00124-Mar-04 23:42
blackthunder00124-Mar-04 23:42 
GeneralRe: Smart Build Pin
Heath Stewart25-Mar-04 4:02
protectorHeath Stewart25-Mar-04 4:02 
GeneralDataGrid Control Question Pin
DougW4824-Mar-04 16:54
DougW4824-Mar-04 16:54 
GeneralRe: DataGrid Control Question Pin
ian mariano24-Mar-04 17:28
ian mariano24-Mar-04 17:28 
GeneralRe: DataGrid Control Question Pin
Heath Stewart24-Mar-04 17:31
protectorHeath Stewart24-Mar-04 17:31 
Questiongetting mouse position? Pin
azusakt24-Mar-04 16:29
azusakt24-Mar-04 16:29 
AnswerRe: getting mouse position? Pin
Heath Stewart24-Mar-04 17:24
protectorHeath Stewart24-Mar-04 17:24 
QuestionHow can I save an icon? Pin
Flack24-Mar-04 14:40
Flack24-Mar-04 14:40 
AnswerRe: How can I save an icon? Pin
Heath Stewart24-Mar-04 17:21
protectorHeath Stewart24-Mar-04 17:21 
GeneralCapturing ListView scrollbar events Pin
chuck05324-Mar-04 10:45
chuck05324-Mar-04 10:45 
GeneralRe: Capturing ListView scrollbar events Pin
Heath Stewart24-Mar-04 11:24
protectorHeath Stewart24-Mar-04 11:24 
GeneralTray Icon Pin
RickZ24-Mar-04 10:34
RickZ24-Mar-04 10:34 
GeneralRe: Tray Icon Pin
Dave Kreskowiak24-Mar-04 11:08
mveDave Kreskowiak24-Mar-04 11:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.