问题描述
您好,
我设计了一个myFormClass,继承自C#2013 .Net 4 winforms,(System.Windows.Forms.Form类)。
我在myFormClass中放置了一个PictureBox控件(命名为:pbxImage)。
我还在myFormClass中添加了一个属性(命名为:PictureBoxImage),以便在设计时将图片分配给pbxImage.BackgroundImage / run time。
然后,我将一个窗体(命名为:frmMain)添加到我的项目中并从myFormClass继承它。
现在我想要:
1-访问myFormClass代码中的pbxImage属性。对于来自PictureBoxImage的exmaple获取和设置访问器。
2-并且,在frmMain属性网格窗口(在设计时),从组合框列表中隐藏pbxImage控件。
如果我将pbxImage.GenerateMember设置为false,则数字2成功,但数字1失败。
如果我将pbxImage.GenerateMember设置为true,并选择任何pbxImage.Modifier,则数字1成功,但数字2失败并且pbxImage控件出现在frmMain属性网格窗口中。
您的建议是什么?
PE:
示例项目下载链接(175KB ): []
和图片下载链接(232KB): []
在图片中我不想在属性网格组件列表中看到pbxImage,我想要保持访问frmMain.PictureBoxImage。
非常感谢你的posts。
Hello,
I designed a myFormClass, inherited from C# 2013 .Net 4 winforms, (System.Windows.Forms.Form class).
And I place a PictureBox control (named it: pbxImage) in myFormClass.
Also I add a property to myFormClass (named it: PictureBoxImage) to assign a picture to pbxImage.BackgroundImage at design/run time.
Then, I add a windows form (named it: frmMain) to my project and inherit it from myFormClass.
Now I want:
1- access the pbxImage properties in myFormClass code behind. for exmaple from the PictureBoxImage get and set accessors.
2- and, in frmMain properties grid window (at design time), hide the pbxImage control from the combobox list.
If I set the pbxImage.GenerateMember to false, the number 2 is success, but number 1 is fail.
If I set the pbxImage.GenerateMember to true, and any selection of pbxImage.Modifier, the number 1 is success, but the number 2 is fail and pbxImage control appear in frmMain properties grid window.
What is your suggestion?
PE:
Sample project download link (175KB): Wikisend: free file sharing service[^]
and a picture download link(232KB): Wikisend: free file sharing service[^]
In the picture i don't want see the pbxImage in Properties grid components list, and I want stay accessible the frmMain.PictureBoxImage.
Thanks a lot for your posts.
这篇关于如何在属性网格中隐藏我的类组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!