Controls the speed, quality, and style used when painting a Leadtools.RasterImage object using the Windows GDI or GDI+ engines.
public struct RasterPaintProperties : System.ValueTypePublic Structure RasterPaintPropertiesInherits System.ValueType
public value class RasterPaintProperties : public System.ValueTypeThe various RasterImagePainter.Paint method overloads require an instance of RasterPaintProperties to be passed. The members of the RasterPaintProperties controls the speed, quality, and style used when painting.
The following example creates a Windows form with various controls to show different RasterPaintProperties options.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.Drawing<TestMethod()> _Public Sub RasterPaintPropertiesExample()' Create the formDim form As New PaintPropertiesForm()form.ShowDialog()End SubClass PaintPropertiesFormInherits FormPrivate index As Integer = 0Private rasterImage As RasterImagePrivate paintProperties As RasterPaintPropertiesPublic Sub New()Text = "GDI paint engine - normal - Double click to show next RasterPaintProperties options"SetStyle(ControlStyles.ResizeRedraw, True)SetStyle(ControlStyles.AllPaintingInWmPaint, True)SetStyle(ControlStyles.OptimizedDoubleBuffer, True)SetStyle(ControlStyles.UserPaint, True)' Load an imageDim fileName As String = LeadtoolsExamples.Common.ImagesPath.Path + "Ocr1.tif"Using codecs As New RasterCodecs()codecs.ThrowExceptionsOnInvalidImages = TruerasterImage = codecs.Load(fileName)End UsingpaintProperties = RasterPaintProperties.Default' Start with GDI paint engine and normal paint scalingpaintProperties.PaintEngine = RasterPaintEngine.GdipaintProperties.PaintDisplayMode = RasterPaintDisplayModeFlags.NoneEnd SubProtected Overrides Sub Dispose(ByVal disposing As Boolean)If disposing ThenIf Not IsNothing(rasterImage) ThenrasterImage.Dispose()End IfEnd IfMyBase.Dispose(disposing)End SubProtected Overrides Sub OnDoubleClick(ByVal e As EventArgs)Select indexCase 0Text = "GDI paint engine - SourceAnd ROP - Double click to show next RasterPaintProperties options"paintProperties.RasterOperation = RasterPaintProperties.SourceAndCase 1Text = "GDI paint engine - Scale to gray - Double click to show next RasterPaintProperties options"paintProperties.RasterOperation = RasterPaintProperties.SourceCopypaintProperties.PaintDisplayMode = RasterPaintDisplayModeFlags.ScaleToGrayCase 2Text = "GDI+ paint engine - Double click to set the opacity"paintProperties.PaintEngine = RasterPaintEngine.GdiPlusCase 3Text = "GDI+ paint engine - Opacity set to 50% - Done"paintProperties.Opacity = 128End Selectindex = index + 1Invalidate()MyBase.OnDoubleClick(e)End SubProtected Overrides Sub OnPaint(ByVal e As PaintEventArgs)' Paint the imageDim destRect As LeadRect = LeadRect.FromLTRB(ClientRectangle.Left, ClientRectangle.Top, ClientRectangle.Right, ClientRectangle.Bottom)destRect = rasterImage.CalculatePaintModeRectangle( _rasterImage.ImageWidth, _rasterImage.ImageHeight, _destRect, _RasterPaintSizeMode.Fit, _RasterPaintAlignMode.Center, _RasterPaintAlignMode.Center)RasterImagePainter.Paint(rasterImage, e.Graphics, destRect, paintProperties)MyBase.OnPaint(e)End SubEnd Class
using Leadtools;using Leadtools.Codecs;using Leadtools.Drawing;public void RasterPaintPropertiesExample(){// Create the formPaintPropertiesForm form = new PaintPropertiesForm();form.ShowDialog();}class PaintPropertiesForm : Form{private int index = 0;private RasterImage rasterImage;private RasterPaintProperties paintProperties;public PaintPropertiesForm(){Text = "GDI paint engine - normal - Double click to show next RasterPaintProperties options";SetStyle(ControlStyles.ResizeRedraw, true);SetStyle(ControlStyles.AllPaintingInWmPaint, true);SetStyle(ControlStyles.OptimizedDoubleBuffer, true);SetStyle(ControlStyles.UserPaint, true);// Load an imagestring fileName = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif");using(RasterCodecs codecs = new RasterCodecs()){codecs.ThrowExceptionsOnInvalidImages = true;rasterImage = codecs.Load(fileName);}paintProperties = RasterPaintProperties.Default;// Start with GDI paint engine and normal paint scalingpaintProperties.PaintEngine = RasterPaintEngine.Gdi;paintProperties.PaintDisplayMode = RasterPaintDisplayModeFlags.None;}protected override void Dispose(bool disposing){if(disposing){if(rasterImage != null)rasterImage.Dispose();}base.Dispose(disposing);}protected override void OnDoubleClick(EventArgs e){switch(index){case 0:Text = "GDI paint engine - SourceAnd ROP - Double click to show next RasterPaintProperties options";paintProperties.RasterOperation = RasterPaintProperties.SourceAnd;break;case 1:Text = "GDI paint engine - Scale to gray - Double click to show next RasterPaintProperties options";paintProperties.RasterOperation = RasterPaintProperties.SourceCopy;paintProperties.PaintDisplayMode = RasterPaintDisplayModeFlags.ScaleToGray;break;case 2:Text = "GDI+ paint engine - Double click to set the opacity";paintProperties.PaintEngine = RasterPaintEngine.GdiPlus;break;case 3:Text = "GDI+ paint engine - Opacity set to 50% - Done";paintProperties.Opacity = 128;break;default:break;}index++;Invalidate();base.OnDoubleClick(e);}protected override void OnPaint(PaintEventArgs e){// Paint the imageLeadRect destRect = LeadRect.FromLTRB(ClientRectangle.Left, ClientRectangle.Top, ClientRectangle.Right, ClientRectangle.Bottom);destRect = RasterImage.CalculatePaintModeRectangle(rasterImage.ImageWidth,rasterImage.ImageHeight,destRect,RasterPaintSizeMode.Fit,RasterPaintAlignMode.Center,RasterPaintAlignMode.Center);RasterImagePainter.Paint(rasterImage, e.Graphics, destRect, paintProperties);base.OnPaint(e);}}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
|
Products |
Support |
Feedback: RasterPaintProperties Structure - Leadtools.Drawing |
Introduction |
Help Version 19.0.2017.3.21
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.