Graphics.FromHdc メソッドとは? わかりやすく解説

Graphics.FromHdc メソッド (IntPtr)

デバイス コンテキスト識別する指定ハンドルから新しGraphics作成します

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

解説解説
使用例使用例

次の例は、Windows フォームでの使用意図してデザインされており、Paint イベント ハンドラパラメータである PaintEventArgse が必要です。このコードでは次のアクション実行します

<System.Security.Permissions.SecurityPermission( _
System.Security.Permissions.SecurityAction.LinkDemand, Flags := _
System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)> _
Public Sub FromHdcHdc(ByVal
 e As PaintEventArgs)

    ' Get handle to device context.
    Dim hdc As IntPtr = e.Graphics.GetHdc()

    ' Create new graphics object using handle to device context.
    Dim newGraphics As Graphics = Graphics.FromHdc(hdc)

    ' Draw rectangle to screen.
    newGraphics.DrawRectangle(New Pen(Color.Red, 3), 0, 0, 200,
 100)

    ' Release handle to device context and dispose of the Graphics 
    ' object
    e.Graphics.ReleaseHdc(hdc)
    newGraphics.Dispose()
End Sub
[System.Security.Permissions.SecurityPermission(
System.Security.Permissions.SecurityAction.LinkDemand, Flags = 
System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)]            
public void FromHdcHdc(PaintEventArgs e)
{

    // Get handle to device context.
    IntPtr hdc = e.Graphics.GetHdc();

    // Create new graphics object using handle to device context.
    Graphics newGraphics = Graphics.FromHdc(hdc);

    // Draw rectangle to screen.
    newGraphics.DrawRectangle(new Pen(Color.Red, 3), 0, 0, 200,
 100);

    // Release handle to device context and dispose of the      // Graphics
 object
    e.Graphics.ReleaseHdc(hdc);
    newGraphics.Dispose();
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.FromHdc メソッド


Graphics.FromHdc メソッド (IntPtr, IntPtr)

デバイス コンテキスト識別する指定ハンドルと、デバイス識別する指定ハンドルから、新しGraphics作成します

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Shared Function FromHdc
 ( _
    hdc As IntPtr, _
    hdevice As IntPtr _
) As Graphics
Dim hdc As IntPtr
Dim hdevice As IntPtr
Dim returnValue As Graphics

returnValue = Graphics.FromHdc(hdc, hdevice)
public static Graphics FromHdc (
    IntPtr hdc,
    IntPtr hdevice
)
public:
static Graphics^ FromHdc (
    IntPtr hdc, 
    IntPtr hdevice
)
public static Graphics FromHdc (
    IntPtr hdc, 
    IntPtr hdevice
)
public static function FromHdc
 (
    hdc : IntPtr, 
    hdevice : IntPtr
) : Graphics

パラメータ

hdc

デバイス コンテキスト識別するハンドル

hdevice

デバイス識別するハンドル

戻り値
このメソッドは、指定デバイス コンテキストおよびデバイス新しGraphics返します

解説解説
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「Graphics.FromHdc メソッド」の関連用語

Graphics.FromHdc メソッドのお隣キーワード
検索ランキング

   

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



Graphics.FromHdc メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS