D
Daniel TRM
Guest
After i ever used the method to use the clipboard to insert images in to richtextbox. I see that when resizing the image, it get a very messed up color and quality.
i try to any code for visual C#but is not work.
this is my code for paste image to richtextbox
openFileDialog1.Title = "RTF-Insert Image File";
openFileDialog1.DefaultExt = "rtf";
openFileDialog1.Filter = "PNG File (*.png)|*.png|JPEG File (*.jpg,*.jpeg,*.jpe,*.jfif)|*.jpg,*.jpeg,*.jpe,*.jfif|BMP File (*.bmp)|*.bmp";
openFileDialog1.FilterIndex = 1;
openFileDialog1.ShowDialog();
if (openFileDialog1.FileName == "")
{
return;
}
try
{
string strImagePath = openFileDialog1.FileName;
Image img;
img = Image.FromFile(strImagePath);
Clipboard.SetDataObject(img);
DataFormats.Format df;
df = DataFormats.GetFormat(DataFormats.Bitmap);
if (this.rtbDoc.CanPaste(df))
{
this.rtbDoc.Paste(df);
}
someone can help please for this problem?
Continue reading...
i try to any code for visual C#but is not work.
this is my code for paste image to richtextbox
openFileDialog1.Title = "RTF-Insert Image File";
openFileDialog1.DefaultExt = "rtf";
openFileDialog1.Filter = "PNG File (*.png)|*.png|JPEG File (*.jpg,*.jpeg,*.jpe,*.jfif)|*.jpg,*.jpeg,*.jpe,*.jfif|BMP File (*.bmp)|*.bmp";
openFileDialog1.FilterIndex = 1;
openFileDialog1.ShowDialog();
if (openFileDialog1.FileName == "")
{
return;
}
try
{
string strImagePath = openFileDialog1.FileName;
Image img;
img = Image.FromFile(strImagePath);
Clipboard.SetDataObject(img);
DataFormats.Format df;
df = DataFormats.GetFormat(DataFormats.Bitmap);
if (this.rtbDoc.CanPaste(df))
{
this.rtbDoc.Paste(df);
}
someone can help please for this problem?
Continue reading...