12345678910111213141516171819202122232425262728293031323334 |
- using CustomControls.Pattern;
- using DevExpress.XtraPrinting;
- using DevExpress.XtraPrinting.Native;
- namespace CustomControls
- {
- /// <summary>
- /// 自定义控件
- /// </summary>
- public class CustomControl
- {
- /// <summary>
- /// 注册解析事件,映射类型
- /// </summary>
- public static void EnsurePatternBrick() => BrickFactory.BrickResolve += BrickFactory_BrickResolve;
- /// <summary>
- /// 映射控件类型
- /// </summary>
- private static void BrickFactory_BrickResolve(object sender, BrickResolveEventArgs args)
- {
- if (args.Brick != null) return;
- /* 根据控件名称选择控件 */
- switch (args.Name)
- {
- case nameof(PatternBrick):
- args.Brick = new PatternBrick();
- break;
- }
- }
- }
- }
|