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

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ControlPaint.DrawButton メソッドの意味・解説 

ControlPaint.DrawButton メソッド (Graphics, Int32, Int32, Int32, Int32, ButtonState)

ボタン コントロールを、指定した状態で、指定したグラフィックス表面指定した範囲内描画ます。

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

Public Shared Sub DrawButton
 ( _
    graphics As Graphics, _
    x As Integer, _
    y As Integer, _
    width As Integer, _
    height As Integer, _
    state As ButtonState _
)
Dim graphics As Graphics
Dim x As Integer
Dim y As Integer
Dim width As Integer
Dim height As Integer
Dim state As ButtonState

ControlPaint.DrawButton(graphics, x, y, width, height, state)
public static void DrawButton
 (
    Graphics graphics,
    int x,
    int y,
    int width,
    int height,
    ButtonState state
)
public:
static void DrawButton (
    Graphics^ graphics, 
    int x, 
    int y, 
    int width, 
    int height, 
    ButtonState state
)
public static void DrawButton
 (
    Graphics graphics, 
    int x, 
    int y, 
    int width, 
    int height, 
    ButtonState state
)
public static function DrawButton
 (
    graphics : Graphics, 
    x : int, 
    y : int, 
    width : int, 
    height : int, 
    state : ButtonState
)

パラメータ

graphics

描画する Graphics

x

描画する四角形左上隅の x 座標

y

描画する四角形左上隅の y 座標

width

ボタンの幅。

height

ボタンの高さ。

state

描画するボタンの状態を指定する ButtonState 値のビットごとの組み合わせ

使用例使用例
Imports System
Imports System.Drawing
Imports System.Windows.Forms

    Public Class Form1
        Inherits System.Windows.Forms.Form

        Private button1 As System.Windows.Forms.Button
 = New Button
        Private button2 As System.Windows.Forms.Button
 = New Button

        <System.STAThreadAttribute()>  _
        Public Shared Sub
 Main()
            System.Windows.Forms.Application.Run(New Form1)
        End Sub

        Public Sub New()
            Me.button2.Location = New Point(0,
 button1.Height + 10)
            AddHandler Me.button2.Click, AddressOf
 Me.button2_Click
            Me.Controls.Add(Me.button1)
            Me.Controls.Add(Me.button2)
        End Sub

        Private Sub button2_Click(sender As
 Object, e As System.EventArgs)
            ' Draws a flat button on button1.
            ControlPaint.DrawButton(System.Drawing.Graphics.FromHwnd(button1.Handle),
 0, 0, button1.Width, button1.Height, ButtonState.Flat)
        End Sub 'button2_Click
End Class
using System;
using System.Drawing;
using System.Windows.Forms;

public class Form1 : Form
{
      private Button button1 = new Button();
      private Button button2 = new Button();


    [STAThread]
    static void Main() 
    {
        Application.Run(new Form1());
    }


    public Form1(){
        this.button2.Location = new Point(0,
 button1.Height + 10);
        this.Click += new EventHandler(this.button2_Click);
        this.Controls.Add(this.button1);
        this.Controls.Add(this.button2);
    }

    private void button2_Click(object sender,
 System.EventArgs e)
    {
        // Draws a flat button on button1.
        ControlPaint.DrawButton(
        System.Drawing.Graphics.FromHwnd(button1.Handle),0,0,button1.Width,button1.Height
,
                ButtonState.Flat);
    }
}
#using <System.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>

using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;
public ref class Form1: public
 Form
{
private:
   Button^ button1;
   Button^ button2;

public:
   Form1()
   {
      button1 = gcnew Button;
      button2 = gcnew Button;
      this->button2->Location = Point(0,button1->Height
 + 10);
      this->Click += gcnew EventHandler( this,
 &Form1::button2_Click );
      this->Controls->Add( this->button1
 );
      this->Controls->Add( this->button2
 );
   }


private:

   void button2_Click( Object^ /*sender*/, System::EventArgs^
 /*e*/ )
   {
      
      // Draws a flat button on button1.
      ControlPaint::DrawButton( System::Drawing::Graphics::FromHwnd( button1->Handle
 ), 0, 0, button1->Width, button1->Height, ButtonState::Flat );
   }

};


[STAThread]
void main()
{
   Application::Run( gcnew Form1 );
}

import System.*;
import System.Drawing.*;
import System.Windows.Forms.*;

public class Form1 extends Form
{
    private Button button1 = new Button();
    private Button button2 = new Button();

    /** @attribute STAThread()
     */
    public static void main(String[]
 args)
    {
        Application.Run(new Form1());
    } //main

    public Form1()
    {
        this.button2.set_Location(new Point(0,
 button1.get_Height() + 10));
        this.add_Click(new EventHandler(this.button2_Click));
        this.get_Controls().Add(this.button1);
        this.get_Controls().Add(this.button2);
    } //Form1

    private void button2_Click(Object sender,
 System.EventArgs e)
    {
        // Draws a flat button on button1.
        ControlPaint.DrawButton(System.Drawing.Graphics.FromHwnd(
            button1.get_Handle()), 0, 0, button1.get_Width(), 
            button1.get_Height(), ButtonState.Flat);
    } //button2_Click
} //Form1
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ControlPaint.DrawButton メソッド


ControlPaint.DrawButton メソッド (Graphics, Rectangle, ButtonState)

ボタン コントロールを、指定した状態で、指定したグラフィックス表面指定した範囲内描画ます。

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

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「ControlPaint.DrawButton メソッド」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS