private void EnsureItemIsFullyVisible(ItemType itemType, int itemIndex) { PointInt32 location = this.StackIndexToViewPoint(itemType, itemIndex); RectInt32 num2 = new RectInt32(location, new SizeInt32(this.ViewWidth, this.itemHeight)); int num3 = num2.Bottom - base.ClientSize.Height; int top = num2.Top; this.ScrollOffset = Int32Util.ClampSafe(this.ScrollOffset, num3, top); }
protected override void OnLayout(LayoutEventArgs levent) { if (base.Parent != null) { base.Parent.SuspendLayout(); if (levent.AffectedProperty == "Font") { this.cachedMaxWidthOfComboBoxItems = null; } Size clientSize = base.ClientSize; int num = UIUtil.ScaleHeight(4); this.header.SetBounds(0, 0, clientSize.Width, this.header.GetPreferredSize(new Size(clientSize.Width, 0)).Height); this.comboBox.Location = new Point(0, this.header.Bottom + num); int num3 = Int32Util.ClampSafe(Math.Max(this.GetMaxWidthOfComboBoxItems(), 1) + UIUtil.ScaleWidth(30), 1, clientSize.Width); this.comboBox.Width = num3; this.comboBox.PerformLayout(); this.descriptionText.Location = new Point(0, this.comboBox.Bottom + (string.IsNullOrEmpty(this.descriptionText.Text) ? 0 : num)); this.descriptionText.Width = clientSize.Width; this.descriptionText.Height = string.IsNullOrEmpty(this.descriptionText.Text) ? 0 : this.descriptionText.GetPreferredSize(new Size(clientSize.Width, 1)).Height; base.ClientSize = new Size(clientSize.Width, this.descriptionText.Bottom); base.OnLayout(levent); base.Parent.ResumeLayout(false); } }