/// <summary> /// Päivittää koon valueita. Jos koko on fixed, päivittää /// percent valueita, jos koko on percent, päivittää sizen /// valueta. /// </summary> /// <param name="parentSize">Parentin koko jota tarvitaan päivityksien tekemisessä.</param> public void Transform(ControlSize parentSize) { switch (Type) { case SizeType.Fixed: heightPercent = size.Height / parentSize.Height * 100; widthPercent = size.Width / parentSize.Width * 100; break; case SizeType.Percent: float onePercent_Width = parentSize.Width / 100; onePercent_Width = (onePercent_Width == 0 ? 1 : onePercent_Width); float width = onePercent_Width * widthPercent; float onePercent_Height = parentSize.Height / 100; onePercent_Height = (onePercent_Height == 0 ? 1 : onePercent_Height); float height = onePercent_Height * heightPercent; size = new Size((int)width, (int)height); break; } }
public Control() { // Asettaa vakio alingmentin. alingment = new Alingment() { Horizontal = HorizontalAlingment.None, Vertical = VerticalAlingment.None }; // Asettaa vakio värit. colors = new Colors() { Foreground = Color.Black, Background = Color.White }; FocusIndex = Index.Empty; size = ControlSize.Default(); position = ControlPosition.Default(); updateActions = new List <Action <Control> >(); Effects = new EffectContainer(); MakeDispatchers(); }