i got error problem........the error is:
Additional information: Specified argument was out of the range of valid
values.
g.DrawString(ComboBox2.Items(e.Index).ToString(), e.Font, New
SolidBrush(e.ForeColor), New PointF(28, (bmp.Height - e.Font.Height)/2))
i got icon working on dropdownlist but no text dispalying . does ne 1
knows how to get text displayed?
regards,
supra
Supra wrote:
> i soloved problem by using pointF
> regards
>
> Supra wrote:
>
>> in vc.net...
>> private void comboBox1_DrawItem(object sender, DrawItemEventArgs e)
>> {
>> Bitmap bmp = new Bitmap(e.Bounds.Width,e.Bounds.Height,e.Graphics);
>> Graphics g = Graphics.FromImage(bmp);
>>
>> g.FillRectangle(new SolidBrush(e.BackColor), new
>> Rectangle(0,0,bmp.Width,bmp.Height));
>> g.DrawString(comboBox1.Items[e.Index].ToString(),e.Font ,new
>> SolidBrush(e.ForeColor), new Point(28,(bmp.Height-e.Font.Height)/2));
>> g.DrawImage(imageList1.Images[e.Index], new Rectangle(new
>> Point(6,0),new Size(16,16)));
>> e.Graphics.DrawImage(bmp,e.Bounds.X,e.Bounds.Y);
>> }
>>
>> convert to vb.net ................and i still got error problem for
>> drawstring and drawimage. i set drawmode to onwerdrawfixed and
>> dropdownstyle to dropdownlist
>>
>> Private Sub comboBox1_DrawItem(ByVal sender As Object, ByVal e As
>> DrawItemEventArgs) Handles ComboBox1.DrawItem
>> Dim bmp As Bitmap = New
>> Bitmap(e.Bounds.Width,e.Bounds.Height,e.Graphics)
>> Dim g As Graphics = Graphics.FromImage(bmp)
>>
>> g.FillRectangle(New SolidBrush(e.BackColor), New
>> Rectangle(0,0,bmp.Width,bmp.Height))
>> g.DrawString(comboBox1.Items(e.Index).ToString(),e.Font ,New
>> SolidBrush(e.ForeColor), New Point(28,(bmp.Height-e.Font.Height)/2))
>> g.DrawImage(imageList1.Images(e.Index), New Rectangle(New
>> Point(6,0),New Size(16,16)))
>> e.Graphics.DrawImage(bmp,e.Bounds.X,e.Bounds.Y)
>> End Sub
>>
>> does ne 1 know how to fix problem?
>> regards,
>> supra
>>
>>
>
|