Example #1
0
 private void ReadControlLocation(MemoryInputStream stream, ref JORControlLocation location)
 {
     location.X      = stream.ReadS16();
     location.Y      = stream.ReadS16();
     location.Width  = stream.ReadS16();
     location.Height = stream.ReadS16();
 }
Example #2
0
        private void LayoutControl(Control control, ref int x, ref int y, JORControlLocation location)
        {
            int height = location.Height;

            control.Font = new System.Drawing.Font("Consolas", 12);

            // Provided height is not enough in the Label case, it seems...
            if (control is Label && !String.IsNullOrEmpty(control.Text))
            {
                height = (int)((float)height * 1.5f);
            }

            // add some extra padding
            height += 6;

            if (location.Y < 0)
            {
                control.Top = y;
                y          += height;
            }
            else
            {
                control.Top = location.Y;
            }

            if (location.X < 0)
            {
                control.Left = 0;
            }
            else
            {
                control.Left = location.X;
            }

            control.Width  = location.Width;
            control.Height = height;
        }