PrintingPermissionLevel, SafePrinting, and restrictions - c#

There is a PrintingPermission attribute in the framework which takes a PrintingPermissionLevel enumeration with one of these values;
NoPrinting: Prevents access to printers. NoPrinting is a subset of SafePrinting.
SafePrinting: Provides printing only from a restricted dialog box. SafePrinting is a subset of DefaultPrinting.
DefaultPrinting: Provides printing programmatically to the default printer, along with safe printing through semirestricted dialog box. DefaultPrinting is a subset of AllPrinting.
AllPrinting: Provides full access to all printers.
The documentation is really sparse, and I wondered if anyone can tell me more about the SafePrinting option. What does the documentation mean when it says "Provides printing only from a restricted dialog box." I have no idea what this means. Can anyone shed any light?
This subject is touched in the MS certification 70-505: TS: Microsoft .NET Framework 3.5, Windows Forms Application Development and so I'm keen to find out more.

I don't see this actually implemented anywhere when peeking with Reflector. There is only one print dialog ever used, both by WF and WPF, the native Windows print dialog. It doesn't have a restricted version.
Printing support in .NET has been a bit cumbersome, it took a while before the System.Printing namespace became available. There might well have been early plans to implement a "better" print dialog, plans that didn't pan out.
I would guess that the exam question was more focused on testing understanding of CAS rather than very obscure details about the actual meaning of a specific CAS attribute.

According to the 70-505 MCTS training book:
AllPrinting provides unrestricted access to the printer
DefaultPrinting enables programmatic printing to the default printer and access to other printers through a printer dialog box.
SafePrinting allows printing only through a printer dialog box.
NoPrinting - pretty self-explanatory.
So, SafePrinting stops you printing programmatically without user interaction.

A restricted PrintDialog box refers to the various properties of the PrintDialog that can be set such as AllowSomePages,AllowSelection,AllowCurrentPage,PrintToFile etc.

Related

How can I make a menu-like form stay on the screen, on top of all other apps?

I want to make a menubar like window taskbar in C# but I'm wondering how can I make the form stay on the top of the screen and other program will not taped over it just like the window taskbar and when the mouse hover on a icon it will show a form like this:
I have made it like this:
And This is what I want
Windows has a facility for this, allowing you to basically create pseudo-taskbars that dock to the side of the screen and are always visible. It was used by the Office team (possibly publically documented for the Office team?) a long, long time ago to create a desktop toolbar.
Anyway, they are called Application Desktop Toolbars (or "AppBars"), and the documentation is here. To register one, you call the SHAppBarMessage function with the ABM_NEW message. Complete sample code is available in the linked documentation, unfortunately it is in C++.
To use this from a C# application, you will have to P/Invoke. As far as I know, it is not wrapped by the .NET Framework anywhere, probably because it never gets used by anyone anymore. This CodeProject article appears to have the necessary P/Invoke definitions written out. I can't vouch for their correctness, but armed with the documentation and that as an example, you should be able to cook up a working demo.
There is another CodeProject article here, written by Arik Poznanski as part of a series on using shell features from C#. It looks much more thorough, probably more than you need.
Set the property Form.TopMost unless you have other programs creating topmost windows. Doh!

JAWS accessiblity software with .Net

I have a XAML form on a desktop application running .net 4.5 that dynamically changes the forms displayed on the window based on the selected comboBox.
My issue is that JAWS accessiblity software is reading the my combobox name incorrectly. Instead of reading the correct label for the field it's reading a hidden label.
Is there a .Net accessibility class that will help for screen readers or is there a XAML .Net attribute similar to the "aria-hidden"? Which hides fields from screen readers, which I could do dynamically.
So as we hashed out in the comments, JAWS adopted full UI Automation support years ago which provides folks on the dev end multiple quick/easy ways to get around some of the Accessibility hurdles.
For your instance it's all about AutomationProperties to instruct the reader what it actually cares about. Kind of an adhoc equivalent to aria stuff you're probably familiar with from the HTML world.
In any event, AutomationProperties.LabeledBy (or in other scenarios AutomationProperties.Name) give you a quick way to define the readers only respected string context to define an object or a section with a description it will apply only to that object, or to that object/panel and it's children as the source of truth as far as the reader is concerned.
Hope this helps, I mean who doesn't love being a hero? heh, cheers!

Allowing user to print specific pages in C# WPF FlowDocument Application

The box above is what is called when a print() method is initiated on a flowDocumentPageViewer of flowDocumentScrollViewer.
In My application, I want my users to be able to select specific page range to print but the options seems to be disabled in the printbox. is there a way I can activate this in code.
Help will be appreciated as this tied to to a project I am doing.
After alot of surfing the internet with no answer, I decided to check out my Library, my best pick was pro WPF 4.5 in c# 4th edition and I got the answer on page 941 chapter 29. Actually have read this before but I did not pick to detail and the author stressed that calling PrintDialog.UserPageRangeEnabled and others should be done before calling PrintDialog.ShowDialog()
I fixed this with that and viola, after months of stress, I got it right.
Although most of the printing features like PrintDialog.currentPageEnabled and PrintDialog.SelectedPagesEnabled are supported only in .NET 4.5 but I'm ok with with the PrintDialog.UserPageRangeEnabled because my app targets .NET 4 CF for I want it to be available to window xp users.
Below is the box now.
Please take a look at the following post which explains printing from a FlowDocument:
Printing a WPF FlowDocument
You can find out more from 'Mitesh Sureja's Blog':
Printing Flow Document using WPF PrintDialog

C#: How to create a window like this?

I need to create a window similar to this:
a window similar to the types of dialog boxes that have been included with windows vista.
but I could not find exactly the same dialog boxes. very similar - it's Credential dialog and Input dialog. In the first case there are differences in the UI, in the second - the number of input fields and the absence of label. How can I make exactly the same window? Sorry for bad English.
You want to create a dialog exactly like the first dialog you've shown, the one used by FluffyApp?
You'll have to create it yourself, by hand. It's not a standard Windows dialog; it's a custom dialog resource provided by the FluffyApp application. It's obviously modeled to look a lot like the standard Windows authentication dialog, which is a good idea—users are already familiar with the native UI and will find your application to be much easier to use if it strongly resembles what they're already accustomed to. I recommend that if you decide to create your own custom dialog that you follow Windows's example as well.
But it's not entirely clear why you need your dialog to look exactly like the one that FluffyApp uses. I'm not really even sure why FluffyApp needed to create a custom dialog! It seems like the standard Windows authentication dialog would be perfectly sufficient. They have the same number of input fields, the UI designers at Microsoft have just replaced labels with cue banners. Not anything to worry about.
Those are standard windows dialogs, but instead of letting the dialog manager draw the text, they use DrawThemeText to draw the text, using one of the themed elements (not sure what, because you have several examples). You can play around with the various parameters to DrawThemeText to come up with something that works.

Programatically deactivating a feature in Internet Explorer

I'm currently developing a plug in for Internet Explorer, and there's a certain feature in Internet Explorer that's bothering me.
There's this feature in IE that's been appearing at least since IE7 (I couldn't check earlier versions), that lets the user modify the sizing of HTML elements in editable windows (such as a rich text mail in GMail), just by clicking on the element and dragging the sizing box. This modifies the style of the HTML element (such as a <img> or a <div>).
My first problem is that I don't know the name of that feature. I've searched and searched, but I haven't been able to find a thing.
My second problem is that I need a way to either turn it off, or at least to work with it, programatically. In my plug in, I need to modify the DOM in webmail clients to modify certain things that the user types. The problem is that for some reason, the behaviour of my plugin varies if an HTML element is selected using this feature in the edit window of the webmail. I need to, at the very least, be able to detect if anything is selected this way.
Any help will be appreciated. Thanks a lot!
You're probably talking about Internet Explorer's Accessibility Features, which are designed to assist the visually impaired to use websites. Visual impairement can take many forms, and it's generally considered very bad form to take away any tools designed to assist users in their efforts to effectively use the Internet.
Don't make your users work harder to use your site. You get paid to write software that's easy to use and makes life simpler. If your site doesn't do that, your users will find one that does.

Categories

Resources