473,320 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

GDI+ ownerdrawn troubles

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
1 1184
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Martin Streller | last post by:
Hello, The code below represents a simple ownerdrawn, Listview class in C#. Its purpose is to avoid the flicker of the MS ListView. So I can't fall back to their one. Does anybody know why I...
4
by: Beeeeeeeeeeeeves | last post by:
I have an ownerdrawn combo box which I am drawing with an image and some text, this is all working beautifully apart from the difference in the Brush I have to draw the background and the text with...
1
by: Beeeeeeeeeeeeves | last post by:
I have an ownerdrawn combo box which I am drawing with an image and some text, this is all working beautifully apart from the difference in the Brush I have to draw the background and the text with...
1
by: mnsindhu74 | last post by:
hi I am creating an ownerdrawn combo box. I will need to display icons/images in the edit portion of the combobox. I retreived the handles of Edit and List portions with ComboBoxInfo structure....
0
by: Andrew Baker | last post by:
Have a look at the code below. It's a really simple example where I have added two controls to a form, a textbox and a combo box. Both add owner drawn context menus to the controls, but the...
0
by: Dave | last post by:
Does anyone have a simple example of setting up an ownerdrawn statusbarpanel control in c++ .NET? It would be greatly appreciated. Thanks Dave
1
by: Danny van Kasteel | last post by:
Hi, I'm trying to make an ownerdrawn ListBox that can display a custom graphic and 2 lines of text per item. I have tried to set the following properties on a standard ListBox control: ...
3
by: André Nogueira | last post by:
Hi there! I have successfully create my own ownerdrawn menus. However, I decided to add some code for the menus to detect if their parent is a MainMenu object and, if it is, as it is the menuitem...
1
by: Dino Buljubasic | last post by:
Hi, My application has a menu with some of the menu items that have their own menu items. By default, VB will add a black right rectangle when a menu items has its own menu items. However,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.