←Select platform

DeleteLeadDC Method

Summary
Deletes the device context that was created using the CreateLeadDC method.
Syntax
C#
C++/CLI
Python
public static void DeleteLeadDC( 
   IntPtr hdc 
) 
public: 
static void DeleteLeadDC(  
   IntPtr hdc 
)  
def DeleteLeadDC(self,hdc): 

Parameters

hdc
Handle to a device context that was created using the CreateLeadDC method.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
 
 
public void CreateLeadDCExample() 
{ 
   RasterCodecs codecs = new RasterCodecs(); 
   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")); 
 
   LeadPoint point1 = new LeadPoint(image.Width / 8, image.Height / 8); 
   LeadPoint point2 = new LeadPoint(image.Width / 2, image.Height / 2); 
 
   // Convert the coordinates if necessary. 
   if (image.ViewPerspective != RasterViewPerspective.TopLeft) 
   { 
      point1 = image.PointToImage(RasterViewPerspective.TopLeft, point1); 
      point2 = image.PointToImage(RasterViewPerspective.TopLeft, point2); 
   } 
 
   // Create the device context 
   IntPtr hdc = RasterImagePainter.CreateLeadDC(image); 
   using (Graphics g = Graphics.FromHdc(hdc)) 
   { 
      g.DrawEllipse(new Pen(Color.White), point1.X, point1.Y, point2.X - point1.X, point2.Y - point1.Y); 
   } 
   RasterImagePainter.DeleteLeadDC(hdc); 
 
   codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Imahe1_CreateLeadDC.bmp"), RasterImageFormat.Bmp, 0); 
 
   image.Dispose(); 
   codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Drawing Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.