No, I didn't use your imagelist.
I used the one CC5 provides.
As this one works with the CC5 toolbar, I think we can exclude this as a cause.
What can I do to help to track down the issue?
Printable View
Krool,
VERY GOOD NEWS.
The transparency on the toolbar buttons works.
I must have done several things wrong before, but I don't really know what...
I re-downloaded your project.
Trew out some controls I don't intend to use, and the main form as well.
So I had the Pager form left.
Placed a new Krool-imagelist.
Recreated the icons as BMP32.
Filled the imagelist in the IDE.
BANG! Works.
See:
Attachment 135445
I apologize for the whole trouble I made.
Karl
That looks great. (not being sarcastic because of the ugly green, but it's great that transparency works)
Now the question remains, can we get the Toolbar itself transparent (Design time Property of the toolbar / TBSTYLE_TRANSPARENT )
I have now implemented TBSTYLE_TRANSPARENT. This was useful to have the BackColor property shown/visible at design-time.
I will also include soon a "Transparent" property. This makes a background as a replica of the underlying background. (simulated transparency)
So here is the example for the toolbar using PNGs.
There is still a lot to do, but up to now it works quite well.
The graphics itself are for testing only, I know they have to be fine-tuned for the different sizes.
RichTextBox Help
I know that this auto detects URLS but so far I cant find a way to actual open the url with default app ie Browser / Email etc.
I have tried a couple of suggestions from around but there based on original and dont seem to work.
I presume since it auto detects i must be relatively simple to run it!
** I have also noticed if I use the RichTextbox on a MDI form and set as child, when close the form it crashes the app, when normal form it is OK
Help appreiated
Busy Slider
Krool, I have found a small issue in the slider.
It fires the scroll event 2 times when clicked.
The 'original' control doesn't show this beahvior.
To retrace:
Place a Slider1 on a form (range 1 to 4).
Place a label "lbl_1" (caption "0").
In Slider1_Scroll, lbl_1.Caption = CStr(CInt(lbl_1.Caption) + 1)
Scroll by mousewheel and see how the label increases by 1 on every scroll action.
But click the slider and see how the label increases by 2.
Karl
I ment to say I have called this manually from my form_load on MDI form 'Call InitVisualStyles'
my MDI form is call frmMain and if use the Startup.bas code I get Ambiguous name detect : Main
*** just remeber I have a main in a different module so have added it there **
Still same issue
Heres a very basic program
MDi startup, opens form with richtextbox, when close form crash out
If change sub form to not MDI child then can close with no issues
Sorry not done OCX demo as I cant use it I have to have no dependencies and dont' know how to set it up with OCX
I use windows 10, and the VisualStyles.bas is showing up under Modules on the demo, I did add it!
(Busy slider)
Slight issue left:
If you click the control the only one scroll event is produced now - good.
But when you scroll by mousewheel, there is NO scroll event now...
(I only exchanged the Builds\Slider folder, as I found no other differences to the former release. Anything more to do?)
I have re uploaded the test file I made and added all the files used for the demo in the root folder and reference them from there, still have same issue if use a MDI child form with a richtextbox, if close that form or the MDI form it just crashes out
OS:Windows 10
Pager question
Krool,
the pager has an area for the buddy.
If the buddy is larger than the pager, the pager shows scroll buttons.
But if the pager is larger than the buddy, we can see the pager area.
This area has a fixed color.
Attachment 135603
I need another color for it.
Do you know of a way to 'inject' it somehow?
I looked through the pager docs, and it looks like there is no direct way.
Do have a hint or idea?
Karl
(BTW, Slider works ok now.)
Statusbar Alignment
Set the Windows size dialog to this:
Attachment 135629
I know it is mean to set this value, but other work as well to show the effect (except 125, 150%).
On a new form, place the Krool StatusBar control.
Set alignment to bottom.
No code needed in the form.
Start the form.
See this:
Attachment 135631
Now I tested with the CC5 statusbar.
Same picture.
Perhaps the replacement statusbar should be better?
(Pager question)
If you have a good idea, then that would be nice.
For now the workaround is a picturebox to cover the area with the unwanted color.
I traced the problem. If an buddy control is in place the pager control takes the background color of the buddy.
For instance when using the ToolBar control. The child window which the pager control sets is the hWnd of the UserControl and not the ToolBar API window.
And my ToolBar control does not set the BackColor of the UserControl at run-time. Which could be changed of course to solve the issue for the ToolBar.
On which buddy control do you face the issue? ToolBar? Any other?
Well guys, tested the MDI compiled app on different PC and as you said it works fine, but on this laptop in the IDE and compiled it still crashes out bizarre, but getting back to my original problem is there a way to respond to clinks on the links that are highlighted to open web page / email etc.
Double post...
I have moved the content of this post to the double post.
You need to handle the 'LinkEvent' event in the RichTextBox control.
Watch there for a WM_LBUTTONDOWN message for instance and then open your web page / email. (manually by your own code)Code:Private Sub RichTextBox1_LinkEvent(ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long, ByVal LinkStart As Long, ByVal LinkEnd As Long)
End Sub
The params LinkStart and LinkEnd helps to trace the actual link that was clicked.
Indeed by an DPI of 113% the ScaleWidth and ScaleHeight values are bugged in VB6.
This whole DPI story is still an open issue. (with exotic DPI values or very large, e.g. 200%)
cheers that's great
I have tried this as a presumed link end was the length of the string!
Private Const WM_LBUTTONDOWN As Long = &H201
Private Sub RichTextBox1_LinkEvent(ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long, ByVal LinkStart As Long, ByVal LinkEnd As Long)
Dim txt As String
txt = Mid$(RichTextBox1.Text, LinkStart, LinkEnd)
Select Case wMsg
Case WM_LBUTTONDOWN
' ShellExecute Me.hwnd, "Open", txt, vbNullString, "C:\", SW_SHOWNORMAL
End Select
End Sub
It does capture where the link clicked start is but linkend can be any thing from 5 - 20 extra chars, so I guess thats not how you use it, help appreciated
you guys are great and I do love this project
Thanks I have corrected my code to match and moved it into Case WM_LBUTTONDOWN, but still have an issue,could this be my laptop again
I have a link http://www.google.co.uk - this is highlighted in the rt box, but the above mid$ returns http://www.google.co
I have another link which is over 30 chars, that is returned with only the last 2 chars missing
And even stranger the shell command does not appear to run, and I am using the same shell command in other places and works fine even if the links incorrect!
Appreciate the help being provided
The Mid() calculation is off... consider:
1234567890 ..say your link is 345. LinkStart=Instr(345)=3. LinkEnd=5.
Mid(text, 3+1, 2) would only return 45
I'd also look at the routines providing the LinkStart/LinkEnd values too.
LinkStart is beginning with zero. So you have to add + 1.
That the length can be incorrect lies maybe on the fact that LinkEnd is pointing to the actual URL and not the displayed text.
But using .Text and not .TextRTF is correct. But .Text is not showing the actual URL. Only the displayed Text. So LinkEnd can be tricky then.
LinkStart seems to be correct when adding + 1.
@ jpskiller
Please check the TextRTF and look if there is a hidden part of the URL which might fit into the length.
Is it possible to attach somehow this controls to Excel file and use them in it as a replacement to standard MS Office Userform controls?
not quite sure what you mean by look at .textRTF that just seems to return all the formatting i.e
"{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang2057\deflangfe2057{\fonttbl{\f0\fswiss\fprq2\fchars et0 Calibri;}}
{\colortbl ;\red0\green0\blue255;\red255\green153\blue0;\red255\green204\blue0;\red255\green0\blue0;}
{\*\listtable
{\list\listhybri?"
@ jpskiller,
try the following code to extract the text:
orCode:txt = Mid$(RichTextBox1.Text, LinkStart + RichTextBox1.GetLineCount, LinkEnd - LinkStart)
Both worked in my testings.Code:txt = Mid$(Replace$(RichTextBox1.Text, vbLf, vbNullString), LinkStart + 1, LinkEnd - LinkStart)
@ kulasart,
It's not possible. This is VB6 only.
I just want to reassure something concerning this. Because I am preparing the DPI aware fixes for this project.
Can it be that ScaleWidth,ScaleHeight can be correctly?
Because for example in my StatusBar control.
I need to make some of the tweaks there so the control is sized correctly. (use of Extender.Move instead of UserControl.Size and the use of Extender.Move in the UserControl_Resize event)
But in my CommandButtonW control it seems that there is no change actually necessary. There is only MoveWindow with ScaleWidth,ScaleHeight in the UserControl_Resize event and it looks that the ScaleWidth,ScaleHeight are correctly.
The other differences are only that the StatusBar does some internal resizing and is alignable.
Can it be?
Thank you
Remember that this issue arises only when the DPI that VB is using is not the same as the operating system is reporting. Using 200% DPI for example, the system will report 192 DPI (96 * 200%). At 192 DPI, twips per pixel will be 7.5 (1440/192). However, VB reports 7 twips per pixel which indicates a different internal DPI: 1440 / 7 = 205.7143 DPI or 214.29%. The following calculation will determine whether DPIs are different:
You can get ScaleWidth,ScaleHeight to sync up with the size the host is reporting by resizing from within the control via its Extender object. You may have to resize via the Extender each time the control is resized, i.e., when control is first loaded, whenever user resizes it from the host, and whenever you resize it from within the control, like AutoSizing.Code:If 1440! \ Screen.TwipsPerPixelX < 1440! / Screen.TwipsPerPixelX Then ' non-system DPI in use
thanks that's great much appreciated
txt = Mid$(Replace$(RichTextBox1.Text, vbLf, vbNullString), LinkStart + 1, LinkEnd - LinkStart) - this works fine, the other seemed to give other text from page
maybe for future development have option to return the link clicked on or even just auto open it depending if option ON/OFF, and include other types ie. auto detect email address
Important update released.
All controls are now "DPI Aware". (concerns exotic DPI or very large DPI, e.g. 113% and 200%)
I did extensive testings. However, please report if you do encounter an issue.
OCX versions will follow soon with this update.
Krool, you are really a "Hyperactive Member".
I know I'm annoying... but:
I tested some different settings and found issues, marked with !.
All tests ran under Win10/64.
Here are the numbers:
100
101
105
110
113
115
! 120
125
130
135
! 140
! 141
! 145
! 146
! 147
! 149
150
! 151
! 160
! 165
! 170
200
250
Megafail, Windows itself fails, is not able to show an Explorer window
! 149
! 170
Most of the settings will be uncommon, except 120, 140, 160 and alike.
Karl.
CommandButtonW
Q1:
Vista:Code:cmd_Test.Picture = imgl.ListImages(1).ExtractIcon
cmd_Test.Caption = "This is a test button"
Attachment 135709
XP:
Attachment 135711
This works well under Vista+, but under XP the caption is not there.
The caption is only there if I assign an imagelist to the button - not very wanted.
Seems like a small glitch to me.
Q2:
For the toolbar buttons, the vbLF produces a nice multiline tooltip.Code:cmd_Test.ToolTipText = "This is the button's tooltip" & vbLf & "cmd_Test"
Not so for other controls like the CommandButtonW.
While I can easily live with it, perhaps it is not a big deal to get this working?
This is not a glitch with the CommandButtonW. The PictureAndCaption property is only supported on comctl32.dll version 6.1 or higher. (means Vista+)
For the ToolTip. That's normal. As for the ToolBar there is a API tooltip included by the control itself. (Button class collection)
And the CommandButtonW uses the intrinsic VB UserControl ToolTip function. And this is not multiline.
Solution: Let it empty and use a ToolTip class object for the CommandButtonW. (there are plenty of such class objects available on the net)
Ok, I see.
But then, why does it work with an assigned imagelist?
I don't get it.
EDIT:
I can fill an imagelist on the fly and assign it to the button.
Then XP compatibility is done.
Q:
Can I create a Krool imaglist by code only?
Dim IL as new Projectname.imagelist doesn't work.
Also understood.Quote:
For the ToolTip. That's normal. As for the ToolBar there is a API tooltip included by the control itself. (Button class collection)
And the CommandButtonW uses the intrinsic VB UserControl ToolTip function. And this is not multiline.
Solution: Let it empty and use a ToolTip class object for the CommandButtonW. (there are plenty of such class objects available on the net)
I thought it could be just an oversight.
Thank you for the explanation.
Important update released for vertical ToolBar control. (Align property set to vbAlignLeft or vbAlignRight)
The Vertical ToolBar behaves now like the original MS control when the Wrappable property is set to False.
Also changing from horizontal to vertical and vice versa after initialization works now properly.
No, you can't.
But what is the problem to place a ImageList control onto the Form? The CommandButtonW must be anyway placed on a Form.
So the ImageList can be just next to it.
ActiveX Control versions (OCX) are now up to date with the bugfixes. (especially the "DPI Aware" modifications)
Hi,
I am new to this thread and I was wondering if there is a 64 bit version of the OCX file that could be used with 64 bit office apps.
Indeed it is not yet working on the marked % numbers. But because the function to identify this fails on those cases.
If I remove the 'If' and use always the tweaks than the above marked % numbers will work proberly.
How can it be?
I'm not a UserControl person but use the following which converts between the scales used in standard user controls and those used by vb, it's working pretty well.
Assumes Screen.TwipsPerPixelX and Screen.TwipsPerPixelY will be equal.
Maybe it'll give you some ideas...
Code:Public Function DpiCorrectionFact() As Single
'Useful to Size OCX Controls (eg. SSTab etc.) and to size other controls relative to them
' returns ratio between vb6 TwipsPerPixel/ Windows TwipsPerPixel; a number >0 <=1
'Returns exactly 1 at the dpi 'sweet spots' of 96, 120, 144, 160, 180, 240 dpi etc
' when no corrections are required.
DpiCorrectionFact = Screen.TwipsPerPixelX / (96 / GetWindowsDPI(0) * 15)
End Function
I do it similar.
The key is the DPI_StrangeFactor, which is 1 at 96 dpi.Code:DPI = GetSettingLong(HKEY_CURRENT_USER, "Control Panel\Desktop\WindowMetrics", "AppliedDPI")
AppState.DPI_Registry = DPI
AppState.TwipsPerPixelExact = 1440 / DPI
Select Case DPI
Case 0: DPIFaktor = 1 'not found
Case 96: DPIFaktor = 1 '100%
Case 120: DPIFaktor = 1.25 '125%
Case 144: DPIFaktor = 1.5 '150%
Case Else 'e.g. 103 at 107%
DPIFaktor = ((100 / 96) * DPI) / 100
End Select
AppState.DPI_Percent = DPIFaktor
AppState.DPI_ScaleFactor = 1440 / Screen.TwipsPerPixelX / 96
AppState.DPI_StrangeFactor = AppState.TwipsPerPixelExact / Screen.TwipsPerPixelX
Karl
Update released.
The issue with the not always working calculation that determine if DPIs are different is now solved.