Click here to Skip to main content
15,906,567 members
Home / Discussions / C#
   

C#

 
GeneralRe: make a video tutorial Pin
OriginalGriff21-Jul-17 22:16
mveOriginalGriff21-Jul-17 22:16 
GeneralRe: make a video tutorial Pin
Member 1330981721-Jul-17 22:04
Member 1330981721-Jul-17 22:04 
AnswerRe: make a video tutorial Pin
BenScharbach12-Aug-17 9:32
BenScharbach12-Aug-17 9:32 
QuestionMessage Removed Pin
20-Jul-17 2:33
professionalEhsan Sajjad20-Jul-17 2:33 
AnswerMessage Removed Pin
20-Jul-17 4:00
mveOriginalGriff20-Jul-17 4:00 
GeneralMessage Removed Pin
20-Jul-17 4:05
professionalEhsan Sajjad20-Jul-17 4:05 
QuestionHow to call the load runner (LR) controller from visual studio Pin
M.perumal.samy18-Jul-17 21:53
M.perumal.samy18-Jul-17 21:53 
AnswerRe: How to call the load runner (LR) controller from visual studio Pin
Richard MacCutchan18-Jul-17 23:23
mveRichard MacCutchan18-Jul-17 23:23 
AnswerRe: How to call the load runner (LR) controller from visual studio Pin
BillWoodruff19-Jul-17 1:29
professionalBillWoodruff19-Jul-17 1:29 
QuestionSum columns from joined tables to get a calculated value using linq to SQL Pin
Member 1246241116-Jul-17 8:54
Member 1246241116-Jul-17 8:54 
AnswerRe: Sum columns from joined tables to get a calculated value using linq to SQL Pin
BillWoodruff16-Jul-17 11:25
professionalBillWoodruff16-Jul-17 11:25 
GeneralRe: Sum columns from joined tables to get a calculated value using linq to SQL Pin
Member 1246241117-Jul-17 3:01
Member 1246241117-Jul-17 3:01 
AnswerRe: Sum columns from joined tables to get a calculated value using linq to SQL Pin
Nathan Minier17-Jul-17 1:13
professionalNathan Minier17-Jul-17 1:13 
AnswerRe: Sum columns from joined tables to get a calculated value using linq to SQL Pin
Richard Deeming17-Jul-17 1:27
mveRichard Deeming17-Jul-17 1:27 
GeneralRe: Sum columns from joined tables to get a calculated value using linq to SQL Pin
Member 1246241117-Jul-17 12:15
Member 1246241117-Jul-17 12:15 
GeneralRe: Sum columns from joined tables to get a calculated value using linq to SQL Pin
Mycroft Holmes17-Jul-17 14:18
professionalMycroft Holmes17-Jul-17 14:18 
GeneralRe: Sum columns from joined tables to get a calculated value using linq to SQL Pin
Richard Deeming18-Jul-17 0:38
mveRichard Deeming18-Jul-17 0:38 
AnswerRe: Sum columns from joined tables to get a calculated value using linq to SQL Pin
Member 1246241118-Jul-17 10:56
Member 1246241118-Jul-17 10:56 
QuestionWriting to UI Thread in a Real time Application Pin
andycruce16-Jul-17 2:41
andycruce16-Jul-17 2:41 
AnswerRe: Writing to UI Thread in a Real time Application Pin
Gerry Schmitz16-Jul-17 4:49
mveGerry Schmitz16-Jul-17 4:49 
AnswerRe: Writing to UI Thread in a Real time Application Pin
Dave Kreskowiak16-Jul-17 5:28
mveDave Kreskowiak16-Jul-17 5:28 
AnswerRe: Writing to UI Thread in a Real time Application Pin
Alan N16-Jul-17 8:31
Alan N16-Jul-17 8:31 
SuggestionRe: Writing to UI Thread in a Real time Application Pin
BenScharbach12-Aug-17 10:17
BenScharbach12-Aug-17 10:17 
QuestionPaste CF_ENHMETAFILE=14 image file Pin
manuellopes14-Jul-17 11:32
manuellopes14-Jul-17 11:32 
Hi how can i paste image to file?
my image is CF_ENHMETAFILE=14 image
Code below get image without quality how can i save image from clipboard to file.
Thank you

C#
public class ClipboardMetafileHelper
   {
       [DllImport("user32.dll", EntryPoint = "OpenClipboard", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
       public static extern bool OpenClipboard(IntPtr hWnd);
       [DllImport("user32.dll", EntryPoint = "EmptyClipboard", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
       public static extern bool EmptyClipboard();
       [DllImport("user32.dll", EntryPoint = "SetClipboardData", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
       public static extern IntPtr SetClipboardData(int uFormat, IntPtr hWnd);
       [DllImport("user32.dll", EntryPoint = "GetClipboardData", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
       public static extern IntPtr GetClipboardData(int uFormat);
       [DllImport("user32.dll", EntryPoint = "CloseClipboard", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
       public static extern bool CloseClipboard();
       [DllImport("gdi32.dll", EntryPoint = "CopyEnhMetaFileA", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
       public static extern IntPtr CopyEnhMetaFile(IntPtr hemfSrc, IntPtr hNULL);
       [DllImport("gdi32.dll", EntryPoint = "DeleteEnhMetaFile", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
       public static extern bool DeleteEnhMetaFile(IntPtr hemfSrc);

       // Metafile mf is set to a state that is not valid inside this function.
       public static bool PutEnhMetafileOnClipboard(IntPtr hWnd, Metafile mf)
       {
           bool bResult = new bool();
           bResult = false;
           IntPtr hEMF = default(IntPtr);
           IntPtr hEMF2 = default(IntPtr);
           hEMF = mf.GetHenhmetafile();
           // invalidates mf
           if (!hEMF.Equals(new IntPtr(0)))
           {
               hEMF2 = CopyEnhMetaFile(hEMF, new IntPtr(0));
               if (!hEMF2.Equals(new IntPtr(0)))
               {
                   if (OpenClipboard(hWnd))
                   {
                       if (EmptyClipboard())
                       {
                           IntPtr hRes = default(IntPtr);
                           hRes = SetClipboardData(14, hEMF2);
                           // 14 == CF_ENHMETAFILE
                           bResult = hRes.Equals(hEMF2);
                           CloseClipboard();
                       }
                   }
               }
               DeleteEnhMetaFile(hEMF);
           }
           return bResult;
       }

       public static Image GetEnhMetafileFromClipboard(IntPtr hWnd)
       {
           OpenClipboard(hWnd);
           // IntPtr.Zero
           IntPtr hemf = GetClipboardData(14);
           // 14 == CF_ENHMETAFILE
           CloseClipboard();
           if (hemf != IntPtr.Zero)
           {
               Metafile mf = new Metafile(hemf, true);
               Bitmap b = new Bitmap(mf.Width, mf.Height);
               Graphics g = Graphics.FromImage(b);
               g.FillRectangle(Brushes.White, 0, 0, 1000, 1000);
               GraphicsUnit unit = GraphicsUnit.Millimeter;
               RectangleF rsrc = mf.GetBounds(ref unit);
               g.DrawImage(mf, new Rectangle(0, 0, mf.Width, mf.Height), rsrc, unit);
               return b;
           }


           return null;
       }


   }

SuggestionRe: Paste CF_ENHMETAFILE=14 image file Pin
Richard MacCutchan14-Jul-17 20:35
mveRichard MacCutchan14-Jul-17 20:35 

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.