本文整理汇总了C#中ISelectionService.SetSelectedComponents方法的典型用法代码示例。如果您正苦于以下问题:C# ISelectionService.SetSelectedComponents方法的具体用法?C# ISelectionService.SetSelectedComponents怎么用?C# ISelectionService.SetSelectedComponents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISelectionService
的用法示例。
在下文中一共展示了ISelectionService.SetSelectedComponents方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectItems
private void SelectItems(ToolStripDropDownItem oldSelection, ISelectionService selSvc)
{
ToolStripDropDown owner = (ToolStripDropDown) this.MenuItem.Owner;
int num = Math.Max(owner.Items.IndexOf(oldSelection), owner.Items.IndexOf(this.MenuItem));
int num2 = Math.Min(owner.Items.IndexOf(oldSelection), owner.Items.IndexOf(this.MenuItem));
ToolStripItem[] components = new ToolStripItem[(num - num2) + 1];
int index = 0;
while (num2 <= num)
{
components[index] = owner.Items[num2];
index++;
num2++;
}
selSvc.SetSelectedComponents(components);
}
示例2: CreatePage
internal static WizardPage CreatePage(Wizard parent, bool innerPage, IDesignerHost dh, IComponentChangeService cc, ISelectionService ss, eWizardStyle wizardStyle)
{
DesignerTransaction dt = dh.CreateTransaction();
WizardPage page=null;
try
{
page = dh.CreateComponent(typeof(WizardPage)) as WizardPage;
page.AntiAlias=false;
page.InteriorPage = innerPage;
if (innerPage)
{
page.PageTitle = "< Wizard step title >";
page.PageDescription = "< Wizard step description >";
}
if (wizardStyle == eWizardStyle.Default)
ApplyDefaultInnerPageStyle(page, dh, cc);
else if (wizardStyle == eWizardStyle.Office2007)
ApplyOffice2007InnerPageStyle(page, dh, cc);
//else
//{
// TypeDescriptor.GetProperties(page.Style)["BackColor"].SetValue(page.Style, Color.White);
//}
if (cc != null)
cc.OnComponentChanging(parent, TypeDescriptor.GetProperties(parent)["WizardPages"]);
parent.WizardPages.Add(page);
if (cc != null)
cc.OnComponentChanged(parent, TypeDescriptor.GetProperties(parent)["WizardPages"], null, null);
if (ss != null)
ss.SetSelectedComponents(new WizardPage[] { page }, SelectionTypes.Replace);
TypeDescriptor.GetProperties(parent)["SelectedPageIndex"].SetValue(parent, parent.WizardPages.IndexOf(page));
}
catch
{
dt.Cancel();
}
finally
{
if (!dt.Canceled)
dt.Commit();
}
return page;
}
示例3: CreateWelcomePage
internal static WizardPage CreateWelcomePage(Wizard parent, IDesignerHost dh, IComponentChangeService cc, ISelectionService ss, eWizardStyle style)
{
DesignerTransaction dt = dh.CreateTransaction();
WizardPage page = null;
try
{
page = dh.CreateComponent(typeof(WizardPage)) as WizardPage;
if(style == eWizardStyle.Default)
ApplyDefaultWelcomePageStyle(page, null, null);
else
ApplyOffice2007WelcomePageStyle(page, null, null);
//TypeDescriptor.GetProperties(page)["InteriorPage"].SetValue(page, false);
//TypeDescriptor.GetProperties(page)["BackColor"].SetValue(page, Color.White);
//TypeDescriptor.GetProperties(page)["CanvasColor"].SetValue(page, Color.White);
//TypeDescriptor.GetProperties(page.Style)["BackColor"].SetValue(page.Style, Color.White);
//TypeDescriptor.GetProperties(page.Style)["BackgroundImage"].SetValue(page.Style, GetWelcomeImage(false));
//TypeDescriptor.GetProperties(page.Style)["BackgroundImagePosition"].SetValue(page.Style, eStyleBackgroundImage.TopLeft);
page.Size = new Size(534, 289);
// Load labels onto the page, first Welcome to the Wizard...
System.Windows.Forms.Label label = dh.CreateComponent(typeof(System.Windows.Forms.Label)) as System.Windows.Forms.Label;
page.Controls.Add(label);
label.Location = new Point(210, 18);
label.Text = "Welcome to the <Wizard Name> Wizard";
label.BackColor = Color.Transparent;
try
{
label.Font = new Font("Tahoma", 16);
TypeDescriptor.GetProperties(label)["AutoSize"].SetValue(label, false);
}
catch { }
label.Size = new Size(310, 66);
label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
// Wizard description label...
label = dh.CreateComponent(typeof(System.Windows.Forms.Label)) as System.Windows.Forms.Label;
page.Controls.Add(label);
label.Location = new Point(210, 100);
label.Text = "This wizard will guide you through the <Enter Process Name>.\r\n\r\n<Enter brief description of the process wizard is covering.>";
label.BackColor = Color.Transparent;
try
{
TypeDescriptor.GetProperties(label)["AutoSize"].SetValue(label, false);
}
catch { }
label.Size = new Size(309, 157);
label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
// Click Next to Continue label...
label = dh.CreateComponent(typeof(System.Windows.Forms.Label)) as System.Windows.Forms.Label;
page.Controls.Add(label);
label.Location = new Point(210, 266);
label.Text = "To continue, click Next.";
label.Size = new Size(120, 13);
label.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
label.BackColor = Color.Transparent;
if (cc != null)
cc.OnComponentChanging(parent, TypeDescriptor.GetProperties(parent)["WizardPages"]);
parent.WizardPages.Add(page);
if (cc != null)
cc.OnComponentChanged(parent, TypeDescriptor.GetProperties(parent)["WizardPages"], null, null);
if (ss != null)
ss.SetSelectedComponents(new WizardPage[] { page }, SelectionTypes.Replace);
TypeDescriptor.GetProperties(parent)["SelectedPageIndex"].SetValue(parent, parent.WizardPages.IndexOf(page));
}
catch
{
dt.Cancel();
}
finally
{
if (!dt.Canceled)
dt.Commit();
}
return page;
}
示例4: GotoPage
internal static void GotoPage(Wizard w, IComponentChangeService cc, ISelectionService ss)
{
if (w == null)
return;
WizardPageOrderDialog d = new WizardPageOrderDialog();
d.SetWizard(w);
d.StartPosition = FormStartPosition.CenterScreen;
if (d.ShowDialog() == DialogResult.OK)
{
string pageName = d.SelectedPageName;
if (d.OrderChanged)
{
if (cc != null)
cc.OnComponentChanging(w, TypeDescriptor.GetProperties(w)["WizardPages"]);
string[] newOrder = d.OrderedPageNames;
w.WizardPages.IgnoreEvents = true;
try
{
WizardPageCollection col = new WizardPageCollection();
w.WizardPages.CopyTo(col);
w.WizardPages.Clear();
foreach (string pn in newOrder)
w.WizardPages.Add(col[pn]);
}
finally
{
w.WizardPages.IgnoreEvents = false;
}
if (cc != null)
cc.OnComponentChanged(w, TypeDescriptor.GetProperties(w)["WizardPages"], null, null);
}
if (pageName != "")
w.SelectedPage = w.WizardPages[pageName];
else if (d.OrderChanged)
w.SelectedPageIndex = 0;
if (ss != null && (pageName!="" || d.OrderChanged))
ss.SetSelectedComponents(new WizardPage[] { w.SelectedPage }, SelectionTypes.Replace);
}
d.Dispose();
}
示例5: SelectPageInProperyGrid
private void SelectPageInProperyGrid(ISelectionService selection)
{
selection.SetSelectedComponents(new object[] {_wizard.CurrentPage}, SelectionTypes.MouseDown);
}
示例6: CreatePage
internal static PageSliderPage CreatePage(PageSlider parent, IDesignerHost dh, IComponentChangeService cc, ISelectionService ss)
{
DesignerTransaction dt = dh.CreateTransaction();
PageSliderPage page = null;
try
{
page = dh.CreateComponent(typeof(PageSliderPage)) as PageSliderPage;
if (cc != null)
cc.OnComponentChanging(parent, TypeDescriptor.GetProperties(parent)["Controls"]);
parent.Controls.Add(page);
if (cc != null)
cc.OnComponentChanged(parent, TypeDescriptor.GetProperties(parent)["Controls"], null, null);
if (ss != null)
ss.SetSelectedComponents(new PageSliderPage[] { page }, SelectionTypes.Replace);
TypeDescriptor.GetProperties(parent)["SelectedPage"].SetValue(parent, page);
}
catch
{
dt.Cancel();
}
finally
{
if (!dt.Canceled)
dt.Commit();
}
return page;
}