Страница Менеджера свойств Solidworks - 2 кнопки на одной строке
Я создаю свой собственный Solidworks Addin, и при его создании я столкнулся с трудностью.
Кто-нибудь знает, как создать 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;
1 ответ
Итак, я думаю, что после некоторого исследования я нашел способ справиться с этим.
Вам нужно привести ваш BitmapButton к его родительскому объекту (PropertyManagerPageControl), чтобы получить доступ к верхнему и левому свойствам. Затем вы можете установить пиксели на все, что вам нужно.
РЕДАКТИРОВАТЬ: Вот что у меня есть менеджер, чтобы сделать. Я также включаю код.
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;