Margins コンストラクタ

名前 | 説明 |
---|---|
Margins () | Margins クラスの新しいインスタンスを 1 インチ幅の余白で初期化します。 |
Margins (Int32, Int32, Int32, Int32) | Margins クラスの新しいインスタンスを指定した上下左右の余白で初期化します。 |

Margins コンストラクタ (Int32, Int32, Int32, Int32)
アセンブリ: System.Drawing (system.drawing.dll 内)

Dim left As Integer Dim right As Integer Dim top As Integer Dim bottom As Integer Dim instance As New Margins(left, right, top, bottom)


この例では、System.Drawing、System.Drawing.Printing、および System.IO の各名前空間を使用します。
ドキュメントの既定のページ設定として、左右の余白を 1 インチ幅に設定するコード例を次に示します。
Public Sub Printing() Try ' This assumes that a variable of type string, named filePath , ' has been set to the path of the file to print. streamToPrint = New StreamReader(filePath) Try printFont = New Font("Arial", 10) Dim pd As New PrintDocument() ' This assumes that a method, named pd_PrintPage, has been ' defined. pd_PrintPage handles the PrintPage event. AddHandler pd.PrintPage, AddressOf pd_PrintPage ' This assumes that a variable of type string, named ' printer, has been set to the printer's name. pd.PrinterSettings.PrinterName = printer ' Create a new instance of Margins with one inch margins. Dim margins As New Margins(100, 100, 100, 100) pd.DefaultPageSettings.Margins = margins pd.Print() Finally streamToPrint.Close() End Try Catch ex As Exception MessageBox.Show("An error occurred printing the file - " & ex.Message) End Try End Sub
public void Printing() { try { /* This assumes that a variable of type string, named filePath , has been set to the path of the file to print. */ streamToPrint = new StreamReader (filePath); try { printFont = new Font("Arial", 10); PrintDocument pd = new PrintDocument(); /* This assumes that a method, named pd_PrintPage, has been defined. pd_PrintPage handles the PrintPage event. */ pd.PrintPage += new PrintPageEventHandler(pd_PrintPage); /* This assumes that a variable of type string, named printer, has been set to the printer's name. */ pd.PrinterSettings.PrinterName = printer; // Create a new instance of Margins with one inch margins. Margins margins = new Margins(100,100,100,100); pd.DefaultPageSettings.Margins = margins; pd.Print(); } finally { streamToPrint.Close() ; } } catch(Exception ex) { MessageBox.Show("An error occurred printing the file - " + ex.Message); } }
void Printing() { try { /* This assumes that a variable of type string, named filePath , has been set to the path of the file to print. */ streamToPrint = gcnew StreamReader( filePath ); try { printFont = gcnew System::Drawing::Font( "Arial",10 ); PrintDocument^ pd = gcnew PrintDocument; /* This assumes that a method, named pd_PrintPage, has been defined. pd_PrintPage handles the PrintPage event. */ pd->PrintPage += gcnew PrintPageEventHandler( this, &Sample::pd_PrintPage ); /* This assumes that a variable of type string, named printer, has been set to the printer's name. */ pd->PrinterSettings->PrinterName = printer; // Create a new instance of Margins with one inch margins. Margins^ margins = gcnew Margins( 100,100,100,100 ); pd->DefaultPageSettings->Margins = margins; pd->Print(); } finally { streamToPrint->Close(); } } catch ( Exception^ ex ) { MessageBox::Show( String::Concat( "An error occurred printing the file - ", ex->Message ) ); } }
public void Printing() { try { /* This assumes that a variable of type string, named filePath , has been set to the path of the file to print. */ streamToPrint = new StreamReader(filePath); try { printFont = new Font("Arial", 10); PrintDocument pd = new PrintDocument(); /* This assumes that a method, named pd_PrintPage, has been defined. pd_PrintPage handles the PrintPage event. */ pd.add_PrintPage(new PrintPageEventHandler(pd_PrintPage)); /* This assumes that a variable of type string, named printer, has been set to the printer's name. */ pd.get_PrinterSettings().set_PrinterName(printer); // Create a new instance of Margins with one inch margins. Margins margins = new Margins(100, 100, 100, 100); pd.get_DefaultPageSettings().set_Margins(margins); pd.Print(); } finally { streamToPrint.Close(); } } catch (System.Exception ex) { MessageBox.Show(("An error occurred printing the file - " + ex.get_Message())); } } //Printing

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Margins コンストラクタ ()
アセンブリ: System.Drawing (system.drawing.dll 内)


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からMargins コンストラクタを検索する場合は、下記のリンクをクリックしてください。

- Margins コンストラクタのページへのリンク