本文整理汇总了C#中SelectionMode类的典型用法代码示例。如果您正苦于以下问题:C# SelectionMode类的具体用法?C# SelectionMode怎么用?C# SelectionMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SelectionMode类属于命名空间,在下文中一共展示了SelectionMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GraphicsEditor
public GraphicsEditor()
{
InitializeComponent();
CompositeTable = ProjectController.GraphicsManager.BuildPatternTable(0);
CmbPalettes.DisplayMember = "Name";
foreach (var p in ProjectController.PaletteManager.Palettes)
{
CmbPalettes.Items.Add(p);
}
CmbGraphics1.DisplayMember = CmbGraphics2.DisplayMember = CmbGraphics3.DisplayMember = CmbGraphics4.DisplayMember = "Name";
foreach (var g in ProjectController.GraphicsManager.GraphicsInfo)
{
CmbGraphics1.Items.Add(g);
CmbGraphics2.Items.Add(g);
CmbGraphics3.Items.Add(g);
CmbGraphics4.Items.Add(g);
}
CmbGraphics1.SelectedIndex = 0;
CmbGraphics2.SelectedIndex = 1;
CmbGraphics3.SelectedIndex = 2;
CmbGraphics4.SelectedIndex = 3;
CmbPalettes.SelectedIndex = 0;
PtvTileSelector.CurrentTable= CompositeTable;
SelectionMode = SelectionMode.Quarter;
PslView.SelectedIndexChanged += new EventHandler(PslView_SelectedIndexChanged);
PslView.SelectedOffsetChanged += new EventHandler(PslView_SelectedOffsetChanged);
PtvTileSelector.SelectionChanged += new EventHandler(PtvTileSelector_SelectionChanged);
PtvTileSelector.UpdateSelection();
}
示例2: OnWizardCreate
void OnWizardCreate()
{
if(includeChildren || excludePrefabs)
modePrefs=(SelectionMode.ExcludePrefab | SelectionMode.Editable | SelectionMode.Deep);
else
modePrefs=(SelectionMode.Editable);
Object[] objs = Selection.GetFiltered(typeof(GameObject), modePrefs);
foreach (GameObject go in objs)
{
go.renderer.material = material;
}
/* if you replace the above foreach with my version below, it seems to work well for cases where some children parts don't have a renderer:
foreach (GameObject go in objs)
{
if (go.renderer)
go.renderer.material = material;
}
*/
}
示例3: SelectionModel
/// <summary>
/// Represents a <see cref="Model"/> that executes the appropriate selection logic requested by different commands.
/// </summary>
public SelectionModel()
: base(NAME)
{
this.items = new List<object>(0);
this.SelectedItems = new SelectedItemsCollection();
this.selectionMode = SelectionMode.Extended;
this.ranges = new RangeCollection();
}
示例4: Selection
public Selection (DocumentLocation anchor, DocumentLocation lead, SelectionMode selectionMode = SelectionMode.Normal)
{
if (anchor.Line < DocumentLocation.MinLine || anchor.Column < DocumentLocation.MinColumn)
throw new ArgumentOutOfRangeException ("anchor", anchor + " is out of range.");
if (lead.Line < DocumentLocation.MinLine || lead.Column < DocumentLocation.MinColumn)
throw new ArgumentOutOfRangeException ("lead", lead + " is out of range.");
this.Anchor = anchor;
this.Lead = lead;
this.SelectionMode = selectionMode;
}
示例5: Selection
public Selection (DocumentLocation anchor, DocumentLocation lead, SelectionMode selectionMode)
{
if (anchor.Line < DocumentLocation.MinLine || anchor.Column < DocumentLocation.MinColumn)
throw new ArgumentException ("anchor");
if (lead.Line < DocumentLocation.MinLine || lead.Column < DocumentLocation.MinColumn)
throw new ArgumentException ("lead");
this.Anchor = anchor;
this.Lead = lead;
this.SelectionMode = selectionMode;
}
示例6: GeneticAlgorithm
public GeneticAlgorithm(int populationSize, int chromosomeLength, int numberOfGenerations, double crossoverRate, double mutationRate, EvaluationDelegate fitnessFunction, BoundPair[] genesDomain , int elitismFactor = 0, SelectionMode Selection = SelectionMode.RouletteWheel, bool PrintLogMode = false)
{
this.populationSize = populationSize;
this.chromosomeLength = chromosomeLength;
this.numberOfGenerations = numberOfGenerations;
this.crossoverRate = crossoverRate;
this.mutationRate = mutationRate;
this.fitnessFunction = fitnessFunction;
this.genesDomain = genesDomain;
this.elitismFactor = elitismFactor;
this.PrintLogMode = PrintLogMode;
}
示例7: RadioListBox
// Public constructor
public RadioListBox()
{
this.DrawMode = DrawMode.OwnerDrawFixed;
this.SelectionMode = SelectionMode.One;
this.ItemHeight = this.FontHeight;
this.Align = new StringFormat(StringFormat.GenericDefault);
this.Align.LineAlignment = StringAlignment.Center;
// Force transparent analisys
this.BackColor = this.BackColor;
}
示例8: DefaultListSelectionModel
/// <summary>
/// Creates a default implementation of ListSelectionModel interface.
/// </summary>
public DefaultListSelectionModel()
{
selectedIndices = new List<int>();
anchorIndex = -1;
leadIndex = -1;
maxIndex = -1;
minIndex = -1;
mode = SelectionMode.Single;
isAdjusting = false;
}
示例9: OnMouseDown
/// <summary>
/// ����������
/// </summary>
/// <param name="regionForm"></param>
/// <param name="e"></param>
public override void OnMouseDown(RegionForm regionForm, MouseEventArgs e)
{
wasMove = false;
selectMode = SelectionMode.None;
Point point = new Point(e.X, e.Y);
int handleNumber = regionForm.DrawRectangle.HitTest(point);
if (handleNumber > 0)
{
selectMode = SelectionMode.Size;
resizedObject = regionForm.DrawRectangle;
resizedObjectHandle = handleNumber;
}
if (selectMode == SelectionMode.None)
{
DrawRectangle o = null;
if (regionForm.DrawRectangle.HitTest(point) == 0)
{
o = regionForm.DrawRectangle;
}
if (o != null)
{
selectMode = SelectionMode.Move;
regionForm.Cursor = Cursors.SizeAll;
}
}
lastPoint.X = e.X;
lastPoint.Y = e.Y;
startPoint.X = e.X;
startPoint.Y = e.Y;
regionForm.Capture = true;
regionForm.Refresh();
}
示例10: OnMouseDoubleClick
//public tooltipForm tpform = new tooltipForm();
public override void OnMouseDoubleClick(DrawArea drawArea, MouseEventArgs e)
{
commandChangeState = null;
wasMove = false;
selectMode = SelectionMode.None;
Point point = drawArea.BackTrackMouse(new Point(e.X, e.Y));
// Test for resizing (only if control is selected, cursor is on the handle)
int al = drawArea.TheLayers.ActiveLayerIndex;
int n = drawArea.TheLayers[al].Graphics.SelectionCount;
// Test for move (cursor is on the object)
if (selectMode == SelectionMode.None)
{
int n1 = drawArea.TheLayers[al].Graphics.Count;
DrawObject o = null;
for (int i = 0; i < n1; i++)
{
if (drawArea.TheLayers[al].Graphics[i].HitTest(point) == 0)
{
o = drawArea.TheLayers[al].Graphics[i];
break;
}
}
if (o != null)
{
//if (drawArea.IsPainting)
//{
// o.editProperties();
//}
//else
//{
// o.showProperties();
//}
o.ShowPropertiesDialog();
drawArea.Refresh();
}
}
}
示例11: Click
public void Click(BaseEventData data) {
var pData = (PointerEventData)data;
if (pData.dragging)
return;
var pos = Camera.main.ScreenToWorldPoint(pData.position);
pos.z = Camera.main.transform.position.z;
var dir = new Vector3 (0, 0, 1);
var hit = Physics2D.Raycast (pos, dir, 100f, CellLayer);
if (hit) {
var cell = hit.transform.GetComponent<GridCell>();
if(!cell) return;
if(mSelectionMode == SelectionMode.CellInfo) {
if(cell == SelectedCell)
SelectedCell = null;
else
SelectedCell = cell;
}
else if(mSelectionMode == SelectionMode.DeployBomb) {
mBombToDeploy.Deploy(cell);
mSelectionMode = SelectionMode.CellInfo;
}
}
}
示例12: OnWizardCreate
void OnWizardCreate()
{
if (includeChildren || excludePrefabs)
modePrefs = (SelectionMode.ExcludePrefab | SelectionMode.Editable | SelectionMode.Deep);
else
modePrefs = (SelectionMode.Editable);
Object[] objs = Selection.GetFiltered(typeof(GameObject), modePrefs);
foreach (GameObject go in objs)
{
GameObject clone = PrefabUtility.InstantiatePrefab(prefab) as GameObject;
clone.name = prefab.name;
clone.transform.parent = go.transform.parent;
if (copyPosition)
{
clone.transform.localPosition = go.transform.localPosition;
}
if (copyRotation)
{
clone.transform.localRotation = go.transform.localRotation;
}
if (copyScale)
{
clone.transform.localScale = go.transform.localScale;
}
}
if (deleteSelectedObjects)
{
foreach (GameObject go in objs)
{
DestroyImmediate(go.gameObject);
}
}
}
示例13: GetFiltered
/// <summary>
/// <para>Returns the current selection filtered by type and mode.</para>
/// </summary>
/// <param name="type">Only objects of this type will be retrieved.</param>
/// <param name="mode">Further options to refine the selection.</param>
public static Object[] GetFiltered(Type type, SelectionMode mode)
{
ArrayList list = new ArrayList();
if ((type == typeof(Component)) || type.IsSubclassOf(typeof(Component)))
{
Transform[] transforms = GetTransforms(mode);
foreach (Transform transform in transforms)
{
Component component = transform.GetComponent(type);
if (component != null)
{
list.Add(component);
}
}
}
else if ((type == typeof(GameObject)) || type.IsSubclassOf(typeof(GameObject)))
{
Transform[] transformArray3 = GetTransforms(mode);
foreach (Transform transform2 in transformArray3)
{
list.Add(transform2.gameObject);
}
}
else
{
Object[] objectsMode = GetObjectsMode(mode);
foreach (Object obj2 in objectsMode)
{
if ((obj2 != null) && ((obj2.GetType() == type) || obj2.GetType().IsSubclassOf(type)))
{
list.Add(obj2);
}
}
}
return (Object[]) list.ToArray(typeof(Object));
}
示例14: InstantiateIn
/// <summary>
/// When implemented by a class, defines the <see cref="T:System.Web.UI.Control" /> object that child controls and templates belong to. These child controls are in turn defined within an inline template.
/// </summary>
/// <param name="container">The <see cref="T:System.Web.UI.Control" /> object to contain the instances of controls from the inline template.</param>
public void InstantiateIn( Control container )
{
var cell = container as DataControlFieldCell;
if (cell != null)
{
var selectField = cell.ContainingField as SelectField;
if ( selectField != null )
{
SelectionMode = selectField.SelectionMode;
DataVisibleField = selectField.DataVisibleField;
DataSelectedField = selectField.DataSelectedField;
DataTextField = selectField.DataTextField;
ColumnIndex = selectField.ColumnIndex;
CheckBox cb = null;
if ( SelectionMode == SelectionMode.Multiple )
{
cb = new CheckBox();
}
else
{
cb = new RockRadioButton();
}
cb.ID = "cbSelect_" + ColumnIndex.ToString();
cb.DataBinding += cb_DataBinding;
cell.Controls.Add( cb );
}
}
}
示例15: SetSelectionMode
/// <summary>
/// Set the selection mode for all three list boxes
/// </summary>
/// <param name="selectionMode"></param>
private void SetSelectionMode(SelectionMode selectionMode)
{
// workaround for the CollectionViewSource wrappers that are used for the different ListBox sorts
// setting SelectionMode to Multiple removes the issue where the SelectionChanged event handler gets
// invoked every time the list is changed (which triggers a resort). The SelectionMode gets reset back
// to Single when the SelectionChanged events handler gets called (for a valid reason - i.e. user action)
// mitigate the recursive behavior of setting the SelectionMode re-invoking the SelectionChanged event handler
bool disableState = disableListBoxSelectionChanged;
disableListBoxSelectionChanged = true;
ByNameListBox.SelectionMode = selectionMode;
ByDueListBox.SelectionMode = selectionMode;
ByPriListBox.SelectionMode = selectionMode;
// reset the disable state
disableListBoxSelectionChanged = disableState;
}