倾家荡产:10分!!!拜求一个小问题!快来帮忙了。快呀。救命先!!

youngby 2004-02-06 04:03:46
private void comboBox1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
{
//Lets highlight the currently selected item like any well behaved combo box should
e.Graphics.FillRectangle(Brushes.Bisque, e.Bounds);
e.Graphics.DrawString(arr[e.Index], myFont, Brushes.Blue, new Point(imageArr[e.Index].Width*2,e.Bounds.Y));
e.Graphics.DrawImage(imageArr[e.Index], new Point(e.Bounds.X, e.Bounds.Y));

//is the mouse hovering over a combobox item??
if((e.State & DrawItemState.Focus)==0)
{
//this code keeps the last item drawn from having a Bisque background.
e.Graphics.FillRectangle(Brushes.White, e.Bounds);
e.Graphics.DrawString(arr[e.Index], myFont, Brushes.Blue, new Point(imageArr[e.Index].Width*2,e.Bounds.Y));
e.Graphics.DrawImage(imageArr[e.Index], new Point(e.Bounds.X, e.Bounds.Y));
}
}


以上代码要我改成以下的VB.NET的,我改不出来。救命呀!
比如以下的。哪里不对呢?


Private Sub ComboBox1_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles ComboBox1.DrawItem
'Dim myPoint As PointF
' myPoint = New PointF(imageArr(e.Index).Width * 2, e.Bounds.Y)
e.Graphics.FillRectangle(Brushes.Bisque, e.Bounds)
e.Graphics.DrawString(arr(e.Index), myFont, Brushes.Blue, New PointF(imageArr(e.Index).Width * 2, e.Bounds.Y))
e.Graphics.DrawImage(imageArr(e.Index), New Point(e.Bounds.X, e.Bounds.Y))

If ((e.State And DrawItemState.Focus) = 0) Then
'//this code keeps the last item drawn from a Bisque backgroud
e.Graphics.FillRectangle(Brushes.White, e.Bounds)
e.Graphics.DrawString(arr(e.Index), myFont, Brushes.Blue, New PointF(imageArr(e.Index).Width * 2, e.Bounds.Y))
e.Graphics.DrawImage(imageArr(e.Index), New Point(e.Bounds.X, e.Bounds.Y))

End If
End Sub
...全文
21 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复

110,545

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧