combit List & Label 24 - .NET Online Web Help
DrawDesignerObjectHandler Delegate


combit.ListLabel24 Namespace : DrawDesignerObjectHandler Delegate

After the user has edited the object, you are asked by List & Label to draw the object. The event DrawDesignerObject is triggered for this purpose. A Graphics object and the rectangle of the object are passed through EventArguments. Now, you can draw in the work area with the known GDI + methods. While doing so, access to the underlying object properties is naturally possible and useful. The sample listing shows the presentation of the graphic file selected above.

Syntax
'Declaration
 
Public Delegate Sub DrawDesignerObjectHandler( _
   ByVal sender As Object, _
   ByVal e As DrawDesignerObjectEventArgs _
) 
public delegate void DrawDesignerObjectHandler( 
   object sender,
   DrawDesignerObjectEventArgs e
)
public delegate void DrawDesignerObjectHandler( 
   Object^ sender,
   DrawDesignerObjectEventArgs^ e
)

Parameters

sender
e
Remarks

Due to a minor inconsistency, conversion of the font size should be carried out manually at the time of printing the text using the Graphics.DrawString, if necessary. The .NET framework calculates it internally as 1/10 inch. If millimeter (1/10) has been indicated as the metric unit (property Units), the size should be multiplied manually by 2.54:

e.Graphics.DrawString("Hello world", new Font("Arial", 20F * 2.54F), new SolidBrush(Color.Black), e.ClipRectangle);

 

Example
private void designerObject1_DrawDesignerObject(object sender, DrawDesignerObjectEventArgs e)

{

     DesignerObject desobj = (DesignerObject) sender;

     if(desobj.ObjectProperties.Contains("imagefile"))

     {

          string imagefile = desobj.ObjectProperties["imagefile"].ToString();

          e.Graphics.DrawImage(new Bitmap(imagefile), e.ClipRectangle);

     }

}
Requirements

Platforms: Windows Vista - Windows 10 Version 1809, Windows Server 2008 - 2016

See Also

Reference

DrawDesignerObjectHandler Members
combit.ListLabel24 Namespace