Ejemplo n.º 1
0
void Button::OnPaint( PaintEventArgs* e )
{
	if (_state == Hover)
	{
		set_BackColor(SystemColors::ButtonHighlight);
		Image* image = _stateImages[Hover];
		if (image == null)
			image = _stateImages[Normal];
		set_BackgroundImage(image, false);
	}	
	else if (_state == HoverPressed)
	{
		set_BackColor(SystemColors::ButtonShadow);
		Image* image = _stateImages[Pressed];
		if (image == null)
			image = _stateImages[Normal];
		set_BackgroundImage(image, false);
	}
	else
	{
		set_BackColor(SystemColors::ButtonFace);
		set_BackgroundImage(_stateImages[Normal], false);
	}

	ButtonBase::OnPaint(e);

	Graphics& g = e->Graphics;

	Drawing::Pen pen(Color::Black);
	g.DrawRectangle(pen, 1, 1, get_Size().Width - 1, get_Size().Height - 1);

	SolidBrush brush(SystemColors::ControlText);
	g.DrawString(get_Text(), *SystemFonts::DefaultFont, brush, PointF(3, 3));
}
Ejemplo n.º 2
0
inline _bstr_t IScriptError::GetText ( ) {
    BSTR _result;
    HRESULT _hr = get_Text(&_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _bstr_t(_result, false);
}