internal void OnItemChange(object sender, ItemEventArgsType e, ComboBoxArgs args) { ListItem item = (ListItem)sender; ItemTemplate template = this.GetTemplate(item); switch (e) { case ItemEventArgsType.Selection: if (this.m_selectedItem != null) { ListItem selectedItem = this.m_selectedItem; this.m_selectedItem = null; if (selectedItem != item) { selectedItem.Selected = false; } } this.m_selectedItem = item; return; case ItemEventArgsType.TemplateIndex: { ComboBoxIndexChangedArgs args2 = args as ComboBoxIndexChangedArgs; if (args2 == null) { throw new ArgumentException("Wrong argument type. args must be of type ComboBoxIndexChangedArgs.", "args"); } int d = -this.GetTemplate(item, args2.OldTemplateIndex).GetHeight(item); item.ResetCachedBounds(); d += template.GetHeight(item); this.OnChanged(this, ComboBoxEventArgsType.Resize, new ComboBoxScrollArgs(d, base.List.IndexOf(item))); return; } } if (template.AutoHeight) { int actualHeight = item.ActualHeight; item.ResetCachedBounds(); int height = template.GetHeight(item); if (height != actualHeight) { this.OnChanged(this, ComboBoxEventArgsType.Resize, new ComboBoxScrollArgs(height - actualHeight, base.List.IndexOf(item))); return; } } this.OnChanged(this, ComboBoxEventArgsType.ItemChange, new ComboBoxScrollArgs(0, base.List.IndexOf(item))); }
internal int Draw(Graphics gr, TemplateSet ts, int width, int ymax, int iItem, int iItemOffset, ref bool resetScrollbar) { int num = (((this.Parent != null) && this.Parent.RightToLeft) && this.Parent.List.ScrollbarVisible) ? this.Parent.List.ClientScrollbarWidth : 0; int yOffset = iItemOffset; int count = base.List.Count; this.LastDrawnItemOffset = yOffset; this.LastDrawnItem = iItem; while (this.LastDrawnItem < count) { ListItem item = null; if ((this.LastDrawnItem >= 0) && (this.LastDrawnItem < base.InnerList.Count)) { item = base.InnerList[this.LastDrawnItem] as ListItem; } if (item != null) { ItemTemplate template = item.GetTemplate(ts); int height = 0; int num5 = -1; if (template.CustomizeCells(item)) { num5 = template.GetHeight(item); item.ResetCachedBounds(); } height = template.GetHeight(item); if ((num5 >= 0) && (height != num5)) { resetScrollbar = true; } if ((yOffset + height) >= 0) { template.Draw(gr, 0, yOffset, item, width, height); } this.LastDrawnItemOffset = yOffset; yOffset += height; if (this.Parent.List.GridLines) { gr.DrawLine(this.m_penBorder, num, yOffset, width + num, yOffset); yOffset++; } if (yOffset > ymax) { return(yOffset); } } this.LastDrawnItem++; } this.LastDrawnItemOffset = yOffset; return(yOffset); }