Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / October 2004

Tip: Looking for answers? Try searching our database.

comboBox1_DrawItem......with icom

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Supra - 28 Oct 2004 14:29 GMT
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
Supra - 28 Oct 2004 20:10 GMT
i soloved problem by using pointF
regards

> in vc.net...
> private void comboBox1_DrawItem(object sender, DrawItemEventArgs e)
[quoted text clipped - 33 lines]
> regards,
> supra
Supra - 28 Oct 2004 20:22 GMT
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

> i soloved problem by using pointF
> regards
[quoted text clipped - 36 lines]
>> regards,
>> supra
Supra - 28 Oct 2004 21:12 GMT
I solved again
thank alot

> i got error problem........the error is:
> Additional information: Specified argument was out of the range of
[quoted text clipped - 48 lines]
>>> regards,
>>> supra

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.