|
Tempting fate and the wrath of the gods: could 2021 be any worse?
I'm not sure how many cookies it makes to be happy, but so far it's not 27.
JaxCoder.com
|
|
|
|
|
Happy New Year to everybody! Everything will be great!
|
|
|
|
|
Am I talking to the future you, or are you talking to the past me?
Just the same, here's wishing 2021 will be a better year for all.
It was broke, so I fixed it.
|
|
|
|
|
Peter_in_2780 wrote: May 2021 be kinder to you than 2020 was.
You'd think that's a pretty low bar. But we'll see...
|
|
|
|
|
When working on a WinForms app in Visual Studio, the following information notice is displayed at the top of the design Window.
Scaling on your main display is set to 125% Restart with scaling set to 100% Help me decide
I never really took much notice of it, but just thought how nice of Microsoft to make things visually clearer. But recently I discovered a quirk in this that can easily catch you out.
I wanted to add a dynamic control to a Windows form at run time, and I wanted it the same size as an existing control and positioned alongside it at the same vertical location. Easy enough, drop another control on the form in the designer and make a note of the location and size in the Properties Window.
All fine and dandy, but when I ran the app the dynamic control was mis-positioned and too large. Hmm, I wrote some numbers down incorrectly (a common problem at my age). So, back to the designer and check the numbers, and sure enough they are all correct. So what is different about the runtime form and the design form? After a lot of head scratching and cursing, I put a property grid on the form to look at the controls' values. And lo and behold, the runtime values are smaller than the design values! The differences did not mean much and it took a while for me to realise the simple answer.
Not only does the designer show the form scaled to 125%, but it also updates the position and size values to reflect that scale factor. But when the form is run (at 100% scaling) the numbers are adjusted downwards. When all controls are positioned at design time it is not a problem, just when using the original numbers to do dynamic positioning.
Am I the only person to trip over this?
|
|
|
|
|
What I tend to do with dynamic controls is not to hardcode any sizes or positions but lay out the controls dynamically relative to the size of the control I am adding the controls to.
Not sure if this would fix your issue though.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
How do you calculate the size(s) and locations?
|
|
|
|
|
If you know the size of the main control(which you will do at runtime) you are dropping the child controls onto you can scale to that size, including scaling the position to that size.
I don't have any code with me at the moment but I am pretty sure that is what I have done.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Yes, I guess I should have used the properties of the other two related controls at run time. I just foolishly assumed the values in the designer would be the same. Live and learn ...
|
|
|
|
|
UI design is usually something of a pain, whatever the framework, however WinForms can lull you into a sense of security then do what every other UI designer does - e.g. not what you want
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Also stumbled into this several times, e.g. when updating the RoundedButton Control[^]
The problem was solved however, can't tell exactly how, but it can be found in the source code attached to the article.
|
|
|
|
|
No you're not. I run into it all the time. If I was actually being paid to write winforms controls I would get a monitor i could use with regular font scaling. At least that way my apps will work on normal scaling even if WinForms mangles them for 125%. Then I'd focus my testing on getting the 125% scaled form to show correctly.
Real programmers use butterflies
|
|
|
|
|
Yeah, I can relate to that: Happy New Year[^]
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
A second chance? To who?
"The only place where Success comes before Work is in the dictionary." Vidal Sassoon, 1928 - 2012
|
|
|
|
|
Kornfeld Eliyahu Peter wrote: A second chance? To who? I was of the impression that there should be no political discussions in The Lounge ...
|
|
|
|
|
No thanks - I would prefer 2020 hindsight.
If you can't laugh at yourself - ask me and I will do it for you.
|
|
|
|
|
I am now retired, but when I was working I was strictly line-of-business/DB stuff for SMBs, or celestial navigation for a hobby, so I have no idea of system stuff. I just expected everything to work as it should.
I am an opera buff, and have been both watching and listening to a lot of opera under lockdown, more so as I am 'a person at risk' and live on my own. However, I find it very distracting, particularly when watching but also when just listening, to have a paper copy of the libretto open during the performance, and be continually referring to it, so not to lose track. If the libretto were to be on-screen - any screen - and synched with the opera, then it would not require total concentration to keep track of it.
If I were to build myself such a system, most of it would be very straightforward, as most CDs have time marks on the librettos, and in any event it would be pretty easy to skim through the CD and extract key points to keep time synched between CD and display system. However, when it comes to DVDs without on-screen librettos or streamed video, I would want the synched libretto to appear as a subtitle overlaid on the video. Synching for streaming would be harder, but can be done with a little time and effort.
The issue is if the video is being streamed full screen or in a separate window, how easy/hard is it going to be to overlay the subtitles on the video image. I have no idea how to set about this, as it way outside anything I have done previously.
Don't 'send-uz-da-codez-plz', but I would definitely enjoy some pointers, if only to a resource that can point me in the right direction.
|
|
|
|
|
If you play the DVD with a home-grown video player, you'd probably be able to (relatively) easily add synced subtitles. Once the video leaves the plastic, it's just a stream, right?
But, since it's not going to be on-the-fly, why not deconstruct the DVD by converting the VOB to something reasonable, then use DVD Architect (or similar) to build your own DVD version of it with the libretto included?
|
|
|
|
|
That's definitely a way to go - I never thought about doing it that way - thanks. Having just had a quick Bingle there are lots of tools out there to help with that. It won't fix my problem for online operas, but it certainly will for DVDs without subs, or more frequently, DVDs with subs in the original language if those can be turned off. I just need to figure out hw to do it! Probably breaking the copyright, though, so I still need to try to find some overlay method.
|
|
|
|
|
Look at Handbrake. Free, and seems to be the video software of choice for many of those who mess with video. (I've always found copying the .vob and renaming it .mpg works in many instances, if I want to use the video elsewhere.)
|
|
|
|
|
Useful tips, thanks - I'm on it!
|
|
|
|
|
VLC always feels like a treat.
I don't know if this idea will work with discs, or would need some modification.
I've written the text-based .SRT file with subtitles and their timestamps on more than 1 occasion for something snagged from the net for offline viewing.
As for online stuff, HTML5 is pretty dandy when it comes to processing video. I can easily process every pixel in each frame of a video on this old laptop in real-time. But you wouldn't need to do that - you'd just need to overlay text onto the canvas at the correct timestamps - that'd be fast and low-power.
Went searching for a link and lo-and-behold, the video element actually can handle subtitle files. Ripper!
Adding captions and subtitles to HTML5 video - Developer guides | MDN
|
|
|
|
|
There are programs that allow you to create subtitles (e.g. in a language not present on the DVD) in SRT format, IIRC. Many media player programs have an option to read these files, and display them as subtitles on the screen. The programs allow you to specify when and for how long a particular subtitle is displayed.
I can't give you any recommendations, because I've never used them.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Thanks - that seems like another good option that I hadn't thought about - mainly because I didn't know it could be done! It also sounds like it wouldn't break the copyright as the original is not edited.
Now off to find out about SRT! I know nothing about video other than as a consumer!
|
|
|
|
|