-
[RESOLVED] Manifest XP Style Problems
Hey y'all,
I only started using the manifest file technique for displaying XP style controls few days ago, as i wasnt very keen for the xp style, but most people are..
Anyways, 2 problems i faced were:
- Lots of flickering. When i move the mouse around the controls, flickering reaches crazy levels. What is this due to?? And is there anyway it can be more professional?
- Another problem i faced was the focus of the controls. What i mean is that the dotted rectangle that should appear on the controls when i am moving the focus around with the tab key, is simply not appearing. I tried "pure" XP apps, and there seems to be normal focus there (different than win9x, true, but it's dotted and it's there!!).. This problem is at worst for check boxes and option buttons. For regular buttons, there seems to be some kind of a color change on the borders (which is normal, but still missing the dotted focus rect.), so it's "acceptable" for buttons.. But for the other controls, it's horrible.
Any ideas on this matter, and how to solve it??
Thanks :) .
-
Re: Manifest XP Style Problems
That's strange because the manifest method doesn't simulate xp styles, it is real xp styles. Do you have the link to comctl32.dll?
VB Code:
'// from vbAccelerator
Private Type tagInitCommonControlsEx
lngSize As Long
lngICC As Long
End Type
Private Declare Function InitCommonControlsEx Lib "comctl32.dll" _
(iccex As tagInitCommonControlsEx) As Boolean
Private Const ICC_USEREX_CLASSES = &H200
Public Function InitCommonControlsVB() As Boolean
On Error Resume Next
Dim iccex As tagInitCommonControlsEx
' Ensure CC available:
With iccex
.lngSize = LenB(iccex)
.lngICC = ICC_USEREX_CLASSES
End With
InitCommonControlsEx iccex
InitCommonControlsVB = (Err.Number = 0)
On Error Goto 0
End Function
Public Sub Main()
InitCommonControlsVB
'
' Start your application here:
'
End Sub
Check this link: vbAccelerator
-
Re: Manifest XP Style Problems
Well, i am using somewhat different code, but i guess with the same purpose (calling the API link to comctl32.dll at form initialization)..
Anyways, i tried the code u posted, but to no avail.. Same problems.
Plus i am sure i am "linked" to the comctl32 dll as the xp styles are displaying, but not efficiently.. And i am sure i saw similar complaints in other threads during my extensive long hours of search in this forum..
So guys, any solution???
-
Re: Manifest XP Style Problems
I had a similar problem but i fixed when i read this:
http://www.vbaccelerator.com/home/VB...VB/article.asp
Also, Enable XP Style a design time:
http://www.vbaccelerator.com/home/VB...me/article.asp
Edit: To have a XP Button for all versions use Wokawidget's XP Button (search the codebank)
-
Re: Manifest XP Style Problems
Are you using Frames? I believe they require constant redrawing to maintain the XP theme - hence they always have lots of flickering - I've never had this problem with any other control.
-
Re: Manifest XP Style Problems
If you place the frame in a picture box it will work fine.
-
Re: Manifest XP Style Problems
Placing the actual frame control within the picturebox doesn't stop the frame flickering.
Using a picturebox instead of a frame would result in no flickering
-
Re: Manifest XP Style Problems
Puting the frame in a picture box sorts out any style issues.
and for the focus rects for the option buttons, you can use the drawfocus rect api
Code:
Dim rt As RECT
rt.top = Option1.top
rt.Bottom = Option1.top + Option1.height
rt.left = Option1.left
rt.right = Option1.left + Option1.width
Debug.Print DrawFocusRect(frmMain.hWnd, rt)
Something like that, rectangles are fussy about their coords so it might take a bit of playing.
-
Re: Manifest XP Style Problems
placing the frame inside a picturebox does not prevent flickering
-
Re: Manifest XP Style Problems
Tommy, The 1st link u posted is the same one posted by roach in an earlier post. But anyways, for what it's worth, i followed the described way, step by step, and the same problem..
The 2nd link, well i dont believe my problem has to do with enabling the xp styles at design time, but anyways, i tried and also nothing happened..
Anyways, thx for ur help :) .
bushmobile, yes, i am using frames, and whenever i use frames, the flickering increases drastically.
Rich2189, sorry, but as bushmobile said, placing the frame inside a picture box does not solve this problem. I even tried it, it doesnt solve it.
-
Re: Manifest XP Style Problems
Quote:
Originally Posted by bushmobile
placing the frame inside a picturebox does not prevent flickering
I never implied it will prevent flickering, I mean that when option buttons are in a frame when using the maifest they might not display properly. If they do not display properly, embed the frame in a picture box with the controls in the frame.
-
Re: Manifest XP Style Problems
Regarding the focus rectangle problem, well it's taking a rather strange form.
1st, i was working on my Desktop PC. When i tried the whole thing on my laptop, well the focus rect. problem disappeared. Both systems have XP professional SP2.
2nd, and after lots of testing on the Desktop PC, i noticed the following:
- The focus rect. problem occurs whenever i load my app. manually (i click on it, in contrast of it running automatically on startup). I even tried it on both classical windows style, and xp style (the option in the Appearance tab of the Display Properties), and the problem was still there.
- The only time the focus rectangles seem to be normal, regardless of which display style i am using within my XP Desktop PC system, is when my app loads automatically at startup.
Anyways, this problem is strange.. But it's not that serious, as everything seems to be normal on my Laptop (and i expect on other PC's).
As for the flickering problem, well it's still unresolved, so i'll leave this thread open.. Who knows, maybe someone will be able to find a solution ;) !!!
-
Re: Manifest XP Style Problems
Anyone about the flickering :wave: ???
-
Re: Manifest XP Style Problems
Well, as I've said, I've never encounter flickering with anything other than frames.
perhaps upload your project.
-
Re: Manifest XP Style Problems
Well, as i've said myself too, i am encountering problems when using frames :D , only i cant (or dont want to) avoid using frames.
No solution for flickering when using frames?!!
-
Re: Manifest XP Style Problems
why can't you avoid using frames? there's nothing that they can do that a picturebox can't, and a picturebox doesn't flicker.
-
Re: Manifest XP Style Problems
or put all controls in a picturebox in the frame.
-
Re: Manifest XP Style Problems
Quote:
Originally Posted by shragel
or put all controls in a picturebox in the frame.
any parts of the frame that are showing will still flicker, so you'd have to have the picturebox covering the entire frame, and then there's no point in using a frame.
-
Re: Manifest XP Style Problems
Not true. Nothing flickers if everything is in the picturebox.
-
1 Attachment(s)
Re: Manifest XP Style Problems
look at the attached.
swipe the mouse back an forth across the picturebox and frame. The black rectangles and title will flicker - demonstrating that the frame is being repainted.
True if there were nothing on the frame, or you only moved the mouse within the picturebox, then the frame would not flicker - but then what's the point of the frame?
-
1 Attachment(s)
Re: Manifest XP Style Problems
Quote:
Originally Posted by bushmobile
why can't you avoid using frames? there's nothing that they can do that a picturebox can't, and a picturebox doesn't flicker.
hmmm... i donnow, i mean how can u make a picture box look like a frame?!!
Like in the attachment i mean (the difference in borders, and in the "title" or caption of the frame)???
-
Re: Manifest XP Style Problems
Bit of a hash but set the borderstyle to 0, draw some lines around it and smack a label on top.
-
Re: Manifest XP Style Problems
Quote:
Originally Posted by Rich2189
Bit of a hash but set the borderstyle to 0, draw some lines around it and smack a label on top.
This way, i knew how to do it :sick: !!!
But imagine doing this say for 6 frames within ur application (on different forms), well i might just quit programming in VB :eek2: !!!
Any other ideas??
-
Re: Manifest XP Style Problems
Quote:
Originally Posted by TupacShakur
But imagine doing this say for 6 frames within ur application (on different forms), well i might just quit programming in VB :eek2: !!!
You let VB do it for you.
here is a sub that will turn a picturebox in a reasonable frame look-a-like:
VB Code:
Private Sub Picture2Frame(ByRef oPic As PictureBox, ByVal sCaption As String, _
Optional ByVal lBorderColour As Long = &H8000000C, _
Optional ByVal lTextColour As Long = vbBlack, _
Optional ByVal oFont As StdFont)
Dim lbl As Label, lGap As Long
With oPic
.AutoRedraw = True
.BorderStyle = 0
.Appearance = 0
.ScaleMode = vbPixels
.BackColor = vbButtonFace
End With
Set lbl = Me.Controls.Add("VB.Label", "piclbl" & Me.Controls.Count)
With lbl
Set .Container = oPic
.AutoSize = True
.Caption = " " & sCaption & " "
.ForeColor = lTextColour
If Not oFont Is Nothing Then Set lbl.Font = oFont
lGap = .Height \ 2
.Left = 2 * lGap
.Top = 0
.Visible = True
End With
oPic.Line (lGap, lGap)-(oPic.ScaleWidth - lGap, oPic.ScaleHeight - lGap), lBorderColour, B
Set lbl = Nothing
Set oFont = Nothing
End Sub
So in the Form_Load you do:
VB Code:
Private Sub Form_Load()
Picture2Frame Picture1, "First Frame", , vbBlue
Picture2Frame Picture2, "Second Frame", vbBlack, vbRed
' or you can pass a font to use as well
With Picture3
.FontBold = True
.FontName = "Comic Sans MS"
.FontSize = 14
End With
Picture2Frame Picture3, "Third Frame", , , Picture3.Font
End Sub
-
Re: Manifest XP Style Problems
^^ Seems to be some good code :thumb: , i'll rep u, and see where i can go from here!!
I'll mark this thread resolved.
-
Re: Manifest XP Style Problems
Old thread, but anyway, about this..
Quote:
Originally Posted by Rich2189
Puting the frame in a picturebox sorts out any style issues.
Actually it is: Adding a picture box inside the frame sorts out any style issues.
So, the controls must be added inside the picturebox, the picturebox must be added inside the frame and the picturebox border must be removed to make it invisible to the user (by default it has the same backcolor than the frame).