Hi, You can use the HashSet as: Hashset(Key(Type1), Value (List(Type2)))
Dictionary> dicElements;
Hi, You can use the HashSet as: Hashset(Key(Type1), Value (List(Type2)))
Dictionary> dicElements;
Hi all, I found an article contains an other solution: Zeta HTML Edit Control[^] enjoy :)
Hi, You can implement the cell paint event. I think that you have a data table like this: (Val1, Val2, PicturePath, ...). You can find bellow an example of code that shows in a data grid view a grid contact: ---------------------------------------------------------------- |Picture | First Name | Last Name | Phone number | ---------------------------------------------------------------- | ;) | Mr. X | X1 | 00112233 | ---------------------------------------------------------------- | ;) | Mr. X | X1 | 00112233 | ----------------------------------------------------------------
// Subscribe to the event cell painting
myDataGridView += new DataGridViewCellPaintingEventHandler(myDataGridView_CellPainting);
// Implement the event
void myDataGridView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
// Test if you are drawing the picture cell. Note that the RowIndex == 0 is the row header
if (e.RowIndex > 0 && e.ColumnIndex == 0)
{
try
{
string strPath = myDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
// To optimize you program, you can store the loadeds picture in a dictionary like this:
Bitmap objPicture = null;
if(dicPictures.ContainsKey(strPath))
{
objPicture = dicPictures[strPath];
}
else
{
objPicture = Bitmap.FromFile(strPath);
dicPictures.Add(strPath, objPicture);
}
e.Graphics.DrawImage(objPicture, e.CellBounds);
}
catch (Exception Error)
{
// Error Log or Managing
}
}
}
Hi, To start writing mail, the correct instruction is:
Process.Start("mailto:name@company.com");
then you must change you code as:
Process.Start("mailto:" + this.dgvPresenters[e.ColumnIndex,e.RowIndex].Value.ToString());
Hi, My idea is converting an RTF document to HTML because the rich text control offers the RTF output result. 1)You can use this article to create an advanced rich text box: RicherTextBox 2)To convert the RTF result, you can use the
"SautinSoft.RtfToHtml"
. For the trial version you can convert over 30000 words :^)
private string GetHtmlText(string strRtfText)
{
if (string.IsNullOrEmpty(strRtfText)) return "";
string result = "";
#region Version SautinSoft
SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();
//this property is necessary only for registered version
//r.Serial = "XXXXXXXXXXXXX";
//specify some options
r.OutputFormat = SautinSoft.RtfToHtml.eOutputFormat.HTML\_5;// SautinSoft.eOutputFormat.XHTML\_10;
r.Encoding = SautinSoft.RtfToHtml.eEncoding.UTF\_8;// SautinSoft.eEncoding.UTF\_8;
//specify image options
r.ImageStyle.ImageFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\\\TempFiles"; //this folder must exist
r.ImageStyle.ImageSubFolder = "webs"; //this folder will be created by the component
r.ImageStyle.ImageFileName = "picture"; //template name for images
r.ImageStyle.IncludeImageInHtml = true;//false - save images on HDD, true - save images inside HTML
result = r.ConvertString(strRtfText);
#endregion
return result;
}
Hi
Dan_K
, To draw object under any control, you must implement the event "OnPaint". You can use this code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
panel.Paint += new PaintEventHandler(panel\_Paint);
}
private void void panel\_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawString("Problem drawing text on Panel", panel.Font, Brushes.Black, 50, 50);
}
}
}