Print Page | Close Window

Custom Draw object disappear on hover [Beta bug?]

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=8551
Printed Date: 18 June 2025 at 2:01am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Custom Draw object disappear on hover [Beta bug?]
Posted By: indices
Subject: Custom Draw object disappear on hover [Beta bug?]
Date Posted: 27 October 2007 at 7:38pm
I am using the DrawItem event to draw a custom icon on a gallery item
The gallery item is set to style icon and caption (using the 11.2.1. beta). The galleryitem already has an icon assigned to it. This displays just fine. I am drawing another miniature icon custom beside it. This works. 
 
Dim Icon As ImageManagerIcon
 
Set Icon = Me.ImageManagerPanel.Icons.GetImage(ID_AUDIO_AVAILABLE, 22)
Icon.Draw hdc, x + 150, y + 80, 22, 22, xtpImageNormal
The problem is that when the mouse hovers over an item, the custom drawn icon disappears. When the mouse is not hovering over the item, it will appear.
 
See image: http://img528.imageshack.us/my.php?image=imageam7.jpg
 
How can i draw the icon on the item so that it appears even when it is hovering over it. Is this a bug in 11.2.1?
 
 
Thank you.



Replies:
Posted By: Oleg
Date Posted: 29 October 2007 at 2:56am
Hi,
add
Handled = True
 
default implementation just draw above your icon.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: indices
Date Posted: 29 October 2007 at 9:59am
How can I get the hover effect in a custom draw item?


Posted By: Oleg
Date Posted: 29 October 2007 at 12:51pm
Hi,
 
use PaintManager.DrawRectangle method.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: indices
Date Posted: 29 October 2007 at 1:09pm

Sorry, what I meant was - how can I determine when the user is hovering over an item?

ByVal Enabled As Boolean, ByVal Selected As Boolean, ByVal Pressed As Boolean, ByVal Checked As Boolean
 
As far as I can see, only Enabled turns up true when the DrawItem event is fired. I want redraw the item when it hovering over an item but how can I differentiate?


Posted By: Oleg
Date Posted: 29 October 2007 at 1:54pm
Hello,
Selected value will be True.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: indices
Date Posted: 29 October 2007 at 3:03pm
Thank you.


Posted By: indices
Date Posted: 30 October 2007 at 8:27am
What is the recommended API way to draw text on a custom draw item?


Posted By: Oleg
Date Posted: 30 October 2007 at 10:14am
Hi,
 
Public Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: indices
Date Posted: 30 October 2007 at 12:27pm
I must be doing something wrong then:
 
In the drawitem event I have
 
Dim rc as Rect       
        rc.Top = Y
        rc.Left = X
        rc.Bottom = cy
        rc.Right = cx
       
        DrawText HDC, Item.Caption, -1, rc, 0&
        handled=True
 
 
I see the first item caption in the list but not the others. Any suggestions?


Posted By: indices
Date Posted: 30 October 2007 at 12:37pm
Nevermind. I figured out that I had to use SetRect to specify the Rect and then pass that.
 
 


Posted By: indices
Date Posted: 02 November 2007 at 9:35am
Is there a way I can make the text bold or change the color?


Posted By: indices
Date Posted: 02 November 2007 at 9:48am

Nevermind. I created a font and got it to work as desired.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net