public void AlignmentStyle_GetSet_Properties() { // Arrange var horizontal = HorizontalAlignment.Center; var indent = 10; var readingOrder = ReadingOrder.LeftToRight; var rotate = 0; var shrinkToFit = false; var vertical = VerticalAlignment.Center; var verticalText = false; var wrapText = true; var style = new AlignmentStyle(); // Act style.Horizontal = horizontal; style.Indent = indent; style.ReadingOrder = readingOrder; style.Rotate = rotate; style.ShrinkToFit = shrinkToFit; style.Vertical = vertical; style.VerticalText = verticalText; style.WrapText = wrapText; // Assert Assert.AreEqual(horizontal, style.Horizontal); Assert.AreEqual(indent, style.Indent); Assert.AreEqual(readingOrder, style.ReadingOrder); Assert.AreEqual(rotate, style.Rotate); Assert.AreEqual(shrinkToFit, style.ShrinkToFit); Assert.AreEqual(vertical, style.Vertical); Assert.AreEqual(verticalText, style.VerticalText); Assert.AreEqual(wrapText, style.WrapText); }
public static void Align(this Control Control, AlignmentStyle Style, int Padding) { Control.Parent.SuspendLayout(); switch (Style) { case AlignmentStyle.Center: Control.Location = new Point((Control.Parent.Width - Control.Width) / 2, Control.Location.Y); break; case AlignmentStyle.MiddleLeft: Control.Location = new Point(Padding, (Control.Parent.Height - Control.Height) / 2); break; case AlignmentStyle.MiddleRight: Control.Location = new Point(Control.Parent.Width - Control.Width - Padding, (Control.Parent.Height - Control.Height) / 2); break; case AlignmentStyle.MiddleCenter: Control.Location = new Point((Control.Parent.Width - Control.Width) / 2, (Control.Parent.Height - Control.Height) / 2); break; } Control.Parent.ResumeLayout(false); }
getAlignmentStyle(string name) { ObjectId idStyle = ObjectId.Null; AlignmentStyleCollection styles = BaseObjs._civDoc.Styles.AlignmentStyles; try { using (Transaction tr = BaseObjs.startTransactionDb()) { foreach (ObjectId id in styles) { AlignmentStyle style = (AlignmentStyle)tr.GetObject(id, OpenMode.ForRead); if (style.Name == name) { idStyle = style.ObjectId; } break; } tr.Commit(); } } catch (System.Exception ex) { BaseObjs.writeDebug(string.Format("{0} Align_Style.cs: line: 96", ex.Message)); } return(idStyle); }
public void AlignmentStyle_OuterXml() { // Arrange var horizontal = HorizontalAlignment.Center; var indent = 10; var readingOrder = ReadingOrder.LeftToRight; var rotate = 0; var shrinkToFit = false; var vertical = VerticalAlignment.Center; var verticalText = false; var wrapText = true; var style = new AlignmentStyle(); style.Horizontal = horizontal; style.Indent = indent; style.ReadingOrder = readingOrder; style.Rotate = rotate; style.ShrinkToFit = shrinkToFit; style.Vertical = vertical; style.VerticalText = verticalText; style.WrapText = wrapText; // Act var xml = style.OuterXml; // Assert Assert.IsNotNull(xml); }
void Update() { //修改颜色 if (_cColor != m_cColor) { _cColor = m_cColor; foreach (Transform child in this.transform) { if (child != null) { child.GetComponent <UISprite>().color = _cColor; } } } //修改对齐方式 if (_AlignmentStyle != m_AlignmentStyle || _fPerNumDistance != m_fPerNumDistance) { _fPerNumDistance = m_fPerNumDistance; _AlignmentStyle = m_AlignmentStyle; SwitchFistPos(); for (int i = 0; i < m_lGameNumlist.Count; i++) { float temp_X = m_vFistPos.x - i * (m_fPerNumDistance + _iPerNumWidth); m_lGameNumlist[i].transform.localPosition = new Vector3(temp_X, 0, 0); } } //修改宽高 if (_iPerNumWidth != m_iPerNumWidth) { _iPerNumWidth = m_iPerNumWidth; foreach (Transform child in this.transform) { if (child != null) { child.GetComponent <UIWidget>().width = _iPerNumWidth; } } } if (_iPerNumHeight != m_iPerNumHeight) { _iPerNumHeight = m_iPerNumHeight; foreach (Transform child in this.transform) { if (child != null) { child.GetComponent <UIWidget>().height = _iPerNumHeight; } } } //修改数值 if (_iNum != m_iNum) { _iNum = m_iNum; SwitchFistPos(); SetNum(); } }
public void AlignmentStyle_CreateNew() { // Arrange // Act var style = new AlignmentStyle(); // Assert Assert.IsNotNull(style); }
public void AlignmentStyle_OuterXml_EmptyXml() { // Arrange var style = new AlignmentStyle(); // Act var xml = style.OuterXml; // Assert Assert.IsTrue(string.IsNullOrWhiteSpace(xml)); }
public void AlignmentStyle_VerticalTextProperty_TrueValue() { // Arrange var verticalText = true; var style = new AlignmentStyle(); // Act style.VerticalText = verticalText; // Assert Assert.AreEqual(verticalText, style.VerticalText); }
public void AlignmentStyle_ShrinkToFitProperty_TrueValue() { // Arrange var shrinkToFit = true; var style = new AlignmentStyle(); // Act style.ShrinkToFit = shrinkToFit; // Assert Assert.AreEqual(shrinkToFit, style.ShrinkToFit); }
public void AlignmentStyle_WrapTextProperty_FalseValue() { // Arrange var wrapText = false; var style = new AlignmentStyle(); // Act style.WrapText = wrapText; // Assert Assert.AreEqual(wrapText, style.WrapText); }
public DataEnt(TxTDrawStyle style, string value, string fieldName //, string fontName, int fontValue, int fontStyle) , Font font, int alignmentIndex) { _Style = style; _Value = value; _FieldName = fieldName; //_FontName = fontName; //_FontValue = fontValue; //_FontStyle = (TxTFontStyle)fontStyle; _Font = font; _Alignment = (AlignmentStyle)alignmentIndex; }
createAlignStyle(string name) { ObjectId idStyle = ObjectId.Null; try { idStyle = BaseObjs._civDoc.Styles.AlignmentStyles.Add(name); } catch (System.Exception ex) { BaseObjs.writeDebug(string.Format("{0} Align_Style.cs: line: 18", ex.Message)); } AlignmentStyle style = null; if (idStyle != ObjectId.Null) { try { using (Transaction tr = BaseObjs.startTransactionDb()) { style = (AlignmentStyle)tr.GetObject(idStyle, OpenMode.ForWrite); style.GetDisplayStyleModel(AlignmentDisplayStyleType.Arrow).Visible = false; // Do not show direction arrows. Styles do not govern // the size of direction arrows - that is done in the // ambient settings. style.GetDisplayStyleModel(AlignmentDisplayStyleType.Arrow).Visible = false; style.GetDisplayStylePlan(AlignmentDisplayStyleType.Arrow).Visible = false; // Display curves using violet. style.GetDisplayStyleModel(AlignmentDisplayStyleType.Curve).Color = Autodesk.AutoCAD.Colors.Color.FromRgb(191, 0, 255); // violet style.GetDisplayStylePlan(AlignmentDisplayStyleType.Curve).Color = Autodesk.AutoCAD.Colors.Color.FromRgb(191, 0, 255); // violet style.GetDisplayStyleModel(AlignmentDisplayStyleType.Curve).Visible = true; style.GetDisplayStylePlan(AlignmentDisplayStyleType.Curve).Visible = true; // Display straight sections in blue. style.GetDisplayStyleModel(AlignmentDisplayStyleType.Line).Color = Autodesk.AutoCAD.Colors.Color.FromRgb(0, 0, 255); // blue style.GetDisplayStylePlan(AlignmentDisplayStyleType.Line).Color = Autodesk.AutoCAD.Colors.Color.FromRgb(0, 0, 255); // blue style.GetDisplayStyleModel(AlignmentDisplayStyleType.Line).Visible = true; style.GetDisplayStylePlan(AlignmentDisplayStyleType.Line).Visible = true; style.EnableRadiusSnap = true; tr.Commit(); } } catch (System.Exception ex) { BaseObjs.writeDebug(string.Format("{0} Align_Style.cs: line: 48", ex.Message)); } } return(idStyle); }
private Point GetScalePoint(double value, AlignmentStyle alignment) { int num = 0; switch (alignment) { case AlignmentStyle.Center: num += base.TickMajor.Length / 2; break; case AlignmentStyle.Far: num += base.TickMajor.Length; break; } int num2 = this.ValueToPixels(value); int num3 = (this.Direction != 0) ? (base.EdgeRef - num) : (base.EdgeRef + num); if (this.Orientation == Orientation.Vertical) { return(new Point(num3, num2)); } return(new Point(num2, num3)); }
getAlignStyles() { List <string> alignStyles = new List <string>(); AlignmentStyleCollection styles = BaseObjs._civDoc.Styles.AlignmentStyles; try { using (Transaction tr = BaseObjs.startTransactionDb()) { foreach (ObjectId id in styles) { AlignmentStyle style = (AlignmentStyle)tr.GetObject(id, OpenMode.ForRead); alignStyles.Add(style.Name); } tr.Commit(); } } catch (System.Exception ex) { BaseObjs.writeDebug(string.Format("{0} Align_Style.cs: line: 96", ex.Message)); } return(alignStyles); }
void Update() { m_fWorkTime += Time.deltaTime; //定时器设置 if (m_bIsTimer && m_bIsOpen && m_fWorkTime >= m_fSpeed && m_iNum >= 0) { m_iNum -= 1; if (m_iLimitTime >= m_iNum) { // CMusicManger_JSYS._instance.PlayTimerSound(); } if (m_iNum == 0) { m_bIsOpen = false; if (m_OnChange != null) { m_OnChange(); } } m_fWorkTime = 0; } //修改颜色 if (_cColor != m_cColor) { _cColor = m_cColor; foreach (Transform child in this.transform) { if (child != null) { child.GetComponent <UISprite>().color = _cColor; } } } //修改对齐方式 if (_AlignmentStyle != m_AlignmentStyle || _fPerNumDistance != m_fPerNumDistance) { _fPerNumDistance = m_fPerNumDistance; _AlignmentStyle = m_AlignmentStyle; SwitchFistPos(); for (int i = 0; i < m_lGameNumlist.Count; i++) { float temp_X = m_vFistPos.x - i * (m_fPerNumDistance + _iPerNumWidth); m_lGameNumlist[i].transform.localPosition = new Vector3(temp_X, 0, 0); } } //修改宽高 if (_iPerNumWidth != m_iPerNumWidth) { _iPerNumWidth = m_iPerNumWidth; foreach (Transform child in this.transform) { if (child != null) { child.GetComponent <UIWidget>().width = _iPerNumWidth; } } } if (_iPerNumHeight != m_iPerNumHeight) { _iPerNumHeight = m_iPerNumHeight; foreach (Transform child in this.transform) { if (child != null) { child.GetComponent <UIWidget>().height = _iPerNumHeight; } } } //修改数值 if (_iNum != m_iNum) { _iNum = m_iNum; SwitchFistPos(); SetNum(); } }
void Update() { m_fWorkTime += Time.deltaTime; if (m_bIsOpen && m_bIsTimer && m_fWorkTime >= 1.0f && m_iNum > 0) { m_iNum -= 1; if (m_iNum == 0) { if (m_TimerOnChange != null) { m_TimerOnChange(); } // 倒计时结束关闭状态 Stop_Timer(); } m_fWorkTime = 0; } //修改颜色 if (_cColor != m_cColor) { _cColor = m_cColor; foreach (Transform child in this.transform) { if (child != null) { child.GetComponent <UISprite>().color = _cColor; } } } //修改对齐方式 if (_AlignmentStyle != m_AlignmentStyle || _fPerNumDistance != m_fPerNumDistance) { _fPerNumDistance = m_fPerNumDistance; _AlignmentStyle = m_AlignmentStyle; SwitchFistPos(); for (int i = 0; i < m_lGameNumlist.Count; i++) { float temp_X = m_vFistPos.x - i * (m_fPerNumDistance + _iPerNumWidth); m_lGameNumlist[i].transform.localPosition = new Vector3(temp_X, 0, 0); } } //修改宽高 if (_iPerNumWidth != m_iPerNumWidth) { _iPerNumWidth = m_iPerNumWidth; foreach (Transform child in this.transform) { if (child != null) { child.GetComponent <UIWidget>().width = _iPerNumWidth; } } } if (_iPerNumHeight != m_iPerNumHeight) { _iPerNumHeight = m_iPerNumHeight; foreach (Transform child in this.transform) { if (child != null) { child.GetComponent <UIWidget>().height = _iPerNumHeight; } } } //修改数值 if (_iNum != m_iNum || m_strTextureName != _strTextureName) { _iNum = m_iNum; SwitchFistPos(); SetNum(); } }