Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: Define the printer to a type of document

$
0
0

I found an example for doing this. You can automatically bind a combo box control to the printer collection by adding the following namespace to your xaml:

xmlns:Printing="clr-namespace:System.Drawing.Printing;assembly=System.Drawing"

and then adding the System.Drawing assembly to your project references.

You can then define the combobox with:

<ComboBox x:Name="prtcomboBox" HorizontalAlignment="Left" Margin="89,119,0,0" VerticalAlignment="Top" Width="301" Height="21" ItemsSource="{x:Static Printing:PrinterSettings.InstalledPrinters}" SelectionChanged="prtcomboBox_SelectionChanged" />

Everytime a new printer is selected the prtcomboBox_SelectionChanged event will be triggered so you can get the selected printer name.

method-id prtcomboBox_SelectionChanged.
      procedure division using by value sender as object e as type System.Windows.Controls.SelectionChangedEventArgs.
          set textBox1::Text to prtcomboBox::SelectedValue
      end method.


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>