private void RepresentationruleListBox_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { if (base.Items.Count != 0) { RepresentationruleListBox.RepresentationRuleWrap representationRuleWrap = (RepresentationruleListBox.RepresentationRuleWrap)base.Items[e.Index]; e.DrawBackground(); string s = "(" + representationRuleWrap.RuleID.ToString() + ") " + representationRuleWrap.Name; Brush brush = new SolidBrush(e.ForeColor); e.Graphics.DrawString(s, this.Font, brush, (float)e.Bounds.X, (float)e.Bounds.Y); brush.Dispose(); System.IntPtr hdc = e.Graphics.GetHdc(); IOutputContext outputContext = new OutputContext(); IPoint point = new ESRI.ArcGIS.Geometry.Point(); point.PutCoords((double)(e.Bounds.X + e.Bounds.Width / 2), (double)(e.Bounds.Y + e.Bounds.Height / 2 + 10)); tagRECT tagRECT_ = default(tagRECT); tagRECT_.left = e.Bounds.Left + 10; tagRECT_.right = e.Bounds.Right - 10; tagRECT_.top = e.Bounds.Top + 10; tagRECT_.bottom = e.Bounds.Bottom - 5; outputContext.Init(1.0, 1.5, 96.0, 0.0, point, ref tagRECT_, hdc.ToInt32()); IGeometry geometry; if (this.esriGeometryType_0 == esriGeometryType.esriGeometryPolygon) { geometry = this.method_1(tagRECT_); } else if (this.esriGeometryType_0 == esriGeometryType.esriGeometryPolyline) { geometry = this.method_2(tagRECT_); } else { geometry = new ESRI.ArcGIS.Geometry.Point(); (geometry as IPoint).PutCoords((double)((tagRECT_.left + tagRECT_.right) / 2), (double)((tagRECT_.top + tagRECT_.bottom) / 2)); } representationRuleWrap.RepresentationRule.Draw(-1, outputContext, geometry, geometry.Envelope); e.Graphics.ReleaseHdc(hdc); } }