design-time

Property edit style as DropDown in a VS .NET custom component

我的梦境 提交于 2021-02-05 06:58:05
问题 I'd like to use the functionality of a ComboBox as edit option for a var in the properties window of a custom control / component. Not the ComboBox component itself. As example: private string[] _stringArray = { "string0", "string1" }; public string[] StringArray { get { return _stringArray; } //callback //set { _stringArray = value; } } As you know this will give me the object browser as view/edit option in the property window. Funny thing that I can edit the values even with no setter. In

Looking for a more dynamic designer TypeConverter serialization in a VS10 .NET form

帅比萌擦擦* 提交于 2020-12-13 04:24:05
问题 I have a list of a class which I serialize to the designer generated code with the following code: internal class TargetSettingsConverter : TypeConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return destinationType == typeof(InstanceDescriptor) || base.CanConvertTo(context, destinationType); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType ==

Looking for a more dynamic designer TypeConverter serialization in a VS10 .NET form

为君一笑 提交于 2020-12-13 04:23:25
问题 I have a list of a class which I serialize to the designer generated code with the following code: internal class TargetSettingsConverter : TypeConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return destinationType == typeof(InstanceDescriptor) || base.CanConvertTo(context, destinationType); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType ==

How do I make a property of a custom control open a file dialog?

喜你入骨 提交于 2020-08-20 11:38:13
问题 I have a custom control with a property that holds the name (full path) to a file location that exists on the target computer. The exact path will vary according to type of target pc and is typically set right after I add the custom control to my Form, while I am still in design mode of my project, so that when my application runs, it picks up the filename from the property. It would be convenient if the property opened a file dialog to let me browse to the location (similar to how dialogs

How do I make a property of a custom control open a file dialog?

社会主义新天地 提交于 2020-08-20 11:36:48
问题 I have a custom control with a property that holds the name (full path) to a file location that exists on the target computer. The exact path will vary according to type of target pc and is typically set right after I add the custom control to my Form, while I am still in design mode of my project, so that when my application runs, it picks up the filename from the property. It would be convenient if the property opened a file dialog to let me browse to the location (similar to how dialogs

How to define a class with published method in a separate unit that is available at design-time to other units?

别来无恙 提交于 2020-06-17 09:15:25
问题 To overcome a bug in 10.3.3 (see QC report https://quality.embarcadero.com/browse/RSP-29565) relating to TFDTable detailed elsewhere (Delphi TFDTable open fails when indexname is set), I want to be able to define a class with a method in a common unit that can be assigned (programmatically) as a BeforeOpen event in the relevant DFM for TFDTable components defined on a Form or DataModule. I realize that this question has been asked before (e.g. How to make a separate unit for event methods,

Control's Enabled appearance at design time?

醉酒当歌 提交于 2020-05-09 06:00:30
问题 I defined a custom button class, which sets background color when button is enabled/disabled. Enabled appearance at runtime (A): Disabled appearance at runtime (B): Design time appearance is always (A), regardless of the value of Enabled property. I would like my control to appear in designer exactly the way it would appear at run time. Is it possible and, if so, how can do it? Here is what I tried (only relevant parts of the code): Public Class StyledButton : Inherits Button Private p

Control's Enabled appearance at design time?

谁都会走 提交于 2020-05-09 05:59:01
问题 I defined a custom button class, which sets background color when button is enabled/disabled. Enabled appearance at runtime (A): Disabled appearance at runtime (B): Design time appearance is always (A), regardless of the value of Enabled property. I would like my control to appear in designer exactly the way it would appear at run time. Is it possible and, if so, how can do it? Here is what I tried (only relevant parts of the code): Public Class StyledButton : Inherits Button Private p

Redistributing a WinForms component with design-time functionality in a separate DLL without admin rights

半腔热情 提交于 2020-01-16 07:52:31
问题 I am trying to modify the installation package for one of our legacy WinForms component. The goal I want to achieve is to avoid elevating privileges and do all works without admin rights. The problem is that the component is implemented in two DLLs - the core functionality redistributed with compiled apps and the design-time functionality needed only for the WinForms designer. To provide all design-time features of the component, VS should "know" how to find the design-time DLL. Earlier we

How to get the project path at Design Time

强颜欢笑 提交于 2020-01-14 09:07:30
问题 I use a component (System.ComponentModel.Component) and I want to get the application path of my project in order to create a file within it. Thx Florian 回答1: The only thing that seemed to work (consistently) for me was obtaining EnvDTE.DTE (from the IServiceProvider you get from EditValue()), i.e.: EnvDTE.DTE dte = envProvider.GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE; string dir = Path.GetDirectoryName(dte.Solution.FullName); When I tried using Assembly.GetXAssembly, I got the temporary