How do I create a font with semi-bold weight in VB.NET? - vb.net

I wan't to create a semi-bold font in VB.NET.
Why isn't semi-bold available in intellisense?
[screenshot]
I am using .NET 4.5.

Label1.Font = New Drawing.Font("Segoe UI Semibold", 10)
Add Semibold to font name.

The answer is simple and is just available in front your eyes.
Just look with care the image you attached and MSDN Document:
System.Drawing.FontStyle is different from System.Windows.FontWeights.
A tip: no big deal, but for conscience' sake and future page visitors, you've cited something about .Net version 4.5... If you click on combo "Other versions", it will show the documentation page in others .Net versions.
So, in this case, System.Windows.FontWeights was introduced by .Net 3.0.
The more correct sentence is: .Net 3.0 (and up) is required to use System.Windows.FontWeights.

System.Drawing.Fonts does not support a SemiBold setting weight. The FontWeights is in the System.Windows namespace which is WPF/Silveright - which does support Semi-Bold. However System.Drawing.Fonts is part of Windows Forms which does not.
WPF and Windows Forms use different rendering engines and are not compatible.

Related

Dojo Image Indicator while partial refresh not working in Notes 9

I am helping a co-worker with a issue in a production datatbase. The database makes use of a visual indicator to show the user during long partial refreshes. We are in the process of upgrading the application to Notes 9.0.1.
The method that is used is described in detail in this blog post by Eric Tomenga: https://www.socialbizug.org/blogs/tomenga/entry/dojo_loading_image_indicator_while_partial_refresh_loads_data?lang=en_us (blog that Eric's references appears to be offline)
The code is not altered from what is shown in the post. Works in 8.5.3 completely, but in 9.0.1, the "Please Wait" works but the spining image is absent.
My suspicion is that newer dojo version that Notes 9 uses changes something that breaks this. Downgrading dojo versions is not an option. Hoping for a workaround.
<xp:this.onStart><![CDATA[XSP.startAjaxLoading()]]></xp:this.onStart>
<xp:this.onComplete><![CDATA[XSP.endAjaxLoading()]]></xp:this.onComplete>
<xp:this.onError><![CDATA[XSP.endAjaxLoading()]]></xp:this.onError>
This is added to the element you want to use it with (button in this case). The following dojo modules are added to XPage resources: extlib.dijit.ExtLib + extlib.dijit.Loading
I'm pretty sure you'll need to add the relevant Dojo module as well. You can see a working example of the code on the Admin page of the XPages Extension Library demo database. I can't remember off-hand which dojo module it is, so please post here if that solves it.

Metro equivalent for HeaderedItemsControl

Converting a WPF application from .Net 4.0 to Metro.
It uses HeaderedItemsControl in various places.
I have not been able to find that control or a replacement candidate in Metro (Windows.UI.Xaml namespace)
So what is the recommended control in Metro to provide the functionality of HeaderedItemsControl?
You could easily create one by deriving from ItemsControl and adding a few simple dependency properties. You can see which properties are present in the WPF version here. You might not need all of them, but from a quick glance I can see a Header property which is just an object type. You would put a ContentPresenter in your HeaderedItemsControl's ControlTemplate and bind its Content to the HeaderProperty using TemplateBinding. Then bind the HeaderTemplate to the ContentTemplate of the ContentPresenter, etc.
Not sure how useful it is though to port WPF XAML code directly to WinRT. You're just asking for trouble in terms of code compatibility, but also porting a likely desktop-designed UI to a more touch-centric world.

Format month/year in Ektron calendar header

Version 8.0.1 SP1
Our client would like us to reformat the month/year in the calendar header. See attached image. They want "April, 2012" instead of the abbreviated "Apr, 2012". Where is this specified? I have looked at the webcalendar objects, css files, xslt files.
Any suggestions?
I haven't made that particular change, but have faced similar requests. Your options are-
Use Javascript (jQuery) to reformat on client side
Dig around in the workarea looking for formatting code, though usually the formatting code is locked up in a DLL.
DisplayXslt or EkMarkup - some controls allow you to apply XSLT or EkMarkup (Ektron markup template) for custom display. You create an XSLT, and apply it via the DisplayXslt property on the control.
Discard the control, and use the APIs to drive your own custom control.
Also, this Ektron forum post suggests having a look at this file- workarea/webcalendar/xsl/default.xsl
If this file exists (I don't have an Ektron installation currently handy), then it is likely you can use the DisplayXslt method described above.

Expression Blend 4 Right to Left Issue

I have recently installed Expression Blend 4 and created a test Silverlight 4 project.
When I set the main page FlowDirection to RightToLeft the designer won't change the direction but if I run the application it will be displayed correctly.
Is this a bug or do I have to do something?
Thanks.
I believe you were the one who also put the post at the microsoft social site (available here) but since it took me a while to find it, I'll also put the response here:
Unni Ravindranathan - MSFT:
We do not support RTL on the design-surface, so what you are seeing is currently by design (the value that you set is ignored). We hope to be able to support it in the future, however.
Let's hope they would!

Library for using SVG in Windows Forms / WPF?

Are there any libraries which
Allow to draw svg direct to a Windows Forms application
to a WPF application
I draw graphics and design everything with Inkscape, because I love that program.
Then I have those stunning svgs and have to either export them to png (WinForm) to use them or convert them to xaml-code (WPF) (Kaxaml helps me).
Is there a way to directly use my svgs?
Wow, I just read that Inkscape supports saving as XAML. I didn't realize that up to now shame.
But that still doesn't solve my problems with WinForms...
I personally hate how there's no native support for SVG in Microsoft's products/development tools. I've found two fairly complete but still immature SVG libraries that seem to be active as of this writing, definitely in need of contributors though.
WPF : Svg2Xaml (open source)
WinForms : SVG rendering engine (open source)
IIRC both libraries output a Drawing object which can be used directly through the Image class; You'll figure it out, they're both pretty straightforward to use.
If you want to load them directly into WPF,
I got better results from: https://github.com/ElinamLLC/SharpVectors
Yes, you can use ReaderSVG from AB4D to get WPF directly from XAML.
Regarding WinForms, removed a previous link to Kent Boogart's example as it was deleted sometime in 2019.
Copy below from this dotnetways post
To host a WPF control or WPF user control (wpfControl in this example) into Windows Form application, create an instance of ElementHost Class and add your WPF control/user control as child to the instance of ElementHost.
using System.Windows.Forms.Integration;
//Assembly: WindowsFormsIntegration (in WindowsFormsIntegration.dll)
//...
ElementHost elementHost = new ElementHost();
elementHost.Dock = DockStyle.None;
elementHost.Child = wpfControl;
Now, add the instance of ElementHost to a container control in your windows form (for instance containerPanel here)
containerPanel.Controls.Add(elementHost);