PrintPreviewDialog.UseAntiAlias プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > PrintPreviewDialog.UseAntiAlias プロパティの意味・解説 

PrintPreviewDialog.UseAntiAlias プロパティ

印刷においてオペレーティング システムアンチエイリアシング機能使用するかどうかを示す値を取得または設定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Dim instance As PrintPreviewDialog
Dim value As Boolean

value = instance.UseAntiAlias

instance.UseAntiAlias = value
public bool UseAntiAlias { get;
 set; }
public:
property bool UseAntiAlias {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_UseAntiAlias ()

/** @property */
public void set_UseAntiAlias (boolean value)
public function get UseAntiAlias
 () : boolean

public function set UseAntiAlias
 (value : boolean)

プロパティ
アンチエイリアシング使用する場合trueそれ以外場合false

解説解説

アンチエイリアシング使用すると、フォント描画するときにジャグ ライン取り除かれます。

Document プロパティUseAntiAlias プロパティ設定する PrintPreviewDialog のコード例次に示します。この例では、TreeNode オブジェクトを含む TreeView1 という名前の TreeView がフォーム配置されていることを前提としています。TreeNode オブジェクトTag プロパティには、この例を実行するコンピュータからアクセスできるドキュメントの完全修飾名を設定する必要があります。各 TreeNode.Text プロパティには、TreeNode.Tag プロパティによって指定されファイル識別するための文字列設定します。たとえば、TreeNode1.Tag を "c:\myDocuments\recipe.doc" に設定しTreeNode1.Text を "recipe.doc" に設定します。この例では、PrintPreviewDialog1 という名前の PrintPreviewDialog と、Button1 という名前のボタンフォーム配置されていることを前提としています。この例を実行するには、フォームコンストラクタまたは Loadイベント ハンドラInitializePrintPreviewDialog メソッド呼び出します。

' Declare the dialog.
Friend WithEvents PrintPreviewDialog1 As
 PrintPreviewDialog

' Declare a PrintDocument object named document.
Private WithEvents document As
 New System.Drawing.Printing.PrintDocument

' Initalize the dialog.
Private Sub InitializePrintPreviewDialog()

    ' Create a new PrintPreviewDialog using constructor.
    Me.PrintPreviewDialog1 = New PrintPreviewDialog

    'Set the size, location, and name.
    Me.PrintPreviewDialog1.ClientSize = New
 System.Drawing.Size(400, 300)
    Me.PrintPreviewDialog1.Location = New System.Drawing.Point(29,
 29)
    Me.PrintPreviewDialog1.Name = "PrintPreviewDialog1"

    ' Set the minimum size the dialog can be resized to.
    Me.PrintPreviewDialog1.MinimumSize = New
 System.Drawing.Size(375, 250)

    ' Set the UseAntiAlias property to true, which will allow the 
    ' operating system to smooth fonts.
    Me.PrintPreviewDialog1.UseAntiAlias = True
End Sub

Private Sub Button1_Click(ByVal
 sender As Object, _
    ByVal e As System.EventArgs) Handles
 Button1.Click

    If Not (TreeView1.SelectedNode Is
 Nothing) Then

        ' Set the PrintDocument object's name to the selectedNode
        ' object's  tag, which in this case contains the 
        ' fully-qualified name of the document. This value will 
        ' show when the dialog reports progress.
        document.DocumentName = TreeView1.SelectedNode.Tag
    End If

    ' Set the PrintPreviewDialog.Document property to
    ' the PrintDocument object selected by the user.
    PrintPreviewDialog1.Document = document

    ' Call the ShowDialog method. This will trigger the document's
    '  PrintPage event.
    PrintPreviewDialog1.ShowDialog()
End Sub

Private Sub document_PrintPage(ByVal
 sender As Object, _
    ByVal e As System.Drawing.Printing.PrintPageEventArgs)
 _
        Handles document.PrintPage

    ' Insert code to render the page here.
    ' This code will be called when the PrintPreviewDialog.Show 
    ' method is called.

    ' The following code will render a simple
    ' message on the document in the dialog.
    Dim text As String =
 "In document_PrintPage method."
    Dim printFont As New
 System.Drawing.Font _
        ("Arial", 35, System.Drawing.FontStyle.Regular)

    e.Graphics.DrawString(text, printFont, _
        System.Drawing.Brushes.Black, 0, 0)

End Sub
// Declare the dialog.
internal PrintPreviewDialog PrintPreviewDialog1;

// Declare a PrintDocument object named document.
private System.Drawing.Printing.PrintDocument document =
    new System.Drawing.Printing.PrintDocument();

// Initalize the dialog.
private void InitializePrintPreviewDialog()
{

    // Create a new PrintPreviewDialog using constructor.
    this.PrintPreviewDialog1 = new PrintPreviewDialog();

    //Set the size, location, and name.
    this.PrintPreviewDialog1.ClientSize = 
        new System.Drawing.Size(400, 300);
    this.PrintPreviewDialog1.Location = 
        new System.Drawing.Point(29, 29);
    this.PrintPreviewDialog1.Name = "PrintPreviewDialog1";
    
    // Associate the event-handling method with the 
    // document's PrintPage event.
    this.document.PrintPage += 
        new System.Drawing.Printing.PrintPageEventHandler
        (document_PrintPage);

    // Set the minimum size the dialog can be resized to.
    this.PrintPreviewDialog1.MinimumSize = 
        new System.Drawing.Size(375, 250);

    // Set the UseAntiAlias property to true, which will allow the 
    // operating system to smooth fonts.
    this.PrintPreviewDialog1.UseAntiAlias = true;
}

private void Button1_Click(object sender, System.EventArgs
 e)
{

    if (TreeView1.SelectedNode != null)

        // Set the PrintDocument object's name to the selectedNode
        // object's  tag, which in this case contains the 
        // fully-qualified name of the document. This value will 
        // show when the dialog reports progress.
    {
        document.DocumentName = TreeView1.SelectedNode.Tag.ToString();
    }

    // Set the PrintPreviewDialog.Document property to
    // the PrintDocument object selected by the user.
    PrintPreviewDialog1.Document = document;

    // Call the ShowDialog method. This will trigger the document's
    //  PrintPage event.
    PrintPreviewDialog1.ShowDialog();
}

private void document_PrintPage(object sender,
 
    System.Drawing.Printing.PrintPageEventArgs e)
{

    // Insert code to render the page here.
    // This code will be called when the PrintPreviewDialog.Show 
    // method is called.

    // The following code will render a simple
    // message on the document in the dialog.
    string text = "In document_PrintPage method.";
    System.Drawing.Font printFont = 
        new System.Drawing.Font("Arial", 35, 
        System.Drawing.FontStyle.Regular);

    e.Graphics.DrawString(text, printFont, 
        System.Drawing.Brushes.Black, 0, 0);

}
   // Declare the dialog.
internal:
   PrintPreviewDialog^ PrintPreviewDialog1;

private:

   // Declare a PrintDocument object named document.
   System::Drawing::Printing::PrintDocument^ document;

   // Initalize the dialog.
   void InitializePrintPreviewDialog()
   {
      
      // Create a new PrintPreviewDialog using constructor.
      this->PrintPreviewDialog1 = gcnew PrintPreviewDialog;
      
      //Set the size, location, and name.
      this->PrintPreviewDialog1->ClientSize = System::Drawing::Size(
 400, 300 );
      this->PrintPreviewDialog1->Location = System::Drawing::Point(
 29, 29 );
      this->PrintPreviewDialog1->Name = "PrintPreviewDialog1";
      
      // Associate the event-handling method with the 
      // document's PrintPage event.
      this->document->PrintPage += gcnew System::Drawing::Printing::PrintPageEventHandler(
 this, &Form1::document_PrintPage );
      
      // Set the minimum size the dialog can be resized to.
      this->PrintPreviewDialog1->MinimumSize = System::Drawing::Size(
 375, 250 );
      
      // Set the UseAntiAlias property to true, which will allow the
 
      // operating system to smooth fonts.
      this->PrintPreviewDialog1->UseAntiAlias = true;
   }

   void Button1_Click( Object^ /*sender*/, System::EventArgs^
 /*e*/ )
   {
      if ( TreeView1->SelectedNode != nullptr )
      {
         document->DocumentName = TreeView1->SelectedNode->Tag->ToString();
      }

      // Set the PrintPreviewDialog.Document property to
      // the PrintDocument object selected by the user.
      PrintPreviewDialog1->Document = document;
      
      // Call the ShowDialog method. This will trigger the document's
      //  PrintPage event.
      PrintPreviewDialog1->ShowDialog();
   }

   void document_PrintPage( Object^ /*sender*/, System::Drawing::Printing::PrintPageEventArgs^
 e )
   {
      
      // Insert code to render the page here.
      // This code will be called when the PrintPreviewDialog.Show 
      // method is called.
      // The following code will render a simple
      // message on the document in the dialog.
      String^ text = "In document_PrintPage method.";
      System::Drawing::Font^ printFont = gcnew System::Drawing::Font( "Arial",35,System::Drawing::FontStyle::Regular
 );
      e->Graphics->DrawString( text, printFont, System::Drawing::Brushes::Black,
 0, 0 );
   }
// Declare the dialog.
PrintPreviewDialog printPreviewDialog1;

// Declare a PrintDocument object named document.
private System.Drawing.Printing.PrintDocument document =
    new System.Drawing.Printing.PrintDocument();

// Initalize the dialog.
private void InitializePrintPreviewDialog()
{
    // Create a new PrintPreviewDialog using constructor.
    this.printPreviewDialog1 = new PrintPreviewDialog();
    //Set the size, location, and name.
    this.printPreviewDialog1.set_ClientSize(
        new System.Drawing.Size(400, 300));
    this.printPreviewDialog1.set_Location(new
 System.Drawing.Point(29, 29));
    this.printPreviewDialog1.set_Name("PrintPreviewDialog1");
    // Associate the event-handling method with the 
    // document's PrintPage event.
    this.document.add_PrintPage(
        new System.Drawing.Printing.PrintPageEventHandler(
        document_PrintPage));
    // Set the minimum size the dialog can be resized to.
    this.printPreviewDialog1.set_MinimumSize(
        new System.Drawing.Size(375, 250));
    // Set the UseAntiAlias property to true, which will allow the 
    // operating system to smooth fonts.
    this.printPreviewDialog1.set_UseAntiAlias(true);
} //InitializePrintPreviewDialog

private void button1_Click(Object sender, System.EventArgs
 e)
{
    if (treeView1.get_SelectedNode() != null)
 {
        // Set the PrintDocument object's name to the selectedNode
        // object's  tag, which in this case contains the 
        // fully-qualified name of the document. This value will 
        // show when the dialog reports progress.
        document.set_DocumentName(
            treeView1.get_SelectedNode().get_Tag().ToString());
    }
    // Set the PrintPreviewDialog.Document property to
    // the PrintDocument object selected by the user.
    printPreviewDialog1.set_Document(document);
    // Call the ShowDialog method. This will trigger the document's
    //  PrintPage event.
    printPreviewDialog1.ShowDialog();
} //button1_Click

private void document_PrintPage(Object sender
,
    System.Drawing.Printing.PrintPageEventArgs e)
{
    // Insert code to render the page here.
    // This code will be called when the PrintPreviewDialog.Show 
    // method is called.
    // The following code will render a simple
    // message on the document in the dialog.
    String text = "In document_PrintPage method.";
    System.Drawing.Font printFont =
        new System.Drawing.Font("Arial", 35,
        System.Drawing.FontStyle.Regular);

    e.get_Graphics().DrawString(text, printFont,
        System.Drawing.Brushes.get_Black(), 0, 0);
} //document_PrintPage
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

PrintPreviewDialog.UseAntiAlias プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



PrintPreviewDialog.UseAntiAlias プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS