How can I add a hyperlink to a RichTextBox control?
To add a hyperlink to the RichTextBox, so that it opens up the link you click on, ensure that DetectUrls property is set to True and call: [C#] private void richTextBox1_LinkClicked(object sender, System.Windows.Forms.LinkClickedEventArgs e) { System.Diagnostics.Process.Start(e.LinkText); } [VB.NET] Private Sub richTextBox1_LinkClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.LinkClickedEventArgs) System.Diagnostics.Process.Start(e.LinkText) End Sub
Where can I find a VB.Net to C# code converter ?
Please try the following link for this purpose : http://www.developerfusion.com/utilities/convertvbtocsharp.aspx
How can I copy and paste images/graphs etc from MS Office to a PictureBox?
Since .NET uses it’s own format that is not compatible with the EnhancedMetafile format you will have to use reflection to achieve this. (From a posting in the microsoft.public.dotnet.framework.drawing newsgroup) [C#] using System.Runtime.InteropServices; using System.Reflection; public const uint CF_METAFILEPICT = 3; public const uint CF_ENHMETAFILE = 14; [DllImport('user32.dll', CharSet=CharSet.Auto, ExactSpelling=true)] public static extern bool OpenClipboard(IntPtr hWndNewOwner); [DllImport('user32.dll', CharSet=CharSet.Auto, ExactSpelling=true)] public static extern bool CloseClipboard(); [DllImport('user32.dll', CharSet=CharSet.Auto, ExactSpelling=true)] public static extern IntPtr GetClipboardData(uint format); [DllImport('user32.dll', CharSet=CharSet.Auto, ExactSpelling=true)] public static extern bool IsClipboardFormatAvailable(uint format); //Pasting into PictureBox if (OpenClipboard(this.Handle)) { if (IsClipboardFormatAvailable(CF_ENHMETAFILE)) { IntPtr ptr = GetClipboardData(CF_ENHMETAFILE); if (!ptr.Equals(new IntPtr(0))) { Metafile metafile = new Metafile(ptr,true); //Set the Image Property of PictureBox this.pictureBox1.Image = metafile; } } CloseClipboard(); }
How can I copy a bitmap from the clipboard to a PictureBox?
This code snippet shows how you can set your PictureBox’s image to be the image from the clipboard: [C#] this.pictureBox1.Image = (Bitmap)Clipboard.GetDataObject().GetData(DataFormats.Bitmap); [VB.Net] Me.pictureBox1.Image = CType(Clipboard.GetDataObject().GetData(DataFormats.Bitmap), Bitmap)
How can I programmatically create a bitmap
Since .NET uses it’s own format that is not compatible with the EnhancedMetafile format you will have to use reflection to achieve this. (From a posting in the microsoft.public.dotnet.framework.drawing newsgroup) [C#] using System.Runtime.InteropServices; using System.Reflection; public const uint CF_METAFILEPICT = 3; public const uint CF_ENHMETAFILE = 14; [DllImport('user32.dll', CharSet=CharSet.Auto, ExactSpelling=true)] public static extern bool OpenClipboard(IntPtr hWndNewOwner); [DllImport('user32.dll', CharSet=CharSet.Auto, ExactSpelling=true)] public static extern bool CloseClipboard(); [DllImport('user32.dll', CharSet=CharSet.Auto, ExactSpelling=true)] public static extern IntPtr GetClipboardData(uint format); [DllImport('user32.dll', CharSet=CharSet.Auto, ExactSpelling=true)] public static extern bool IsClipboardFormatAvailable(uint format); //Pasting into PictureBox if (OpenClipboard(this.Handle)) { if (IsClipboardFormatAvailable(CF_ENHMETAFILE)) { IntPtr ptr = GetClipboardData(CF_ENHMETAFILE); if (!ptr.Equals(new IntPtr(0))) { Metafile metafile = new Metafile(ptr,true); //Set the Image Property of PictureBox this.pictureBox1.Image = metafile; } } CloseClipboard(); }