コード例 #1
0
ファイル: TryData4Dlg.cpp プロジェクト: Biotron/kpgweigher
HRESULT CTryData4Dlg::OnMouseOverOnce(IHTMLElement *phtmlElement)
{
	if(m_State == RUNNING) return S_OK;
	if(m_sDataSel.Find("测量结果") < 0)
		return S_OK;
	CString sel = this->GetAttribute(phtmlElement,m_elemTypes[2]);
	if(sel.IsEmpty() || sel[0] != 'Z')
		return S_OK;
	m_sDataUrl = this->GetAttribute(phtmlElement,m_elemTypes[4]);
//	if(m_sDataUrl.FindOneOf("0123456789") < 0)		return S_OK;
	IHTMLStyle *phtmlStyle;
	phtmlElement->get_style(&phtmlStyle);
	if (phtmlStyle)
	{
		CString retest("单击测量");
		phtmlElement->put_innerText(retest.AllocSysString());

		VARIANT varColor;
		varColor.vt = VT_I4;
		varColor.lVal = 0x990033;
		phtmlStyle->put_backgroundColor(varColor);
		phtmlStyle->put_textDecorationUnderline(VARIANT_TRUE);
//		phtmlStyle->put_color(varColor);
		phtmlStyle->put_cursor(L"hand");
		phtmlStyle->Release();
	}
	m_spCurrElement = phtmlElement;
	return S_OK;
}
コード例 #2
0
ファイル: TryData4Dlg.cpp プロジェクト: Biotron/kpgweigher
HRESULT CTryData4Dlg::OnMouseOutOnce(IHTMLElement *phtmlElement)
{
	if(m_State == RUNNING) return S_OK;
	if(m_sDataSel.Find("测量结果") < 0)
		return S_OK;
	CString sel = this->GetAttribute(phtmlElement,m_elemTypes[2]);
	if(sel.IsEmpty() || sel[0] != 'Z')
		return S_OK;

	IHTMLStyle *phtmlStyle;
	phtmlElement->get_style(&phtmlStyle);
	if (phtmlStyle)
	{
		if(m_spCurrElement != NULL){
			phtmlElement->put_innerText(m_sDataUrl.AllocSysString());
			m_sDataUrl.Empty();
		}

		VARIANT varColor;
		varColor.vt = VT_BSTR;
		varColor.bstrVal = L"transparent";
		phtmlStyle->put_backgroundColor(varColor);

		varColor.vt = VT_I4;
		varColor.lVal = 0x3366CC;
		phtmlStyle->put_textDecorationUnderline(VARIANT_FALSE);
//		phtmlStyle->put_color(varColor);
		phtmlStyle->Release();
	}
	m_spCurrElement = NULL;
	return S_OK;
}
コード例 #3
0
ファイル: TryData4Dlg.cpp プロジェクト: Biotron/kpgweigher
HRESULT CTryData4Dlg::OnMouseOutUrl(IHTMLElement *phtmlElement)
{
	CString id=GetAttribute(phtmlElement,m_elemTypes[2]);
	IHTMLStyle *phtmlStyle;
	phtmlElement->get_style(&phtmlStyle);
	if (phtmlStyle)
	{
		VARIANT varColor;
		varColor.vt = VT_I4;
		varColor.lVal = 0x3366CC;
		phtmlStyle->put_textDecorationUnderline(VARIANT_FALSE);
		phtmlStyle->put_color(varColor);
		phtmlStyle->Release();
	}
	m_spCurrElement = NULL;
	return S_OK;
}
コード例 #4
0
ファイル: TryData4Dlg.cpp プロジェクト: Biotron/kpgweigher
HRESULT CTryData4Dlg::OnMouseOverUrl(IHTMLElement *phtmlElement)
{
	CString id=GetAttribute(phtmlElement,m_elemTypes[2]);

	IHTMLStyle *phtmlStyle;
	phtmlElement->get_style(&phtmlStyle);
	if (phtmlStyle)
	{
		VARIANT varColor;
		varColor.vt = VT_I4;
		if(id.Find("page_") >= 0)
			varColor.lVal = 0x333333;
		else
			varColor.lVal = 0x330033;
		phtmlStyle->put_textDecorationUnderline(VARIANT_TRUE);
		phtmlStyle->put_color(varColor);
		phtmlStyle->put_cursor(L"hand");
		phtmlStyle->Release();
	}
	m_spCurrElement = phtmlElement;
	return S_OK;
}
コード例 #5
0
ファイル: TextRenderBrain.cpp プロジェクト: daisy/amis
//this is called to refresh the page colors
//the colors might have changed but the element cursor hasn't moved yet
//so without a call to this function, the old color settings would persist
void TextRenderBrain::redoHighlightColors()
{
	USES_CONVERSION;
	IHTMLStyle* pStyle = NULL;
	if (mpPreviousElm != NULL)
	{		
		//get a pointer to the style
		mpPreviousElm->get_style(&pStyle);
				
		//variables for the colors
		string str_text_fg, str_text_bg;
		VARIANT var_bg;
		VARIANT var_fg;
		VariantInit(&var_bg);
		VariantInit(&var_fg);
		
		//get as strings
		str_text_fg = amis::Preferences::Instance()->getHighlightFGColor().getAsHtmlHexColor();
		str_text_bg = amis::Preferences::Instance()->getHighlightBGColor().getAsHtmlHexColor();
		
		//convert to chars
		const char* textfg_color = str_text_fg.c_str();
		const char* textbg_color = str_text_bg.c_str();

		//convert to bstr/variant 
		var_fg.vt = VT_BSTR;
		var_fg.bstrVal = A2BSTR(textfg_color);
		var_bg.vt = VT_BSTR;
		var_bg.bstrVal = A2BSTR(textbg_color);

		//set the properties
		pStyle->put_backgroundColor(var_bg);
		pStyle->put_color(var_fg);

		SysFreeString(var_fg.bstrVal);
		SysFreeString(var_bg.bstrVal);
	}
}