By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,890 Members | 1,097 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,890 IT Pros & Developers. It's quick & easy.

GDI+ ownerdrawn troubles

P: n/a
Hi,

I'm having some trouble drawing items in controls that I've marked as
ownerdrawn.
I'm currently developing an application that has ownerdrawn statusbar
panels, and a listbox that contains ownerdrawn items.

Both controls behave irratically:

The statusbar panels draw fine (the point is to draw an image in them),
EXCEPT when the form they statusbar is in is maximized. In that case, any
FillRectangle calls I make to the graphics object provided in the DrawItem
event are executed flawlessly, but any DrawRectangle or DrawImage methods
are seemingly not executed. (i.e. I don't see the image, and Rectangles are
partially drawn)

The ListBox has similar issues, except the items NEVER draw correctly :o(

Below is the code I use for the StatusBar Panels:

Private Sub StatusBar1_DrawItem(ByVal sender As Object, ByVal sbdevent As
System.Windows.Forms.StatusBarDrawItemEventArgs) Handles StatusBar1.DrawItem

Dim oImage As Image

If sbdevent.Panel Is StatusBar1.Panels(1) Then
Select Case m_oDependencyChecker.Dependencies(0).Status
Case DependencyStatus.OK
oImage = imlDependencyStatus.Images(1)
Case Else
oIage = imlDependencyStatus.Images(2)
End Select
ElseIf sbdevent.Panel Is StatusBar1.Panels(0) Then
Select Case m_oDependencyChecker.Dependencies(0).Status
Case DependencyStatus.OK
oImage = imlDependencyStatus.Images(1)
Case Else
oImage = imlDependencyStatus.Images(2)
End Select
End If

sbdevent.Graphics.DrawImage(oImage, sbdevent.Bounds.Location)

End Sub

The problems also occur when ownerdrawing the controls by inheriting from
them, so I am fairly certain that is not the issue.

Does anyone know what I'm doing wrong?

TIA,

Danny van Kasteel


Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hello,

"Danny van Kasteel" <da***@dlw.nl> schrieb:
The problems also occur when ownerdrawing the controls
by inheriting from them, so I am fairly certain that is not the issue.


I suggest you post this question to the Windows Forms controls group:

news://news.microsoft.com/microsoft....forms.controls

--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.