ToolBarButton.PartialPush 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
토글 스타일 도구 모음 단추가 부분적으로 눌리는지 여부를 나타내는 값을 가져오거나 설정합니다.
public:
property bool PartialPush { bool get(); void set(bool value); };
public bool PartialPush { get; set; }
member this.PartialPush : bool with get, set
Public Property PartialPush As Boolean
속성 값
토글 스타일 도구 모음 단추가 부분적으로 눌리면 true
이고, 그렇지 않으면 false
입니다. 기본값은 false
입니다.
예제
다음 코드 예제를 사용 하는 방법에 설명 합니다 Pushed, 및 PartialPush 속성입니다. 예제를 실행 하려면 다음 코드를 포함 하는 폼의 붙여를 RichTextBox 이라는 컨트롤 RichTextBox1
합니다. 호출 된 InitializeToolBar
폼의 생성자 또는 Load
메서드.
// Declare ToolBar1.
internal:
System::Windows::Forms::ToolBar^ ToolBar1;
private:
// Initialize ToolBar1 with Bold(B), Italic(I), and
// Underline(U) buttons.
void InitializeToolBar()
{
ToolBar1 = gcnew ToolBar;
// Set the appearance to Flat.
ToolBar1->Appearance = ToolBarAppearance::Flat;
// Set the toolbar to dock at the bottom of the form.
ToolBar1->Dock = DockStyle::Bottom;
// Set the toolbar font to 14 points and bold.
ToolBar1->Font = gcnew System::Drawing::Font( FontFamily::GenericSansSerif,14,FontStyle::Bold );
// Declare fontstyle array with the three font styles.
array<FontStyle>^ fonts = {FontStyle::Bold,FontStyle::Italic,FontStyle::Underline};
int count;
// Create a button for each value in the array, setting its
// text to the first letter of the style and its
// button's tag property.
for ( count = 0; count < fonts->Length; count++ )
{
ToolBarButton^ fontButton = gcnew ToolBarButton( fonts[ count ].ToString()->Substring( 0, 1 ) );
fontButton->Style = ToolBarButtonStyle::ToggleButton;
fontButton->Tag = fonts[ count ];
ToolBar1->Buttons->Add( fontButton );
}
this->ToolBar1->ButtonClick += gcnew ToolBarButtonClickEventHandler( this, &Form1::ToolBar1_ButtonClick );
this->Controls->Add( this->ToolBar1 );
}
// Declare FontStyle object, which defaults to the Regular
// FontStyle.
FontStyle style;
void ToolBar1_ButtonClick( Object^ /*sender*/, System::Windows::Forms::ToolBarButtonClickEventArgs^ e )
{
// If a button is pushed, use a bitwise Or combination
// of the style variable and the button tag, to set style to
// the correct FontStyle. Set the button's PartialPush
// property to true for a Windows XP-like appearance.
if ( e->Button->Pushed )
{
e->Button->PartialPush = true;
style = (FontStyle)(style | safe_cast<FontStyle>(e->Button->Tag));
}
else
{
// If the button was not pushed, use a bitwise XOR
// combination to turn off that style
// and set the PartialPush property to false.
e->Button->PartialPush = false;
style = (FontStyle)(style ^ safe_cast<FontStyle>(e->Button->Tag));
}
// Set the font using the existing RichTextBox font and the new
// style.
RichTextBox1->Font = gcnew System::Drawing::Font( RichTextBox1->Font,style );
}
// Declare ToolBar1.
internal System.Windows.Forms.ToolBar ToolBar1;
// Initialize ToolBar1 with Bold(B), Italic(I), and
// Underline(U) buttons.
private void InitializeToolBar()
{
ToolBar1 = new ToolBar();
// Set the appearance to Flat.
ToolBar1.Appearance = ToolBarAppearance.Flat;
// Set the toolbar to dock at the bottom of the form.
ToolBar1.Dock = DockStyle.Bottom;
// Set the toolbar font to 14 points and bold.
ToolBar1.Font = new Font(FontFamily.GenericSansSerif,
14, FontStyle.Bold);
// Declare fontstyle array with the three font styles.
FontStyle[] fonts = new FontStyle[]{FontStyle.Bold,
FontStyle.Italic, FontStyle.Underline};
int count;
// Create a button for each value in the array, setting its
// text to the first letter of the style and its
// button's tag property.
for(count=0; count<fonts.Length; count++)
{
ToolBarButton fontButton =
new ToolBarButton(fonts[count].ToString().Substring(0, 1));
fontButton.Style = ToolBarButtonStyle.ToggleButton;
fontButton.Tag = fonts[count];
ToolBar1.Buttons.Add(fontButton);
}
this.ToolBar1.ButtonClick +=
new ToolBarButtonClickEventHandler(ToolBar1_ButtonClick);
this.Controls.Add(this.ToolBar1);
}
// Declare FontStyle object, which defaults to the Regular
// FontStyle.
FontStyle style = new FontStyle();
private void ToolBar1_ButtonClick(object sender,
System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
// If a button is pushed, use a bitwise Or combination
// of the style variable and the button tag, to set style to
// the correct FontStyle. Set the button's PartialPush
// property to true for a Windows XP-like appearance.
if (e.Button.Pushed)
{
e.Button.PartialPush = true;
style = style |(FontStyle) e.Button.Tag;
}
else
{
// If the button was not pushed, use a bitwise XOR
// combination to turn off that style
// and set the PartialPush property to false.
e.Button.PartialPush = false;
style = style ^ (FontStyle) e.Button.Tag;
}
// Set the font using the existing RichTextBox font and the new
// style.
RichTextBox1.Font = new Font(RichTextBox1.Font, style);
}
' Declare ToolBar1.
Friend WithEvents ToolBar1 As System.Windows.Forms.ToolBar
' Initialize ToolBar1 with Bold(B), Italic(I), and Underline(U) buttons.
Private Sub InitializeToolBar()
ToolBar1 = New ToolBar
' Set the appearance to Flat.
ToolBar1.Appearance = ToolBarAppearance.Flat
' Set the toolbar to dock at the bottom of the form.
ToolBar1.Dock = DockStyle.Bottom
' Set the toolbar font to 14 points and bold.
ToolBar1.Font = New System.Drawing.Font _
(FontFamily.GenericSansSerif, 14, FontStyle.Bold)
' Declare fontstyle array with the three font styles.
Dim fonts() As FontStyle = New FontStyle() _
{FontStyle.Bold, FontStyle.Italic, FontStyle.Underline}
Dim count As Integer
' Create a button for each value in the array, setting its text to the
' first letter of the style and its button's tag property.
For count = 0 To fonts.Length - 1
Dim fontButton As New ToolBarButton(fonts(count). _
ToString.Substring(0, 1))
fontButton.Style = ToolBarButtonStyle.ToggleButton
fontButton.Tag = fonts(count)
ToolBar1.Buttons.Add(fontButton)
Next
Me.Controls.Add(Me.ToolBar1)
End Sub
' Declare FontStyle object, which defaults to the Regular FontStyle.
Dim style As New FontStyle
Private Sub ToolBar1_ButtonClick(ByVal sender As Object, _
ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) _
Handles ToolBar1.ButtonClick
' If a button is pushed, use a bitwise Or combination
' of the style variable and the button tag, to set style to
' the correct FontStyle. Set the button's PartialPush property to
' true for a Windows XP-like appearance.
If (e.Button.Pushed) Then
e.Button.PartialPush = True
style = style Or e.Button.Tag
Else
' If the button was not pushed, use a bitwise XOR
' combination to turn off that style
' and set the PartialPush property to False.
e.Button.PartialPush = False
style = style Xor e.Button.Tag
End If
' Set the font using the existing RichTextBox font and the new
' style.
RichTextBox1.Font = New Font(RichTextBox1.Font, style)
End Sub
설명
때 PartialPush 로 설정 된 true
, 표면이 회색에 도구 모음 단추가 나타납니다. 이 모양을 다른 흐리게 표시 되는 경우는 Enabled 속성이 false
부분 푸시 모양을 단추의 전체에 안개를 제공 하므로 합니다. 경우가 아니면이 속성은 아무런 영향을 주지는 ToolBarButtonStyle 로 설정 된 ToggleButton
합니다.