跪求TextureBrush俩个构造函数使用问题!!!!!! TextureBrush( [in] Image *image, [in, ref] RectF &dstRect,//传入的值如何初始化 [in] ImageAttributes *imageAttributes //这个参数是什么意思???传入的值如何初始化);TextureBrush( [in] Image *image, [in] WrapMode wrapMode //这个参数是什么意思???传入的值如何初始化); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 看不懂 才过来问的 C#不是用GDI+挺常用的吗??? 看不懂 才过来问的 C#不是用GDI+挺常用的吗??? 如果msdn的看不懂?我自认我比msdn差的远,估计给你解释不了。 http://msdn.microsoft.com/zh-cn/library/system.drawing.texturebrush.texturebrush(v=vs.80).aspx- -!、、对于你的 我只知道第一个中的ImageAttribute.... msdn已经有相当直白的解释,如果你已英文不好做理由,难道你不会用google这么简单的问题发在这里,只能说明不是你笨,就是你懒,或者即笨且懒 C#中RectF &dstRect //dstRect = new dstRect ();ImageAttributes *imageAttributes //指定图片属性,使用ImageAttributes 中定义的选项初始化WrapMode wrapMode //换行用的,使用WarpMode中定义的选项初始化 没怎么看明白 我的意思是把一个画刷填充一个png图片,用这个画刷画控件背景色. 不是吧 代码 给你了 吗?void CDlgBase::OnPaint(){ GetUpdateRect(&m_rcUpdate, FALSE);// do not delete this CPaintDC dc(this); dc.SetBkMode(TRANSPARENT); CRect rcClient; GetClientRect(rcClient); Example_DrawImage4(dc); return;#if 0 Bitmap *bmp = new Bitmap(L"24a.png");//"closedown.png"); int wid=bmp->GetWidth(); int hei=bmp->GetHeight(); afxDump << wid << ";" << hei << "\n";// 480,800// color to grey for(int i=0;i<wid;i++) { for(int j=0;j<hei;j++) { Gdiplus::Color pix; bmp->GetPixel(i,j,&pix); BYTE gray = pix.GetRed()*0.2+pix.GetGreen()*0.4+pix.GetBlue()*0.2; ARGB argb=(pix.GetA() << 24) | (gray << 16) | (gray << 8) | gray; bmp->SetPixel(i,j,argb); } } TextureBrush *brush = new TextureBrush(bmp); Graphics graphics(dc); graphics.FillRectangle(brush, (Gdiplus::Rect &) rcClient); return ;//#endif//改成 #if 1 就行了 Bitmap *bmp = new Bitmap(L"24a.png");//"closedown.png");//位图new一个png???我看TextureBrush构造函数 不是可以加载Image吗?Image不就可以加载Png图片吗?//可以构造函数其他参数看不懂怎么初始化。 "24a.png" 是个 带透明的 png ,你 改一个 就 行class Image : public GdiplusBaseclass Bitmap : public Image直接 用 Bitmap 就行了, 他 有 基类的 函数! 晕,你从来不仔细看我说的吗???你的代码可以,我明白 。但是,我的想法直接构造函数加载一张Png到画刷不行吗???是Image加载一张png,传给Textbrush构造函数第一个参数对吧,那ImageAttributes *imageAttributes //这个参数是什么意思???如何初始化此值???TextureBrush( [in] Image *image, [in, ref] RectF &dstRect [in] ImageAttributes *imageAttributes ); 楼主属于欠挤的,一次不说完问题;版主也别这样,不愿意说就算,都是小白过来的。不过我还是觉得先看MSDN吧:imageAttr类型:System.Drawing.Imaging.ImageAttributes一个 ImageAttributes 对象,它包含有关此 TextureBrush 对象所使用的图像的附加信息。ImageAttributes 类包含有关在呈现时如何操作位图和图元文件颜色的信息。OK,怎么初始化?在这个类里有示例。关键是,你没有特殊需求(改变颜色空间、变形等)就不需要这个参数!如果你有特殊需求,楼主是不是又该挤出点啥要求了?TextBrush构造函数好多个形式啊。 解释明明是中文的 不知道楼主怎么用msdn 的 同时对这位躺着中枪的bz表示同情 大哥,就是构造函数加载一张png图片,不使用ImageAttributes *imageAttributes的化,传一个NULL指针就没问题??? “ImageAttributes 类” 是 变形用 的 。(3 = 平行 4边 形,即 我说的 菱形, 4 是 矩形)。 我长方形的图片呀,4 是 矩形“ImageAttributes 类”这个类怎么初始化呀? PointF destPoints[3] = { //3个浮点 point 表示红色区的 一个 菱形PointF(230.0f, 30.0f),//lefttopPointF(350.0f, 50.0f),// righttopPointF(275.0f, 120.0f)};//leftbottomPointF *pdestPoints = destPoints; 这里 的 3个 浮点数 表示 平行四边形, 如果 初始化 4个 点 就是 矩形了。 对与整个图片左和上肯定是0,0 //就是右与下 假如Image函数GetWidth与GetHeight获取宽与高 肯定是Int类型。咋赋值给 右和下的double类型?强转啊??? PointF destPoints[3] = { //3个浮点 point 表示红色区的 一个 菱形PointF(230.0f, 30.0f),//lefttopPointF(350.0f, 50.0f),// righttopPointF(275.0f, 120.0f)};//leftbottomPointF *pdestPoints = destPoints; 这个 是要 重新画的 菱形区, 位置在 中 上。与Image函数GetWidth与GetHeigh 没关系,不是 这个 image。如果 要转换可以用 (REAL)转换。 //能否看仔细???????????????????对与整个图片左和上肯定是0,0 //就是右与下 假如Image函数GetWidth与GetHeight获取宽与高 肯定是Int类型。咋赋值给 右和下的double类型?强转啊??? 宽与高 肯定是Int类型。咋赋值给 右和下的double类型?强转啊??? TextureBrush 在Erasebkng消息里刷背景TextureBrush( [in] Image *image,//加载png图片 [in, ref] RectF &dstRect,//图片大小[in]ImageAttributes *imageAttributes ); ImageAttributes *imageAttributes这个参数怎么办呢??? PointF destPoints[3] = { //3个浮点 point 表示红色区的 一个 菱形PointF(230.0f, 30.0f),//lefttopPointF(350.0f, 50.0f),// righttopPointF(275.0f, 120.0f)};//leftbottomPointF *pdestPoints = destPo……这 3个 点 是 投影后的 菱形 与 原 矩形 没什么 关系。哪里 有:“与整个图片左和上肯定是0,0 //就是右与下 假如Image函数GetWidth与GetHeight获取宽与高 肯定是Int类型”问题 ? ImageAttributes remapAttributes; ColorMap redToBlue; redToBlue.oldColor = Color(255, 255, 0, 0); redToBlue.newColor = Color(255, 0, 0, 255); remapAttributes.SetRemapTable(1, &redToBlue);这个不就是 初始化吗。 姐姐 能仔细我看说的吗?PointF(230.0f, 30.0f),//参数是浮点型的,倘若,我int强转 没问题吧 小数后面都是0void GDIxToolBar::SetImageEx(Image* BK,Image* FG){ TextureBrush tBrush//成员变量 imageDest[0] = BK; imageDest[1] = FG; RectF rect(0,0,imageDest[0]->GetWidth(),imageDest[0]->GetHeight()); ImageAttributes *imageAttributes = NULL; tBrush(imageDest[0],&rect,imageAttributes); 怎么error 不接受三个参数呀 而且 我传一个 俩个 都说不接受一个、俩个参数呀 }都好几天 能细心点赶紧把问题解决吗?BOOL GDIxToolBar::OnEraseBkgnd(CDC* pDC){ // TODO: 在此添加消息处理程序代码和/或调用默认值 CRect rect; GetClientRect(&rect); RectF prect(0,0,rect.Width(),rect.Height()); Gdiplus::Graphics erasebkgnd(pDC->m_hDC); erasebkgnd.FillEllipse(tBrush,prect); return 1;//CToolBar::OnEraseBkgnd(pDC);//} 求教个算法 为什么我点击reportview的页面设置按钮就说capacity超出最大容量 TableAdapter.Fill 使用之疑问 graphics ?? winform gridview DefaultCellStyle.Format 字体问题!急急急急急 窗体最小化后“还原”的代码怎么写? 关于web端动态添加控件并设定控件坐标位置的方法??? 答谢 zztfj(让我来) 的其中100分(1) SuperTabControl 创建一个新的TabItem 关闭后 再次打开时不显示 C#报错使用未赋值的局部变量a 求大侠帮忙 多线程界面卡死
我自认我比msdn差的远,估计给你解释不了。
- -!、、对于你的 我只知道第一个中的ImageAttribute....
这么简单的问题发在这里,只能说明不是你笨,就是你懒,或者即笨且懒
RectF &dstRect //dstRect = new dstRect ();ImageAttributes *imageAttributes //指定图片属性,使用ImageAttributes 中定义的选项初始化WrapMode wrapMode //换行用的,使用WarpMode中定义的选项初始化
{
GetUpdateRect(&m_rcUpdate, FALSE);// do not delete this
CPaintDC dc(this);
dc.SetBkMode(TRANSPARENT);
CRect rcClient;
GetClientRect(rcClient);
Example_DrawImage4(dc);
return;
#if 0
Bitmap *bmp = new Bitmap(L"24a.png");//"closedown.png");
int wid=bmp->GetWidth();
int hei=bmp->GetHeight();
afxDump << wid << ";" << hei << "\n";// 480,800
// color to grey
for(int i=0;i<wid;i++)
{
for(int j=0;j<hei;j++)
{
Gdiplus::Color pix;
bmp->GetPixel(i,j,&pix);
BYTE gray = pix.GetRed()*0.2+pix.GetGreen()*0.4+pix.GetBlue()*0.2;
ARGB argb=(pix.GetA() << 24) | (gray << 16) | (gray << 8) | gray;
bmp->SetPixel(i,j,argb);
}
}
TextureBrush *brush = new TextureBrush(bmp);
Graphics graphics(dc);
graphics.FillRectangle(brush, (Gdiplus::Rect &) rcClient);
return ;
//
#endif
//
改成 #if 1
就行了
[in] Image *image,
[in, ref] RectF &dstRect
[in] ImageAttributes *imageAttributes
);
类型:System.Drawing.Imaging.ImageAttributes
一个 ImageAttributes 对象,它包含有关此 TextureBrush 对象所使用的图像的附加信息。ImageAttributes 类包含有关在呈现时如何操作位图和图元文件颜色的信息。OK,怎么初始化?在这个类里有示例。关键是,你没有特殊需求(改变颜色空间、变形等)就不需要这个参数!如果你有特殊需求,楼主是不是又该挤出点啥要求了?TextBrush构造函数好多个形式啊。
PointF(230.0f, 30.0f),//lefttop
PointF(350.0f, 50.0f),// righttop
PointF(275.0f, 120.0f)};//leftbottom
PointF *pdestPoints = destPoints; 这里 的 3个 浮点数 表示 平行四边形, 如果 初始化 4个 点 就是 矩形了。
PointF(230.0f, 30.0f),//lefttop
PointF(350.0f, 50.0f),// righttop
PointF(275.0f, 120.0f)};//leftbottom
PointF *pdestPoints = destPoints;
这个 是要 重新画的 菱形区, 位置在 中 上。
与Image函数GetWidth与GetHeigh 没关系,不是 这个 image。
如果 要转换可以用 (REAL)转换。
对与整个图片左和上肯定是0,0 //就是右与下 假如Image函数GetWidth与GetHeight获取宽与高 肯定是Int类型。咋赋值给 右和下的double类型?强转啊???
宽与高 肯定是Int类型。咋赋值给 右和下的double类型?强转啊???
[in] Image *image,//加载png图片
[in, ref] RectF &dstRect,//图片大小
[in]ImageAttributes *imageAttributes
); ImageAttributes *imageAttributes这个参数怎么办呢???
PointF(230.0f, 30.0f),//lefttop
PointF(350.0f, 50.0f),// righttop
PointF(275.0f, 120.0f)};//leftbottom
PointF *pdestPoints = destPo……
这 3个 点 是 投影后的 菱形 与 原 矩形 没什么 关系。
哪里 有:“与整个图片左和上肯定是0,0 //就是右与下 假如Image函数GetWidth与GetHeight获取宽与高 肯定是Int类型”问题 ?
ColorMap redToBlue;
redToBlue.oldColor = Color(255, 255, 0, 0);
redToBlue.newColor = Color(255, 0, 0, 255);
remapAttributes.SetRemapTable(1, &redToBlue);
这个不就是 初始化吗。
void GDIxToolBar::SetImageEx(Image* BK,Image* FG)
{
TextureBrush tBrush//成员变量
imageDest[0] = BK;
imageDest[1] = FG;
RectF rect(0,0,imageDest[0]->GetWidth(),imageDest[0]->GetHeight());
ImageAttributes *imageAttributes = NULL;
tBrush(imageDest[0],&rect,imageAttributes);
怎么error 不接受三个参数呀 而且 我传一个 俩个 都说不接受一个、俩个参数呀
}
都好几天 能细心点赶紧把问题解决吗?
BOOL GDIxToolBar::OnEraseBkgnd(CDC* pDC)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
CRect rect;
GetClientRect(&rect);
RectF prect(0,0,rect.Width(),rect.Height());
Gdiplus::Graphics erasebkgnd(pDC->m_hDC);
erasebkgnd.FillEllipse(tBrush,prect);
return 1;//CToolBar::OnEraseBkgnd(pDC);//
}