コード例 #1
0
        /// <summary>
        /// Override the parent, calculate the label number, than draw
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="rm"></param>
        public override void Draw(Graphics graphics, RenderMode rm)
        {
            graphics.SmoothingMode      = SmoothingMode.HighQuality;
            graphics.InterpolationMode  = InterpolationMode.HighQualityBicubic;
            graphics.CompositingQuality = CompositingQuality.HighQuality;
            graphics.PixelOffsetMode    = PixelOffsetMode.None;
            graphics.TextRenderingHint  = TextRenderingHint.AntiAliasGridFit;
            string    text      = ((Surface)Parent).CountStepLabels(this).ToString();
            Rectangle rect      = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);
            Color     fillColor = GetFieldValueAsColor(FieldType.FILL_COLOR);
            Color     lineColor = GetFieldValueAsColor(FieldType.LINE_COLOR);

            if (_drawAsRectangle)
            {
                RectangleContainer.DrawRectangle(rect, graphics, rm, 0, Color.Transparent, fillColor, false);
            }
            else
            {
                EllipseContainer.DrawEllipse(rect, graphics, rm, 0, Color.Transparent, fillColor, false);
            }
            using (FontFamily fam = new FontFamily(FontFamily.GenericSansSerif.Name))
            {
                using (Font _font = new Font(fam, fontSize, FontStyle.Bold, GraphicsUnit.Pixel))
                {
                    TextContainer.DrawText(graphics, rect, 0, lineColor, false, _stringFormat, text, _font);
                }
            }
        }
コード例 #2
0
        public override bool ClickableAt(int x, int y)
        {
            Rectangle rect      = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);
            Color     fillColor = GetFieldValueAsColor(FieldType.FILL_COLOR);

            if (_drawAsRectangle)
            {
                return(RectangleContainer.RectangleClickableAt(rect, 0, fillColor, x, y));
            }
            else
            {
                return(EllipseContainer.EllipseClickableAt(rect, 0, fillColor, x, y));
            }
        }
コード例 #3
0
		public void Test()
		{

			FieldType t = FieldType.LINE_THICKNESS;

			Surface s = new Surface();
			FieldAggregator ep = new FieldAggregator();
			//ep.SetFieldValue(t,598);

			RectangleContainer rc = new RectangleContainer(s);
			rc.SetFieldValue(t,597);
			//Assert.AreNotEqual(ep.GetField(t), rc.GetField(t));
			ep.BindElement(rc);
			Assert.AreEqual(597, ep.GetField(t).Value);
			Assert.AreEqual(597, rc.GetField(t).Value);
			
			RectangleContainer rc2 = new RectangleContainer(s);
			Assert.AreEqual(597, ep.GetField(t).Value);
			rc2.SetFieldValue(t,595);
			Assert.AreEqual(595, rc2.GetField(t).Value);
			ep.BindElement(rc2);
			Assert.AreEqual(595, ep.GetField(t).Value);
			Assert.AreEqual(597, rc.GetField(t).Value);
			
			RectangleContainer rc3 = new RectangleContainer(s);
			rc3.SetFieldValue(t,600);
			ep.BindElement(rc3);
			
			//Assert.AreEqual(600, ep.GetField(t).Value);
			Assert.AreEqual(600, rc3.GetField(t).Value);
			Assert.AreEqual(597, rc.GetField(t).Value);
			
			ep.SetFieldValue(t, 599);
			Assert.AreEqual(599, ep.GetField(t).Value);
			Assert.AreEqual(599, rc.GetField(t).Value);
			Assert.AreEqual(599, rc2.GetField(t).Value);
			Assert.AreEqual(599, rc3.GetField(t).Value);
			
			
			
			
			
		}