visual-studio - Solidworks 属性管理器页面 - 同一行上有 2 个按钮
问题描述
我正在构建自己的 Solidworks 插件,在构建时遇到了困难。
有人知道如何在 Property Manager 页面中并排创建 2 个按钮吗?我尝试了 swPropertyManagerPageControlLeftAlign_e枚举的不同可能性,但没有成功。
这个想法是我希望人们从配置列表中选择他们希望服务器处理的每个配置。因此,我创建了 4 个按钮(SelectAll/SelectHighlighted/DeSelectHighlighted/DeSelectAll)来帮助用户进行选择。
这是目前的样子:
//Ajout Controls Group_Configs
lst_Configs_All = Group_Configs.AddControl2(lst_Configs_All_ID, (int)swPropertyManagerPageControlType_e.swControlType_Listbox, "Configurations", (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge, (int)swAddControlOptions_e.swControlOptions_Enabled + (int)swAddControlOptions_e.swControlOptions_Visible, "Liste des configurations du modèle actif");
lst_Configs_All.Height = 180;
lst_Configs_All.Style = (int)swPropMgrPageListBoxStyle_e.swPropMgrPageListBoxStyle_NoIntegralHeight;
BitmapHandler iBmp = new BitmapHandler();
string BitmapFileName = iBmp.CreateFileFromResourceBitmap("Willy.Controller.Template.btnConfigs.bmp", System.Reflection.Assembly.GetAssembly(this.GetType()));
// string BitmapFileName = System.IO.Path.GetDirectoryName((System.Reflection.Assembly.GetExecutingAssembly().Location)); //& "\" & _SwAddin.BitMapsFolder & "Select2.bmp"
btn_Configs_SelectAll = Group_Configs.AddControl2(btn_Configs_SelectAll_ID, (int)swPropertyManagerPageControlType_e.swControlType_BitmapButton, "Tout Sélectionner", (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge, (int)swAddControlOptions_e.swControlOptions_Enabled + (int)swAddControlOptions_e.swControlOptions_Visible, "Sélectionner toutes les configurations");
btn_Configs_SelectAll.SetBitmapsByName3(BitmapFileName, "");
btn_Configs_Select = Group_Configs.AddControl2(btn_Configs_Select_ID, (int)swPropertyManagerPageControlType_e.swControlType_BitmapButton, "Sélectionner les configuration surlignées", (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent, (int)swAddControlOptions_e.swControlOptions_Enabled + (int)swAddControlOptions_e.swControlOptions_Visible, "Sélectionner les configuration surlignées");
btn_Configs_Select.SetBitmapsByName3(BitmapFileName, "");
btn_Configs_DeSelect = Group_Configs.AddControl2(btn_Configs_DeSelect_ID, (int)swPropertyManagerPageControlType_e.swControlType_BitmapButton, "Désélectionner les configuration surlignées", (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent, (int)swAddControlOptions_e.swControlOptions_Enabled + (int)swAddControlOptions_e.swControlOptions_Visible, "Désélectionner les configuration surlignées");
btn_Configs_DeSelect.SetBitmapsByName3(BitmapFileName, "");
btn_Configs_DeSelectAll = Group_Configs.AddControl2(btn_Configs_DeSelectAll_ID, (int)swPropertyManagerPageControlType_e.swControlType_BitmapButton, "Désélectionner toutes les configuration", (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent, (int)swAddControlOptions_e.swControlOptions_Enabled + (int)swAddControlOptions_e.swControlOptions_Visible, "Désélectionner toutes les configuration");
btn_Configs_DeSelectAll.SetBitmapsByName3(BitmapFileName, "");
lst_Configs_ToDo = Group_Configs.AddControl2(lst_Configs_ToDo_ID, (int)swPropertyManagerPageControlType_e.swControlType_Listbox, "Configurations", (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_LeftEdge, (int)swAddControlOptions_e.swControlOptions_Enabled + (int)swAddControlOptions_e.swControlOptions_Visible, "Liste des configurations à générer");
lst_Configs_ToDo.Height = 180;
lst_Configs_ToDo.Style = (int)swPropMgrPageListBoxStyle_e.swPropMgrPageListBoxStyle_NoIntegralHeight;
解决方案
好的,所以我想经过一些研究,我找到了解决这个问题的方法。
您需要将 BitmapButton 转换为它的父对象 (PropertyManagerPageControl) 才能访问 Top 和 Left 属性。然后,您可以将像素设置为您需要的任何值。
编辑:这是我有经理要做的。我也包括代码。
btn_Configs_SelectAll = Group_Configs.AddControl2(btn_Configs_SelectAll_ID, (int)swPropertyManagerPageControlType_e.swControlType_BitmapButton, "Tout Sélectionner", (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent, options, "Sélectionner toutes les configurations");
string[] imageList = new string[1];
imageList[0] = System.IO.Path.GetDirectoryName((System.Reflection.Assembly.GetExecutingAssembly().Location)) + @"\View\Bitmaps\btnConfigs_SelectAll.bmp";
btn_Configs_SelectAll.SetBitmapsByName3(imageList, imageList);
((PropertyManagerPageControl)btn_Configs_SelectAll).Top = 140;
((PropertyManagerPageControl)btn_Configs_SelectAll).Left = 0;
btn_Configs_Select = Group_Configs.AddControl2(btn_Configs_Select_ID, (int)swPropertyManagerPageControlType_e.swControlType_BitmapButton, "Sélectionner les configuration surlignées", (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent, options, "Sélectionner les configuration surlignées");
string[] imageList2 = new string[1];
imageList2[0] = System.IO.Path.GetDirectoryName((System.Reflection.Assembly.GetExecutingAssembly().Location)) + @"\View\Bitmaps\btnConfigs_Select.bmp";
btn_Configs_Select.SetBitmapsByName3(imageList2, imageList2);
((PropertyManagerPageControl)btn_Configs_Select).Top = 140;
((PropertyManagerPageControl)btn_Configs_Select).Left = 30;
btn_Configs_DeSelect = Group_Configs.AddControl2(btn_Configs_DeSelect_ID, (int)swPropertyManagerPageControlType_e.swControlType_BitmapButton, "Désélectionner les configuration surlignées", (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent, options, "Désélectionner les configuration surlignées");
string[] imageList3 = new string[1];
imageList3[0] = System.IO.Path.GetDirectoryName((System.Reflection.Assembly.GetExecutingAssembly().Location)) + @"\View\Bitmaps\btnConfigs_DeSelect.bmp";
btn_Configs_DeSelect.SetBitmapsByName3(imageList3, imageList3);
((PropertyManagerPageControl)btn_Configs_DeSelect).Top = 140;
((PropertyManagerPageControl)btn_Configs_DeSelect).Left = 60;
btn_Configs_DeSelectAll = Group_Configs.AddControl2(btn_Configs_DeSelectAll_ID, (int)swPropertyManagerPageControlType_e.swControlType_BitmapButton, "Désélectionner toutes les configuration", (int)swPropertyManagerPageControlLeftAlign_e.swControlAlign_Indent, options, "Désélectionner toutes les configuration");
string[] imageList4 = new string[1];
imageList4[0] = System.IO.Path.GetDirectoryName((System.Reflection.Assembly.GetExecutingAssembly().Location)) + @"\View\Bitmaps\btnConfigs_DeSelectAll.bmp";
btn_Configs_DeSelectAll.SetBitmapsByName3(imageList4, imageList4);
((PropertyManagerPageControl)btn_Configs_DeSelectAll).Top = 140;
((PropertyManagerPageControl)btn_Configs_DeSelectAll).Left = 90;
推荐阅读
- firebase - 我的实时 Firebase 项目数据库未打开或工作
- amazon-web-services - Jenkins:检查是否存在 AWS S3 存储桶,否则创建它
- r - 使用 gganimate 在绘图中仅对一条线和两条静态线进行动画处理
- node.js - Apollo,Sequelize - 简单的 `belongsTo` 关联返回 null
- google-apps-script - 为什么两个用户有时会从 importrange 中看到不同的值?
- azure - 如何使用 Azure AD 在 Angular(前端)和 Spring Boot(后端)之间实现 OAuth 2.0 授权代码流
- python - 出现错误 ValueError:Series 的真值不明确。使用 a.empty、a.bool()、a.item()、a.any() 或 a.all()
- javascript - 无法读取未定义的属性“正文” - cakephp 2 中的 TinyMCE
- c# - 使用 FluentApi 为已存在的表创建外键
- c# - 如何使用 Outlook 对象库通过电子邮件地址获取 ExchangeUser?