变更控制类型工具 [英] Change Control Type Tool

查看:123
本文介绍了变更控制类型工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天!

您能指导我从哪里开始对此问题进行搜索.我们使用一些自定义DropDown控件(例如,UltraDropDown)拥有大量WinForms代码.通常是在InitializeComponent方法中.我需要更改该控件的类型以让我们说DevDropDown.这两种类型在其基础上都是DropDown控件,但是具有绝对不同的属性,因此仅删除旧的UltraDropDown并将DevDropDown重命名为UltraDropDown将无济于事,因为我不想将所有无用的属性包装到我的新控件中.我想要的是一些代码生成工具,该工具将搜索旧的UltraDropDown并在InitializeComponent方法中清除其代码(位置和大小除外),然后粘贴新的DevDropDown代码.

Good day!

Could you guide me where should I start searches on such issue. We have a huge amount of WinForms code using some Custom DropDown control(let''s say UltraDropDown). Mostly its in InitializeComponent method. I need to change type of that control to let''s say DevDropDown. That two types are both DropDown controls in its base, but have absolutely different properties, so just deleting old UltraDropDown and renaming DevDropDown to UltraDropDown won''t help, cause i don''t want to wrap all that useless properties to my new control. What I want is some codegeneration tool that would search old UltraDropDown and clear its code in InitializeComponent method except Location and Sizes, and paste new DevDropDown code. May be there are some patterns for creating such tool?

推荐答案

除了查找/替换需要大量时间手动更改属性名称外,没有工具可以为您提供帮助.

一种可能是为DevDropDown创建一个包装,使其看起来像UltraDropDown(您已使用的属性),然后将其插入到源中[如果控件被密封等,这是不可能的.]:
No tool will help you here other than a find/replace with a lot of time changing property names by hand.

One possibility is to create a wrapper for DevDropDown to make it look like UltraDropDown ( properties you have used) and plugin that into your source [this may not be possible if the control is sealed etc.]:
public class myDropDown : DevDropDown
{
   public string PropertyOfUltraDropDownWhichIsUsed {get;set;} 
} 


这篇关于变更控制类型工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆