PC Review


Reply
Thread Tools Rate Thread

comboBox1_DrawItem......with icom

 
 
Supra
Guest
Posts: n/a
 
      28th Oct 2004
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


 
Reply With Quote
 
 
 
 
Supra
Guest
Posts: n/a
 
      28th Oct 2004
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
>
>


 
Reply With Quote
 
Supra
Guest
Posts: n/a
 
      28th Oct 2004
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
>>
>>

>


 
Reply With Quote
 
Supra
Guest
Posts: n/a
 
      28th Oct 2004
I solved again
thank alot


Supra wrote:

> 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
>>>
>>>

>>

>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
icom screen bob Microsoft Word Document Management 0 26th Mar 2009 07:05 PM
comboBox1_DrawItem ...overloaded resolution..... Supra Microsoft Dot NET 0 28th Oct 2004 01:29 PM
unneeded icom =?Utf-8?B?Y2FzaQ==?= Windows XP Configuration 1 22nd Jul 2004 10:18 PM
iCom Stealth *ProteanThread* Freeware 2 8th Jul 2004 10:59 PM
attachments have MY IMAGES ICOM gregg Microsoft Outlook 0 5th Dec 2003 01:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:32 PM.