Page 24 of 105 FirstFirst ... 14212223242526273474 ... LastLast
Results 921 to 960 of 4199

Thread: CommonControls (Replacement of the MS common controls)

  1. #921
    Lively Member
    Join Date
    Apr 2014
    Posts
    122

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by jpskiller View Post
    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 can live with mine crashing (cant explain why) I just use normal form nstead of Child MDI, but does anyone have any idea on how to do this part with this RichTextBox Control, cheers

  2. #922
    Lively Member
    Join Date
    Apr 2014
    Posts
    122

    Re: CommonControls (Replacement of the MS common controls)

    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
    Attached Files Attached Files

  3. #923
    Fanatic Member
    Join Date
    Apr 2015
    Posts
    536

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by jpskiller View Post
    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
    It doesn't crash in here.
    Not in the IDE, not as EXE.

  4. #924
    Fanatic Member
    Join Date
    Apr 2015
    Posts
    536

    Re: CommonControls (Replacement of the MS common controls)

    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.

    Name:  vbf_Krool_PagerQ.jpg
Views: 1661
Size:  12.4 KB

    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.)

  5. #925
    Lively Member
    Join Date
    Apr 2014
    Posts
    122

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Karl77 View Post
    It doesn't crash in here.
    Not in the IDE, not as EXE.
    I have no idea why but does on my laptop, I will try it on another system

  6. #926
    Fanatic Member
    Join Date
    Apr 2015
    Posts
    536

    Re: CommonControls (Replacement of the MS common controls)

    Statusbar Alignment

    Set the Windows size dialog to this:
    Name:  vbf_size.png
Views: 6903
Size:  11.2 KB

    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:
    Name:  vbf_size2.jpg
Views: 6663
Size:  6.6 KB

    Now I tested with the CC5 statusbar.
    Same picture.
    Perhaps the replacement statusbar should be better?



    (Pager question)

    Quote Originally Posted by Karl77 View Post
    Do have a hint or idea?
    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.

  7. #927

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Karl77 View Post
    (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?
    Last edited by Krool; Feb 25th, 2016 at 04:00 PM.

  8. #928
    Fanatic Member
    Join Date
    Apr 2015
    Posts
    536

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    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?
    Yes, I do use it for the awesome toolbars.
    I didn't try it with other controls yet.

    If you could make the pager working with the toolbars (regarding the color), that would be great.
    Thank you.

  9. #929

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Karl77 View Post
    Yes, I do use it for the awesome toolbars.
    I didn't try it with other controls yet.

    If you could make the pager working with the toolbars (regarding the color), that would be great.
    Thank you.
    Done

  10. #930
    Fanatic Member
    Join Date
    Apr 2015
    Posts
    536

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    Done
    Great, works as expected.
    Thank you for that.

  11. #931
    Lively Member
    Join Date
    Apr 2014
    Posts
    122

    Re: CommonControls (Replacement of the MS common controls)

    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.

  12. #932

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Double post...
    I have moved the content of this post to the double post.
    Last edited by Krool; Feb 26th, 2016 at 02:35 PM.

  13. #933

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by jpskiller View Post
    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.
    You need to handle the 'LinkEvent' event in the RichTextBox control.

    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
    Watch there for a WM_LBUTTONDOWN message for instance and then open your web page / email. (manually by your own code)

    The params LinkStart and LinkEnd helps to trace the actual link that was clicked.

    Quote Originally Posted by Karl77 View Post
    Statusbar Alignment

    Set the Windows size dialog to this:
    Name:  vbf_size.png
Views: 6903
Size:  11.2 KB

    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:
    Name:  vbf_size2.jpg
Views: 6663
Size:  6.6 KB

    Now I tested with the CC5 statusbar.
    Same picture.
    Perhaps the replacement statusbar should be better?
    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%)

  14. #934
    Lively Member
    Join Date
    Apr 2014
    Posts
    122

    Re: CommonControls (Replacement of the MS common controls)

    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

  15. #935

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by jpskiller View Post
    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
    There is an error in your code, in the Mid$ function.

    It should be like following:
    Code:
    txt = Mid$(RichTextBox1.Text, LinkStart + 1, LinkEnd - LinkStart)

  16. #936
    Lively Member
    Join Date
    Apr 2014
    Posts
    122

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    There is an error in your code, in the Mid$ function.

    It should be like following:
    Code:
    txt = Mid$(RichTextBox1.Text, LinkStart + 1, LinkEnd - LinkStart)

    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

  17. #937
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,653

    Re: CommonControls (Replacement of the MS common controls)

    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.

  18. #938

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by fafalone View Post
    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.
    Last edited by Krool; Feb 27th, 2016 at 04:43 AM.

  19. #939
    New Member
    Join Date
    Jan 2014
    Posts
    3

    Re: CommonControls (Replacement of the MS common controls)

    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?

  20. #940
    Lively Member
    Join Date
    Apr 2014
    Posts
    122

    Re: CommonControls (Replacement of the MS common 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?"

  21. #941

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    @ jpskiller,
    try the following code to extract the text:

    Code:
    txt = Mid$(RichTextBox1.Text, LinkStart + RichTextBox1.GetLineCount, LinkEnd - LinkStart)
    or

    Code:
    txt = Mid$(Replace$(RichTextBox1.Text, vbLf, vbNullString), LinkStart + 1, LinkEnd - LinkStart)
    Both worked in my testings.

    @ kulasart,
    It's not possible. This is VB6 only.
    Last edited by Krool; Feb 27th, 2016 at 03:44 PM.

  22. #942

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by LaVolpe View Post
    ScaleWidth,ScaleHeight cannot be trusted. It can be less than what the host reports. If UC is designed with a width of 200 pixels, 3000 twips, in 96 DPI and shown in 200% DPI, then at 200% DPI, you would expect the host to report the UC as 400 pixels, twice as large at twice the original DPI. But not so. The host still reports the UC as 3000 twips as expected, but the size in pixels would be 3000 / 7 = 428.571. If your UC's scalemode were pixels, you'd expect its ScaleWidth to report 428.571. However, the UC's scalewidth in twips is 2800 and in pixels: 400, 28.571 pixels smaller than the host.The difference in VB and System twips per pixel can be used to show that difference: 3000 * 7 / 7.5 = 2800
    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

  23. #943
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: CommonControls (Replacement of the MS common controls)

    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:
    Code:
    If 1440! \ Screen.TwipsPerPixelX < 1440! / Screen.TwipsPerPixelX Then ' non-system DPI in use
    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.
    Last edited by LaVolpe; Feb 28th, 2016 at 09:59 AM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  24. #944
    Lively Member
    Join Date
    Apr 2014
    Posts
    122

    Re: CommonControls (Replacement of the MS common controls)

    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

  25. #945

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    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.
    Last edited by Krool; Feb 29th, 2016 at 05:49 PM.

  26. #946
    Fanatic Member
    Join Date
    Apr 2015
    Posts
    536

    Re: CommonControls (Replacement of the MS common controls)

    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.

  27. #947
    Fanatic Member
    Join Date
    Apr 2015
    Posts
    536

    Re: CommonControls (Replacement of the MS common controls)

    CommandButtonW

    Q1:

    Code:
    cmd_Test.Picture = imgl.ListImages(1).ExtractIcon
    cmd_Test.Caption = "This is a test button"
    Vista:
    Name:  vbf_cmdw_vista.png
Views: 1340
Size:  2.5 KB

    XP:
    Name:  vbf_cmdw_XP.png
Views: 1335
Size:  1.0 KB

    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:

    Code:
    cmd_Test.ToolTipText = "This is the button's tooltip" & vbLf & "cmd_Test"
    For the toolbar buttons, the vbLF produces a nice multiline tooltip.
    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?

  28. #948

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Karl77 View Post
    CommandButtonW

    Q1:

    Code:
    cmd_Test.Picture = imgl.ListImages(1).ExtractIcon
    cmd_Test.Caption = "This is a test button"
    Vista:
    Name:  vbf_cmdw_vista.png
Views: 1340
Size:  2.5 KB

    XP:
    Name:  vbf_cmdw_XP.png
Views: 1335
Size:  1.0 KB

    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:

    Code:
    cmd_Test.ToolTipText = "This is the button's tooltip" & vbLf & "cmd_Test"
    For the toolbar buttons, the vbLF produces a nice multiline tooltip.
    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)
    Last edited by Krool; Mar 1st, 2016 at 06:01 AM.

  29. #949
    Fanatic Member
    Join Date
    Apr 2015
    Posts
    536

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    This is not a glitch with the CommandButtonW. The PictureAndCaption property is only supported on comctl32.dll version 6.1 or higher. (means Vista+)
    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.


    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)
    Also understood.
    I thought it could be just an oversight.

    Thank you for the explanation.
    Last edited by Karl77; Mar 1st, 2016 at 11:09 AM.

  30. #950

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    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.

    Quote Originally Posted by Karl77 View Post
    Can I create a Krool imaglist by code only?
    Dim IL as new Projectname.imagelist doesn't work.
    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.
    Last edited by Krool; Mar 1st, 2016 at 05:16 PM.

  31. #951
    Fanatic Member
    Join Date
    Apr 2015
    Posts
    536

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    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.
    No problem at all, I just want to place as less controls a possible on a form.
    The extra imagelist is not the only one...

    I think I have found an elegant solution for this "non-problem".

  32. #952

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    ActiveX Control versions (OCX) are now up to date with the bugfixes. (especially the "DPI Aware" modifications)

  33. #953
    New Member
    Join Date
    Mar 2016
    Posts
    1

    Re: CommonControls (Replacement of the MS common controls)

    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.

  34. #954

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Regor Tejmar View Post
    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.
    Only VB6 IDE supported and 32-bit only.

  35. #955
    Fanatic Member
    Join Date
    Apr 2015
    Posts
    536

    Re: CommonControls (Replacement of the MS common controls)

    (DPI aware)

    Quote Originally Posted by Karl77 View Post
    I tested some different settings and found issues, marked with !.
    Krool, could you find something regarding this?

  36. #956

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Karl77 View Post
    (DPI aware)

    I tested some different settings and found issues, marked with !.

    Krool, could you find something regarding this?
    Oh, I did not notice your post. Will look soon.

  37. #957

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Karl77 View Post
    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
    Indeed it is not yet working on the marked % numbers. But because the function to identify this fails on those cases.

    Quote Originally Posted by LaVolpe View Post
    The following calculation will determine whether DPIs are different:
    Code:
    If 1440! \ Screen.TwipsPerPixelX < 1440! / Screen.TwipsPerPixelX Then ' non-system DPI in use
    If I remove the 'If' and use always the tweaks than the above marked % numbers will work proberly.

    How can it be?

  38. #958
    Frenzied Member
    Join Date
    Mar 2008
    Posts
    1,210

    Re: CommonControls (Replacement of the MS common controls)

    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

  39. #959
    Fanatic Member
    Join Date
    Apr 2015
    Posts
    536

    Re: CommonControls (Replacement of the MS common controls)

    I do it similar.

    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
    The key is the DPI_StrangeFactor, which is 1 at 96 dpi.

    Karl

  40. #960

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Update released.

    The issue with the not always working calculation that determine if DPIs are different is now solved.

Page 24 of 105 FirstFirst ... 14212223242526273474 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width