Click here to Skip to main content
15,912,069 members
Home / Discussions / C#
   

C#

 
GeneralRe: The Objective / Solution Pin
Heath Stewart16-Dec-03 5:04
protectorHeath Stewart16-Dec-03 5:04 
GeneralRe: The Objective / Solution Pin
Tristan Rhodes16-Dec-03 5:27
Tristan Rhodes16-Dec-03 5:27 
GeneralRe: The Objective / Solution Pin
Heath Stewart16-Dec-03 5:29
protectorHeath Stewart16-Dec-03 5:29 
GeneralRe: The Objective / Solution Pin
Tristan Rhodes16-Dec-03 6:16
Tristan Rhodes16-Dec-03 6:16 
GeneralRe: The Objective / Solution Pin
Heath Stewart16-Dec-03 6:21
protectorHeath Stewart16-Dec-03 6:21 
GeneralRe: The Objective / Solution Pin
Tristan Rhodes16-Dec-03 6:33
Tristan Rhodes16-Dec-03 6:33 
GeneralRich Text box problem Pin
Abhi158116-Dec-03 2:43
Abhi158116-Dec-03 2:43 
GeneralRe: Rich Text box problem Pin
Heath Stewart16-Dec-03 3:36
protectorHeath Stewart16-Dec-03 3:36 
There are different types of image data formats you should check, not just DataFormats.Bitmap. That only specifies a Windows Bitmap and while some programs may put both, for example, JPG and its uncompressed BMP format in the data object, some might not. So make sure you check that there are no images. This would be an exclusive approach.

You could also use an inclusive approach. If you only want formatted or plain text inserted, that check for the existence of those and only those by using DataObject.GetFormats and making sure that all the string array elements are what you want (which reminds me, your call Clipboard.GetDataObject.GetFormats() is useless since you aren't using it's return value - is just a waste of instructions). This would be an inclusive approach and can better limit what you accept in your RichTextBox. Just check for DataFormats.Rtf, DataFormats.Text, DataFormats.UnicodeText, and/or DataFormats.OemText.

The latter method is probably better because the clipboard formats (which are also used in drag-n-drop routines) are not limited to what's in the DataFormats class. Those are just some common ones that are pre-registered by Windows and understandable in .NET. Applications can easily make up their own formats and there are other common formats that the RichTextBox might understand.

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
QuestionHow to report changes in FTP server? Pin
mkomasi16-Dec-03 2:43
mkomasi16-Dec-03 2:43 
AnswerRe: How to report changes in FTP server? Pin
Heath Stewart16-Dec-03 3:24
protectorHeath Stewart16-Dec-03 3:24 
Generalshortcut on text-less button Pin
troels_sorensen16-Dec-03 2:08
troels_sorensen16-Dec-03 2:08 
GeneralRe: shortcut on text-less button Pin
Heath Stewart16-Dec-03 3:23
protectorHeath Stewart16-Dec-03 3:23 
Generaldetecting and editing extended properties Pin
pekai15-Dec-03 23:50
pekai15-Dec-03 23:50 
GeneralRe: detecting and editing extended properties Pin
Heath Stewart16-Dec-03 3:21
protectorHeath Stewart16-Dec-03 3:21 
GeneralRe: detecting and editing extended properties Pin
pekai16-Dec-03 3:50
pekai16-Dec-03 3:50 
GeneralRe: detecting and editing extended properties Pin
Heath Stewart16-Dec-03 4:05
protectorHeath Stewart16-Dec-03 4:05 
GeneralRe: detecting and editing extended properties Pin
pekai16-Dec-03 4:18
pekai16-Dec-03 4:18 
GeneralRe: detecting and editing extended properties Pin
Heath Stewart16-Dec-03 4:59
protectorHeath Stewart16-Dec-03 4:59 
Generalc# & pop_up menue Pin
amjadqaqa15-Dec-03 23:29
amjadqaqa15-Dec-03 23:29 
GeneralRe: c# & pop_up menue Pin
Member 26118815-Dec-03 23:46
Member 26118815-Dec-03 23:46 
GeneralC# & DOS Pin
15-Dec-03 21:20
suss15-Dec-03 21:20 
GeneralRe: C# & DOS Pin
Colin Angus Mackay15-Dec-03 22:18
Colin Angus Mackay15-Dec-03 22:18 
GeneralRe: C# & DOS Pin
Member 26118815-Dec-03 23:49
Member 26118815-Dec-03 23:49 
GeneralRe: C# & DOS Pin
Member 74694915-Dec-03 23:55
Member 74694915-Dec-03 23:55 
GeneralRe: C# & DOS Pin
Colin Angus Mackay16-Dec-03 0:06
Colin Angus Mackay16-Dec-03 0:06 

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.