mathematica中画图画不出来 5C

图片说明为什么这个画不出来?

-1

4个回答

能不把文本形式的命令发一下?你给的函数太复杂了,想输到自己电脑试试都不能。

0
qq_32455103
qq_32455103 我发到下面了
一年多之前 回复

Plot3D[(2*10^-7)/
Abs(Sqrt[3] x + y)/
2
/(2 Sqrt[x^2 + y^2]) + (4 - x - Sqrt[3] y)/(
2 Sqrt[(1 - x)^2 + (Sqrt[3] - y)^2])) +
10^-7/y ((2 - x)/Sqrt[(2 - x)^2 + y^2] + x/Sqrt[x^2 + y^2]) + (
2*10^-7)/Sqrt
3 x^2 + y^2 - 12 x + 12 + 2 Sqrt[3] xy -
4 Sqrt[3] y
/(
2 Sqrt[(1 - x)^2 + (Sqrt[3] - y)^2]) + (2 - x + Sqrt[3] y)/(
2 Sqrt[(1 - x)^2 + y^2])), {x, 0, 2}, {y, 0, Sqrt[3]}]

0
qq_32455103
qq_32455103 回复Boover: 我把这三项拆开来分别作图,第三个还是画不出来,语句应该是没有错误了
一年多之前 回复
qq_32455103
qq_32455103 好滴,我再检查一下
一年多之前 回复
Boover
Boover 你发的这个运行起来会出现语法错误,有几处括号不对应。
一年多之前 回复

![![图片说明](https://img-ask.csdn.net/upload/201803/21/1521628011_79582.png)图片说明](https://img-ask.csdn.net/upload/201803/21/1521628000_109746.png)图片说明

这是第三个文本:Plot3D[(2*10^-7)/Sqrt
3 x^2 + y^2 - 12 x + 12 + 2 Sqrt[3] xy -
4 Sqrt[3] y
/(
2 Sqrt[(1 - x)^2 + (Sqrt[3] - y)^2]) + (2 - x + Sqrt[3] y)/(
2 Sqrt[(1 - x)^2 + y^2])), {x, 0, 2}, {y, 0, Sqrt[3]},
RegionFunction ->
Function[{x, y, z},
y >= 0 && y - Sqrt[3] x <= 0 && y + Sqrt3 <= 0]]

0

图片说明图片说明

0
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
画图画
非C程序员C++入门自学教程.PDF<br>http://download.csdn.net/source/178897<br>设计模式完整版(PDF) http://download.csdn.net/source/183425 <br>Visual C++2005程序设计(初学者版) <br>http://download.csdn.net/source/185015
DX 贴图画不出来
void GenerateData()rnrn rap3d.GetDevice()->CreateVertexBuffer( 10*sizeof(LVertex), rn D3DUSAGE_WRITEONLY, VertexFVF, D3DPOOL_DEFAULT, &pBigSquareVB, NULL );rn LVertex * v;rn pBigSquareVB->Lock( 0, 0, (void**)(BYTE**)&v, 0 );rnrn v[0].x = 0.0f; v[0].y = 0.0; v[0].z = 0.0f;rn v[0].diffuse = 0xffff0000;rn v[0].tu = 0.0f; v[0].tv = 0.5f;rnrn v[1].x = 0.0f; v[1].y = 5.0f; v[1].z = 0.0f;rn v[1].diffuse = 0xff0000ff;rn v[1].tu = 0.5f; v[1].tv = 0.5f;rnrn v[2].x = 5.0f; v[2].y = 5.0f; v[2].z = 0.0f;rn v[2].diffuse = 0xffffffff;rn v[2].tu = 0.5f; v[2].tv = 0.0f;rnrn v[3].x = 5.0f; v[3].y = 0.0f; v[3].z = 0.0f;rn v[3].diffuse = 0xff000fff;rn v[3].tu = 0.0f; v[3].tv = 0.0f;rnrn /*v[4].x = 10.0f; v[4].y =10.0f; v[4].z = 0.0f;rn v[4].diffuse = 0xffffff00;rn v[4].specular = 0xffff0000;rn v[4].tu = 0.0f; v[4].tv = 0.0f;rnrn v[5].x = 10.0f; v[5].y = 15.0f; v[5].z = 0.0f;rn v[5].diffuse = 0xffffff00;rn v[5].specular = 0xffff0000;rn v[5].tu = 0.0f; v[5].tv = 0.0f;rnrn v[6].x = 5.0f; v[6].y = 15.0f; v[6].z = 0.0f;rn v[6].diffuse = 0xffffff00;rn v[6].specular = 0xffff0000;rn v[6].tu = 0.0f; v[6].tv = 0.0f;rnrn v[7].x = 10.0f; v[7].y = 5.0f; v[7].z = 0.0f;rn v[7].diffuse = 0xffffff00;rn v[7].specular = 0xffff0000;rn v[7].tu = 0.0f; v[7].tv = 0.0f;rnrn v[8].x = 10.0f; v[8].y = 10.0f; v[8].z = 0.0f;rn v[8].diffuse = 0xffffff00;rn v[8].specular = 0xffff0000;rn v[8].tu = 0.0f; v[8].tv = 0.0f;rnrn v[9].x = 0.0f; v[9].y = 0.0f; v[9].z = 0.0f;rn v[9].diffuse = 0xffffff00;rn v[9].specular = 0xffff0000;rn v[9].tu = 0.0f; v[9].tv = 0.0f;rn */rn pBigSquareVB->Unlock();rnrnbool MyTestRender()rnrn if (TexMan.GetTex("girl"))rn rn rap3d.GetDevice()->SetTexture(0,TexMan.GetTex("girl"));rn rn rap3d.GetDevice()->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );rn rap3d.GetDevice()->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );rn rap3d.GetDevice()->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );rn rap3d.GetDevice()->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_DISABLE );rn rap3d.GetDevice()->SetFVF(VertexFVF);rn rap3d.GetDevice()->SetStreamSource(0, pBigSquareVB, 0, sizeof(LVertex));rnrnrn rap3d.GetDevice()->DrawPrimitive( D3DPT_TRIANGLEFAN , 0 ,2);rnrn return true;rn
画图画不上
定义了一个对话框,在对话框面板上绘制图形的轮廓。上述功能已实现,但是我想填充图形,就自己写了一个类,与原图形求交点并排序,然后想把每两个交点相连,用的是MoveTo(cossPoint1) LineTo(cossPoint2);怎么没有填充成功?自己检查不出错在哪里,还请高手看看
甜甜画图画
Description 甜甜从小就喜欢画图画,最近他买了一支智能画笔,由于刚刚接触,所以甜甜只会用它来画直线,于是他就在平面直角坐标系中画出如下的图形:   甜甜的好朋友蜜蜜发现上面的图还是有点规则的,于是他问甜甜:在你画的图中,我给你两个点,请你算一算连接两点的折线长度(即沿折线走的路线长度)吧。   Input 第一个数是正整数N(≤100)。代表数据的组数。 每组数据由四个非...
文字图画 字符画转换器
一个将图片转换为文字画的工具,这个软件参考了众多同类软件的长处,实现了从jpg、bmp、gif 图片到txt、html文本的转换,还可以转为“文字画板”文档(可将生成文字图用“文字画板”进行再加工);可以只对图片局部进行转换,可以自由设定转换图案大小,解决生成的文字图幅暴大难看的问题;支持汉字/英文两种字符,生成文字图不会拉长失真;支持灰度/彩色/字符多种转换模式,通过自由搭配,可以生成色绚丽变化多端的文字网页;图片灰度与生成字符的对应表打破固化模式,可以自由编辑设计,满足用户设计个性化作品需要;采用友好的引导式操作,不用看帮助文件也可以快速掌握使用方法;绿色软件,无需安装
在webfrom中为什么画不出来
我用以下的代码为什么画不出来rnrnBitmap image = new Bitmap ( 400 , 400 ) ;rn Pen pp=new Pen(Color.Red,3);rn Graphics g=Graphics.FromImage(image);rn g.DrawArc(pp,new Rectangle(10,10,60,60),45,270);rn g.DrawArc(pp,160,30,40,120,-120,210);rn g.DrawArc(pp,new Rectangle(10,120,120,40),-30,180);rn pp.Dispose();rn运行没有错,但是界面上就是没有东西
GDI画字符串 画不出来
[code=csharp]private void button1_Click(object sender, EventArgs e)rn rn Bitmap bm = new Bitmap(200, 200);rn Graphics g = Graphics.FromImage(bm);rn g.Clear(Color.Black);rn g.DrawString("asdwqeqr", new Font("宋体", 14), new SolidBrush(Color.Blue), 20, 10);rn [/code] rn为什么那个字符串画不出来啊
用 Mathematica 画极坐标曲线
用 Mathematica 画极坐标函数曲线的例子。
【mathematica画三维空间坐标系箭头】
先看图代码(符号什么的都是英文状态下)Graphics3D[{{Thick, Red, Arrowheads[.03], Arrow[{{0, 0, 0}, {2, 0, 0}}]}, {Thick, Green, Arrowheads[.03], Arrow[{{0, 0, 0}, {0, 2, 0}}]}, {Thick, Blue, Arrowheads[.03], ...
怎么画不出来。
我在dialog 的 button 中写入下列代码。但没有画出来。rn CRect l;rn l.left=0;rn l.top=0;rn l.right=90;rn l.bottom=90;rnrn CDC *dc=this->GetDC();rn CDC memdc;rn CBrush brBackground(RGB(34,0,196));rnrn memdc.CreateCompatibleDC(dc);rn memdc.FillRect(l, &brBackground);rnrn dc->BitBlt(0,0,90,90,&memdc,0,0,SRCCOPY);rn rn ReleaseDC(dc);rn ReleaseDC(&memdc);rn
为什么还是画不出来
Bitmap bm=new Bitmap(200,200); rn Pen blackPen = new Pen(Color.Black, 6);rn Graphics g=Graphics.FromImage(bm);rn g.DrawEllipse(blackPen, 1,1,100,100);rn
画图工具画不出来,求教!
/************************************************************************************************************/rnpublic class DrawMain extends JFramern //Main Methodrn public static void main(String[] args) rn J_ButtonPanel btPanel = new J_ButtonPanel();rn J_PaintingGround ptGround = new J_PaintingGround(btPanel);rn DrawMain app = new DrawMain(btPanel, ptGround);rnrn app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);rn app.setSize(600, 600);rn app.setVisible(true);rn rn //设置显示外观rn tryrn UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());rn catch(Exception e) rn e.printStackTrace();rn rn rn rn //构造函数rn public DrawMain(J_ButtonPanel btPanel, J_PaintingGround ptGround) rn //设置容器及容器的整体布局rn super("画板例程");rn Container cp = getContentPane();rnrn cp.add(btPanel.getPanel(),BorderLayout.WEST);rn cp.add(ptGround, BorderLayout.CENTER);rn rnrn/************************************************************************************************************/rnpublic class J_ButtonPanel extends JPanel implements ActionListenerrn private int optype = 0; //操作类型变量,默认值为0rn private JPanel buttonPanel = new JPanel(); //按钮版rn public JPanel getPanel()return buttonPanel; //获取按钮版rn public int getOptype()return optype; //获取操作类型rn J_ButtonPanel() rn //新建按钮rn btFree = new JButton("随手画");rn btLine = new JButton("直线");rn btRectangle = new JButton("矩形");rn btRound = new JButton("圆");rn btEllipse = new JButton("椭圆");rn btFill = new JButton("填充");rn btSave = new JButton("保存");rn btOpen = new JButton("打开");rn //添加按钮rn buttonPanel.add(btOpen);rn buttonPanel.add(btSave);rn buttonPanel.add(btFree);rn buttonPanel.add(btLine);rn buttonPanel.add(btRectangle);rn buttonPanel.add(btRound);rn buttonPanel.add(btEllipse);rn buttonPanel.add(btFill);rn rnrn public void actionPerformed(ActionEvent event) //鼠标监听器rn Object source = event.getSource(); //获取动作,确定操作类型rn if(source == btFree) optype = 0;rn if(source == btLine) optype = 1;rn if(source == btRectangle) optype = 2;rn if(source == btRound) optype = 3;rn if(source == btEllipse) optype = 4;rn if(source == btFill) optype = 5;rn if(source == btOpen) optype = 6;rn if(source == btSave) optype = 7;rn rnrn private JButton btFree;rn private JButton btLine;rn private JButton btRectangle;rn private JButton btRound;rn private JButton btEllipse;rn private JButton btFill;rn private JButton btSave;rn private JButton btOpen;rnrn/************************************************************************************************************/rnpublic class J_PaintingGround extends JPanelrn public Vector> m_vectorSet = new Vector>(); //设置变量存放笔画rn rn public J_PaintingGround(J_ButtonPanel buttonpanel) //构造函数rn btPanel = buttonpanel; //按钮版rn rn if(btPanel.getOptype() == 0)rn addMouseListener(new MouseAdapter()rn rn public void mousePressed(MouseEvent event)rn rn Vector v = new Vector();rn v.add(btPanel.getOptype());rn v.add(event.getX());rn v.add(event.getY());rn m_vectorSet.add(v);rn rn rn );rn addMouseMotionListener(new MouseMotionListener()rn rn public void mouseMoved(MouseEvent event)rnrn public void mouseDragged(MouseEvent event)rn rn int n = m_vectorSet.size()-1;rn Vector v = new Vector();rn v = m_vectorSet.get(n);rn v.add(event.getX());rn v.add(event.getY());rn repaint();rn rn rn );rn rn if(btPanel.getOptype() >=1 && btPanel.getOptype() <= 4)rn addMouseListener(new MouseAdapter()rn rn Vector v = new Vector();rn public void mousePressed(MouseEvent event)rn rn v.add(btPanel.getOptype());rn v.add(event.getX());rn v.add(event.getY());rn rn public void mouseReleased(MouseEvent event)rn rn v.add(event.getX());rn v.add(event.getY());rn m_vectorSet.add(v);rn repaint();rn rn rn );rn rn if(btPanel.getOptype() == 5)rn if(btPanel.getOptype() == 7)rn tryrn rn FileOutputStream f = new FileOutputStream("绘画作品.txt");rn DataOutputStream fout = new DataOutputStream(f);rn int i,j,m;rn int n = m_vectorSet.size();rn Vector vv = new Vector();rn for(i=0;i v = new Vector();rn Vector vv = new Vector();rnrn for(i=0;i();rn rn else rn f.seek(i*4);rn vv.add(f.readInt());rn rn rn this.repaint();rn rn catch(Exception e)rn rn System.err.println("发生异常:" + e);rn e.printStackTrace();rn rn rn rnrn protected void paintComponent(Graphics g)rn rn g.setColor(Color.YELLOW);rn g.clearRect(0, 0, getWidth(), getHeight());rn Vector v = new Vector();rn Point s, t;rn int i, j, m;rn int n = m_vectorSet.size();rn for(i=0,j=0; i
分隔符为什么画不出来?
我在学菜单这一章时,为什么按照书上的样子制分隔符时,在菜单里出现的是下划线,而不是分隔线,这是怎么回事呢。
canvas.drawPath无效,画不出来
canvas.drawPath无效 需要关闭手机的硬件加速 1.在自定义view中 加入 setLayerType(View.LAYER_TYPE_SOFTWARE, null); 2.在清单文件中 ,activity 或者application 中添加 android:hardwareAccelerated="false"
界面画不出来图形
我声明了一个CDC*类变量pBkDc,然后在Onpaint跑以下代码,然后dc.BitBlt SRCCOPY.但无法显示所要的图形。这是为什么呢?rn[code=c]rn CRect rect;rn CClientDC nDC(this);rn CBrush nBrush(RGB(255, 255, 255));rn CPen nPenBk;rn int cx_step, cy_step;rnrn GetClientRect(&rect);rn if (pBkDc->GetSafeHdc() == NULL)rn rn pBkDc->CreateCompatibleDC(&nDC);rn nBkBmp.CreateCompatibleBitmap(&nDC, rect.Width(), rect.Height());rn pBkDc->FillRect(rect, RGB(0, 0, 0));rn rnrn cx_step = rect.Width() /10;rn cy_step = rect.Height() / 10;rnrn if (pBkDc->GetSafeHdc() != NULL)rn rn nPenBk.CreatePen(PS_SOLID, 0, RGB( 150, 150, 50));rn CPen* pOldPen = pBkDc->SelectObject(&nPenBk);rnrn for (int i = 1; i < 10; i ++)rn rn pBkDc->MoveTo(cx_step * i, rect.top);rn pBkDc->LineTo(cx_step * i,rect.bottom);rn pBkDc->MoveTo(rect.left, cy_step * i);rn pBkDc->LineTo(rect.right, cy_step * i);rn rnrn pBkDc->SelectObject(&nBrush);rn pBkDc->DrawEdge(rect, EDGE_BUMP, BF_RECT);rn pBkDc->SelectObject(pOldPen);rn rn[/code]
2D图形画不出来
[code=Java]rnimport java.awt.*;rnimport java.awt.geom.Rectangle2D;rnimport javax.swing.*;rnrnpublic class DrawTestrnrn public static void main(String[] args)rn rn DrawFrame frame=new DrawFrame();rn frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);rn frame.setVisible(true);rn rnrnrnclass DrawFrame extends JFramernrn public DrawFrame()rn rn setSize(Width,Height);rn setTitle("DrawTest");rn setLocation(500, 300);rn rn DrawPanel panel=new DrawPanel();rn add(panel);rn rn rn public static final int Width=400;rn public static final int Height=500;rnrnrnrnclass DrawPanel extends JPanelrnrn public void paintComponet(Graphics g)rn rnrn super.paintComponent(g);rn Graphics2D g2=(Graphics2D)g;rn rn //画一个方块rn Rectangle2D rect=new Rectangle2D.Double(100,100,200,150);rn g2.draw(rect);rn rnrn[/code]rn[color=#FF0000]rn为什么我的rect画不出来???[/color]
Canvas->CopyRect 画不出来
我的FORM上有 两个IMAGE rnIMAGE1我已经装载了图片。IMAGE2没有。rn我用rn TRect r1;rn TRect r2;rn Image2->Canvas->CopyMode =cmSrcCopy;rn r1 = Rect(0, 0, Image1->Width, Image1->Height);rn r2 = Rect(0, 0, Image2->Width, Image2->Height);rn Image2->Canvas->CopyRect(r2, Image1->Canvas, r1);rnImage2上显示出图片。rn我再用rn TRect r2;rn TPrinter *prn=Printer();rn prn->Canvas->CopyMode =cmSrcCopy;rn r2 = Rect(0, 0, Image2->Width, Image2->Height);rn prn->BeginDoc();rn prn->Canvas->CopyRect(r2, Image2->Canvas, r2);rn prn->EndDoc();rn没有打印出来。怎么回事。
为什么图像画不出来?
我先在窗体上插入了一个PictureBox控件,然后在窗体的Form1_Load事件中加入了如下代码,但运行后,窗体上就是不显示表格,为什么?rnrnPen mypen;rnmypen =new Pen(System.Drawing.Color.Red);rnSystem.Drawing.Graphics mydraw;rnmydraw =pb.CreateGraphics();rnrnmydraw.DrawLine(mypen,40,190,40,280);rnmydraw.DrawLine(mypen,40,190,370,190);rnmydraw.DrawLine(mypen,370,190,370,280);rnmydraw.DrawLine(mypen,40,280,40,370);rnrn谢谢!
求个Qt画图画波形的demo
新人求个画波形的demornrnQQ:196376827rn谢谢了
关于THREE.js中ParametricGeometry画不出来的原因
因为计图项目是海底世界创建,所以虽然画出了个竹子,但是还是想画海草。 由于海草也是波浪形的,想起之前在一个博客里看到了波浪平面的生成是利用ParametricGeometry生成的,于是也想试一试,就写出了如下代码: //海草形状 var radialWave = function (u, v) { var r = 150; var z = Math.s...
用UML图画类中的结构怎么画?
用UML图画类中的结构怎么画?哪位达人能给个例子吗?
如何在IE中直接使用鼠标画图画? 很急的
如题 rn请各位前辈帮帮忙
怎么在OWC10(是OWC10不是OWC11)中画3D的图画?
如题。我现在面临的资源库是OWC10,或OWC9反正不是OWC11。但是原来是2D的图表表示,现在要换成3D的,在不改换资源成OWC11的办法以外各位还有什么办法么?
TEXT中的图画
破天惊工作室rnrn大家好请问如何在TEXT中加入一副图画呢?rnrnrnwww.tresss.onchina.net
利用mathematica画多个函数图像
打开mathematica输入如下代码,即可画出两个函数图像。 Show[Plot[1, {x, 0, 10}], Plot[x^2, {x, 0, 10}]] 若想在一张canvas上画出多个函数图像,待我后续研究。
mathematica
mathematica
Mathematica
Mathematica_基础知识
DirectX9为什么画不出来?急!
用DirectX9画一个最简单的线,从原点画到(2, 0, 0),为什么画不出来?rn[code=c]rnstruct CustomVertexColor rn float eX, eY, eZ;rn DWORD dwColor;rn;rnrnconst int c_d3d9_vertexfvf_idXyzColor = D3DFVF_XYZ|D3DFVF_DIFFUSE;rnrn //初始化顶点rn CustomVertexColor a_vertex[2];rn int nVertex = 2;rn a_vertex[0].eX = 0;rn a_vertex[0].eY = 0;rn a_vertex[0].eZ = 0;rn a_vertex[1].eX = 2;rn a_vertex[1].eY = 0;rn a_vertex[1].eZ = 0;rn a_vertex[0].dwColor = D3DCOLOR_ARGB(128, 255, 255, 255);rn a_vertex[1].dwColor = D3DCOLOR_ARGB(128, 255, 255, 255);rnrn // 设置顶点缓冲区rn IDirect3DVertexBuffer9 *pVertexBuf;rn mp_dev->CreateVertexBuffer(sizeof(CustomVertexColor) * nVertex, 0, c_d3d9_vertexfvf_idXyzColor, D3DPOOL_DEFAULT, &pVertexBuf, NULL);rn void *pVertex;rn pVertexBuf->Lock(0, 0, &pVertex, 0);rn memcpy(pVertex, a_vertex, sizeof(CustomVertexColor) * nVertex);rn pVertexBuf->Unlock();rnrn // 开始画图rn if ( FAILED(mp_dev->BeginScene()) )rn MessageBeep(0xFFFFFFFF);rn if ( FAILED(mp_dev->Clear(0, NULL, D3DCLEAR_TARGET, 0, 1.0f, 0)) )rn MessageBeep(0xFFFFFFFF);rn SetTransform();rn if ( FAILED(mp_dev->SetStreamSource(0, pVertexBuf, 0, nVertex)) )rn MessageBeep(0xFFFFFFFF);rn if ( FAILED(mp_dev->SetFVF(c_d3d9_vertexfvf_idXyzColor)) )rn MessageBeep(0xFFFFFFFF);rn if ( FAILED(mp_dev->DrawPrimitive(D3DPT_LINELIST, 0, nVertex / 2)) )rn MessageBeep(0xFFFFFFFF);rn mp_dev->EndScene();rnrn if ( FAILED(mp_dev->Present(NULL, NULL, NULL, NULL)) )rn MessageBeep(0xFFFFFFFF);rnrn pVertexBuf->Release();rnrn// Transform部分rnvoid SetTransform() rn D3DXMATRIX matTranslate, matScale, matRotate, matRotateY, matRotateZ;rn static D3DXMATRIX s_matTransWorld, s_matTransView, s_matTransProj;rnrn D3DXMatrixIdentity(&s_matTransWorld);rn float eScale = 50.0;rn D3DXMatrixScaling(&matScale, eScale, eScale, eScale);rn D3DXMatrixMultiply(&s_matTransWorld, &s_matTransWorld, &matScale);rnrn D3DXVECTOR3 vecPosition(0.0f, 0.0f, -450.f);rn D3DXVECTOR3 vecLook(0.0f, 0.0f, 0.0f);rn D3DXMatrixLookAtLH(&s_matTransView, &vecPosition, &vecLook, &D3DXVECTOR3(0.0f, 1.0f, 0.0f)); //up directionrnrn D3DXMatrixPerspectiveFovLH(&s_matTransProj, D3DX_PI/4, float(pnlRender->Width)/float(pnlRender->Height), 1.0f, 600.0f);rnrn mp_dev->SetTransform(D3DTS_WORLD, &s_matTransWorld);rn mp_dev->SetTransform(D3DTS_VIEW, &s_matTransView);rn mp_dev->SetTransform(D3DTS_PROJECTION, &s_matTransProj);rnrnrn[/code]rn运行后,只有Clear产生的黑屏,没有任何线画出来,为什么?
关于ImageList的问题,画不出来!
位图是24位的24X24rnrn// 创建了一个支持真彩色的CImageList,带maskrn CImageList ilHot;rn ilHot.Create( 24, 24, ILC_COLOR24 | ILC_MASK, nImgCount, 1 );rn// 创建了一个位图对象rn CBitmap *bmp = new CBitmap;rn bmp->LoadBitmap( IDB_BMP01 );rn// 测试位图是否读取正确rn HDC dc = CreateCompatibleDC( ::GetDC(NULL) );rn SelectObject( dc, bmp->GetSafeHandle() );rn BitBlt( ::GetDC(NULL), 0, 0, 24, 24, dc, 0, 0, SRCCOPY );rn// 这里已经画出来了,说明位图读取的没问题rn// 将位图加到pList里rn ilHot.Add( bmp, RGB(255, 0, 255) );rn// 再把程序默认的图标加到ImageList里rn ilHot.Add( ::LoadIcon( ::AfxGetInstanceHandle(), MAKEINTRESOURCE( IDR_MAINFRAME ) ) );rn// 测试ImageList的Drawrn CDC testdc;rn testdc.Attach( ::GetDC( NULL ) );rn ilHot.Draw( &testdc, 0, CPoint(0, 0), ILD_TRANSPARENT );// 画不出来rn ilHot.Draw( &testdc, 1, CPoint(0, 0), ILD_TRANSPARENT );// 可以画出来rnrnrn为什么位图画不出来,图标可以画出来呀?????
为什么什么都画不出来
CWnd* hwnd = GetDlgItem(IDC_PIC);rnHDC hdc = hwnd->GetDC()->m_hDC;rnHDC hDc = CreateCompatibleDC(hdc);rnTextOut(hDc, 0, 0, "hello", 5);rnIDC_PIC是一个标签控件,上面语句是加在OnPaint中的!rn
死都画不出来,怎么回事
[code=c]rnvoid AddRobotDialog::OnPaint()rnrn CPaintDC dc(this); // drn UpdateWindow();rn CClientDC *pDC = new CClientDC(GetDlgItem(IDC_HEAD_PIC));rn CRect rect;rn GetDlgItem(IDC_HEAD_PIC)->GetWindowRect(&rect);rn Graphics graphics(pDC->m_hDC);rn wchar_t wcstring[256];rn MultiByteToWideChar(CP_ACP, 0, m_headPath, -1, wcstring, 256);rn Image image(wcstring);rn graphics.DrawImage(&image, 0, 0, image.GetWidth(), image.GetHeight());rnrn delete pDC;rn rnrnrn[/code]
我的贝塞尔曲线怎么画不出来?
我的代码是rnCPoint par[7];rnptr[0].x=5;rnptr[0].y=5;rnptr[1].x=35;rnptr[1].y=70; rnptr[2].x=70; rn ptr[2].y=100;rn ptr[3].x=150;rnptr[3].y=150;rnpdc->PolyBezier(par,4);rn在线等待
图片太大,canvas画不出来
loacat提示: 07-03 01:06:58.175: W/OpenGLRenderer(30011): Bitmap too large to be uploaded into a texture (440x5261, max=4096x4096) 07-03 01:06:58.175: W/OpenGLRenderer(30011): Bitmap too large to be up...
告诉我为什么画不出来。谢谢
using System;rnusing System.Drawing;rnusing System.Collections;rnusing System.ComponentModel;rnusing System.Windows.Forms;rnusing System.Data;rnusing System.Drawing.Drawing2D;rnrnnamespace WindowsApplication1rnrn /// rn /// Form1 的摘要说明。rn /// rn public class Form1 : System.Windows.Forms.Formrn rn /// rn /// 必需的设计器变量。rn /// rn private System.ComponentModel.Container components = null;rnrn public Form1()rn rn //rn // Windows 窗体设计器支持所必需的rn //rn InitializeComponent();rn //rn // TODO: 在 InitializeComponent 调用后添加任何构造函数代码rn //rn rnrn /// rn /// 清理所有正在使用的资源。rn /// rn protected override void Dispose( bool disposing )rn rn if( disposing )rn rn if (components != null) rn rn components.Dispose();rn rn rn base.Dispose( disposing );rn rnrn #region Windows 窗体设计器生成的代码rn /// rn /// 设计器支持所需的方法 - 不要使用代码编辑器修改rn /// 此方法的内容。rn /// rn private void InitializeComponent()rn rn // rn // Form1rn // rn this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);rn this.ClientSize = new System.Drawing.Size(568, 421);rn this.Name = "Form1";rnrn rn #endregionrnrn /// rn /// 应用程序的主入口点。rn /// rn [STAThread]rn static void Main() rn rn Application.Run(new Form1());rn Form1 f = new Form1();rn f.ps();rn rnrn private void ps()rn rn Graphics g = this.CreateGraphics();rn g.FillRectangle(Brushes.White,ClientRectangle);rn g.DrawLine(Pens.Blue,new Point(0,0),new Point(500,100));rn g.Dispose();rn rnrnrn rnrn
polygon!!怎么画不出来??急
Private Sub cmdDraw_Click()rn Dim sngPoint(1 To 3) As POINTAPIrn Dim lngReturn As Longrn Dim lngN As Longrnrn sngPoint(1).X = 50rn sngPoint(1).Y = 50rn rn sngPoint(2).X = 100rn sngPoint(2).Y = 100rn rn sngPoint(3).X = 400rn sngPoint(3).Y = 400rn rn lngReturn = SetPolyFillMode(picPowerSystem.hdc, 1)rn lngReturn = Polygon(picPowerSystem.hdc, sngPoint(1), 3)rn'picPowerSystem是picture控件,背景为黑色,前景为红 scalemodel为pixelrn rnEnd Subrnrn可是在pic上看不到有图形,为什么?
C# 画的圆显示不出来
代码如下:rn private void drawClock(int h, int m, int s)rn rn Graphics graphic = this.CreateGraphics();rn Rectangle rect = new Rectangle(30, 76, 180, 180);rnrn graphic.Clear(Color.White);rnrn Pen myPen = new Pen(Color.Black, 1);rn graphic.DrawEllipse(myPen, rect.Width/2,rect.Height/2,180,180);//画表盘rn rn不知道为什么表盘总是画不出来
在对话框里画线画不出来
在对话框的picture control里画一条直线,但是画不出来,是什么原因呢rnvoid CPicDlg::OnPaint()rnrn CPaintDC dc(this); // device context for paintingrn // TODO: 在此处添加消息处理程序代码rn // 不为绘图消息调用 CDialog::OnPaint()rn CStatic *pStatic=(CStatic*)GetDlgItem(IDC_STATIC);rn CRect rect1;rn pStatic->GetWindowRect(&rect1);rn pStatic->ScreenToClient(&rect1);rn CDC *pDC=pStatic->GetDC();rnrn CMainFrame* pMain=(CMainFrame *)AfxGetApp()->m_pMainWnd;rn CbView* pView=(CbView*)pMain->GetActiveView();rn pDC->MoveTo(rect1.left,rect1.top);rn pDC->LineTo(pView->A[1],pView->A[1]);rn // TODO: 在此处为本机数据添加绘制代码rnrnrnlineto()里面的数是view里的,可能是这里错了,为什么呢?rn
求助 为什么DRAWTEXT画不出来
详见代码注释处 在鼠标左键按下的时候不会画出1111来rn[code=c]#include rnLRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;rnint WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,rnPSTR szCmdLine, int iCmdShow)rnrnstatic TCHAR szAppName[] = TEXT ("HelloWin") ;rnHWND hwnd ;rnMSG msg ;rnWNDCLASS wndclass ;rnwndclass.style = CS_HREDRAW | CS_VREDRAW ;rnwndclass.lpfnWndProc = WndProc ;rnwndclass.cbClsExtra = 0 ;rnwndclass.cbWndExtra = 0 ;rnwndclass.hInstance = hInstance ;rnwndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;rnwndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;rnwndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;rnwndclass.lpszMenuName = NULL ;rnwndclass.lpszClassName = szAppName ;rnif (!RegisterClass (&wndclass))rnrnMessageBox ( NULL, TEXT ("This program requires Windows NT!"),rnszAppName, MB_ICONERROR) ;rnreturn 0 ;rnrnhwnd = CreateWindow( szAppName, // window class namern TEXT ("The Hello Program"), // window captionrn WS_OVERLAPPEDWINDOW, // window stylern CW_USEDEFAULT, // initial x positionrn CW_USEDEFAULT, // initial y positionrn CW_USEDEFAULT, // initial x sizern CW_USEDEFAULT, // initial y sizern NULL, // parent window handlern NULL, // window menu handlern hInstance, // program instance handlern NULL) ; // creation parametersrnShowWindow (hwnd, iCmdShow) ;rnUpdateWindow (hwnd) ;rnwhile (GetMessage (&msg, NULL, 0, 0))rnrn TranslateMessage (&msg) ;rn DispatchMessage (&msg) ;rnrnreturn msg.wParam ;rnrnLRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)rnrn HDC hdc ;rn PAINTSTRUCT ps ;rn RECT rect ;rn switch (message)rn rn case WM_CREATE:rn// PlaySound (TEXT ("hellowin.wav"), NULL, SND_FILENAME | SND_ASYNC) ;rn return 0 ;rn case WM_PAINT:rn hdc = BeginPaint (hwnd, &ps) ;rn GetClientRect (hwnd, &rect) ;rn DrawText (hdc, TEXT ("Hello, World!"), -1, &rect,rn DT_SINGLELINE | DT_CENTER | DT_VCENTER) ;rn //TextOut(hdc,20,20,TEXT ("textout"),7);rn EndPaint (hwnd, &ps) ;rn return 0 ;rn case WM_DESTROY:rn PostQuitMessage (0) ;rn return 0 ;rn case WM_LBUTTONDOWN:rn // MessageBox(hwnd,"111","222",MB_OK);//这个是有效果的 rn //下面的就是没效果 为什么啊??rn hdc = BeginPaint (hwnd, &ps) ;rn GetClientRect (hwnd, &rect) ;rn DrawText (hdc, TEXT ("1111111111111111111111111111"), -1, &rect,DT_SINGLELINE | DT_CENTER | DT_VCENTER);rn ValidateRect(hwnd, &rect);rn EndPaint (hwnd, &ps) ;rnrn return 0 ;rn rn return DefWindowProc (hwnd, message, wParam, lParam) ;rn[/code]
DirextX 为啥画不出来三角形?
使用D3DFVF_XYZ加上,世界变换等,就是画不出来三角形,因为刚接触DirectX不久,rn请各位帮帮忙,本人用的是DirectX9.0、VS2008开发,编译无错误,运行后,一片黑漆漆,没有三角形。。。rnrn代码如下:rnrn#include "windows.h"rn#include rn#include rnrn#define WINDOW_WIDTH 1024rn#define WINDOW_HEIGHT 768rn#define WINDOW_CLSNAME L"PlayThePlane" //主窗口类名rn#define SAFE_RELEASE(p)if(p)(p)->Release();(p)==NULL;rn#define SAFE_DELETE(p)if(p)delete p;p=NULL;rnrn//背景顶点格式rnstruct BACKVERTEXrnrn float x,y,z;rn float u,v;rn;rn#define D3DFVF_BACKVERTEX D3DFVF_XYZ|D3DFVF_TEX1rnrnHWND hwnd=NULL; //主窗体句柄rnLPDIRECT3DDEVICE9 g_pd3dDevice; //DirectX3D设备指针rnrn LPDIRECT3DVERTEXBUFFER9 g_pVertexBuffer; //顶点缓存对象 用于绘制精灵rn LPDIRECT3DINDEXBUFFER9 g_pIndexBuffer; //索引缓存对象 用于绘制精灵rn LPDIRECT3DTEXTURE9 g_pTexture; //纹理接口对象 用于绘制精灵rnrnDWORD tPre,tNow; //用于帧频控制rnrnrn//消息处理函数声明rnLRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam); rnrnbool RegisterWindow(HINSTANCE hInstance); //注册窗体类函数声明rnHRESULT InitD3D(); //初始化DirectX函数声明rnHRESULT InitObject();rnvoid Render(); //渲染函数声明 rnvoid Clear(HINSTANCE hInstance); //清理资源函数声明rnrn//主函数rnint WINAPI WinMain(HINSTANCE hInstance, rn HINSTANCE hPrevInstance,rn LPSTR lpCmdLine, rn int nShowCmd) rnrn if(!RegisterWindow(hInstance))rn return -1;rnrn hwnd=CreateWindow(WINDOW_CLSNAME,L"炮打大飞机",rn WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,rn WINDOW_WIDTH,WINDOW_HEIGHT,NULL,NULL,hInstance,NULL);rnrn if(hwnd==NULL)rn return -1;rnrn MoveWindow(hwnd,100,100,WINDOW_WIDTH,WINDOW_HEIGHT,true);rn ShowWindow(hwnd,nShowCmd);rn UpdateWindow(hwnd);rnrn if(InitD3D()!=S_OK)rn return -1;rnrnrn MSG msg=0;rn while(msg.message!=WM_QUIT)rn rn if(PeekMessage(&msg,0,0,0,PM_REMOVE))rn rn TranslateMessage(&msg);rn DispatchMessage(&msg);rn rn elsern rn tNow=GetTickCount();rnrn if(tNow-tPre>30)rn rn Render();rn rn rn rnrn Clear(hInstance);rnrn return 0;rnrnrn//注册窗体类函数定义rnbool RegisterWindow(HINSTANCE hInstance)rnrn WNDCLASSEX wndClass=0;rn wndClass.cbSize =sizeof(WNDCLASSEX);rn wndClass.style =CS_HREDRAW|CS_VREDRAW;rn wndClass.lpfnWndProc=WndProc;rn wndClass.cbClsExtra =0;rn wndClass.cbWndExtra =0;rn wndClass.hIconSm =0;rn wndClass.hInstance =hInstance;rn wndClass.hCursor =LoadCursor(NULL,IDC_ARROW);rn wndClass.hbrBackground=(HBRUSH)GetStockObject(GRAY_BRUSH);rn wndClass.lpszMenuName=NULL;rn wndClass.lpszClassName=WINDOW_CLSNAME;rnrn if(!RegisterClassEx(&wndClass))rn return false;rnrn return true;rnrnrn//消息处理函数定义rnLRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)rnrn switch(message)rn rn case WM_KEYDOWN:rn if(wParam==VK_ESCAPE)rn DestroyWindow(hwnd);rn break;rn case WM_DESTROY:rn PostQuitMessage(0);rn break;rnrn default:rn return DefWindowProc(hwnd,message,wParam,lParam);rn rnrn return 0;rnrn//初始化DirectX函数定义rnHRESULT InitD3D()rnrn LPDIRECT3D9 pD3D=NULL;rn if(NULL==(pD3D=Direct3DCreate9(D3D_SDK_VERSION)))rn return E_FAIL;rnrn D3DCAPS9 caps;rn int vp=0;rnrn if(FAILED(pD3D->GetDeviceCaps(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,&caps)))rn return E_FAIL;rnrn if(caps.DevCaps&D3DDEVCAPS_HWTRANSFORMANDLIGHT)rn vp=D3DCREATE_HARDWARE_VERTEXPROCESSING;rn elsern vp=D3DCREATE_SOFTWARE_VERTEXPROCESSING;rnrn D3DPRESENT_PARAMETERS d3dpp;rn ZeroMemory(&d3dpp,sizeof(d3dpp));rn d3dpp.BackBufferWidth = WINDOW_WIDTH;rn d3dpp.BackBufferHeight = WINDOW_HEIGHT;rn d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;rn d3dpp.BackBufferCount = 1;rn d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;rn d3dpp.MultiSampleQuality = 0;rn d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;rn d3dpp.hDeviceWindow = hwnd;rn d3dpp.Windowed = true;rn d3dpp.EnableAutoDepthStencil= true;rn d3dpp.AutoDepthStencilFormat= D3DFMT_D24S8;rn d3dpp.Flags = 0;rn d3dpp.FullScreen_RefreshRateInHz= 0;rn d3dpp.PresentationInterval= D3DPRESENT_INTERVAL_IMMEDIATE;rnrn if(FAILED(pD3D->CreateDevice(D3DADAPTER_DEFAULT,rn D3DDEVTYPE_HAL,hwnd,vp,&d3dpp,&g_pd3dDevice)))rn return E_FAIL;rnrnrn InitObject();rnrn SAFE_RELEASE(pD3D);rnrn return S_OK;rnrnHRESULT InitObject()rnrn //创建顶点缓存 rn if( FAILED(g_pd3dDevice->CreateVertexBuffer(3*sizeof(BACKVERTEX), rn 0, D3DFVF_BACKVERTEX, rn D3DPOOL_DEFAULT, &g_pVertexBuffer, NULL ) ) ) rn rn return E_FAIL; rn rnrn // 创建索引缓存 rn if( FAILED(g_pd3dDevice->CreateIndexBuffer(3*sizeof(WORD), 0, rn D3DFMT_INDEX16, D3DPOOL_DEFAULT, &g_pIndexBuffer, NULL)) ) rn rn return E_FAIL; rn rnrn //以下为设置顶点数据rn BACKVERTEX Vertices[4];rn Vertices[0].x=-1.0f;rn Vertices[0].y=0.0f;rn Vertices[0].z=0.0f;rn //Vertices[0].rhw=1.0f;rn Vertices[0].u=0.0f;rn Vertices[0].v=0.0f;rnrn Vertices[1].x=0.0f;rn Vertices[1].y=1.0f;rn Vertices[1].z=0.0f;rn //Vertices[1].rhw=1.0f;rn Vertices[1].u=1.0f;rn Vertices[1].v=0.0f;rnrn Vertices[2].x=1.0f;rn Vertices[2].y=0.0f;rn Vertices[2].z=0.0f;rn //Vertices[2].rhw=1.0f;rn Vertices[2].u=0.0f;rn Vertices[2].v=1.0f;rnrn //Vertices[3].x=1.0f;rn //Vertices[3].y=1.0f;rn //Vertices[3].z=1.0f;rn // //Vertices[3].rhw=1.0f;rn //Vertices[3].u=1.0f;rn //Vertices[3].v=1.0f;rnrn VOID* pVertices;rn if(FAILED(g_pVertexBuffer->Lock(0,sizeof(Vertices),(void**)&pVertices,0)))rn return E_FAIL;rn memcpy(pVertices,Vertices,sizeof(Vertices));rn g_pVertexBuffer->Unlock();rnrn //填充索引缓存rn WORD Indices[]=0,1,2;rnrn WORD* pIndices=NULL;rn if(FAILED(g_pIndexBuffer->Lock(0,0,(void**)&pIndices,0)))rn return E_FAIL;rn memcpy(pIndices,Indices,sizeof(Indices));rn g_pIndexBuffer->Unlock();rnrn D3DXCreateTextureFromFile(g_pd3dDevice,L"plane.jpg",&g_pTexture); //创建纹理rnrn return S_OK;rnrn//渲染函数定义rnvoid Render()rnrn g_pd3dDevice->Clear(0,NULL,D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,D3DCOLOR_XRGB(0,0,0),1.0f,0);rn g_pd3dDevice->BeginScene();rnrnrn D3DXMATRIX matWorld,matScaling, matLook,matProj;rnrn D3DXMatrixTranslation(&matWorld,30.0f,30.0f,0.0f);rnrn D3DXMatrixScaling(&matScaling,32.0f,32.0f,0.0f);rn matWorld=matWorld*matScaling;rnrn D3DXMatrixPerspectiveFovLH(&matProj,3.14*0.5f,800.0f/600.0f,1.0f,1000.0f);rn g_pd3dDevice->SetTransform(D3DTS_PROJECTION,&matProj);rnrn g_pd3dDevice->SetTransform(D3DTS_WORLD,&matWorld);rnrn D3DXVECTOR3 position(0.0f,0.0f,-10.0f);rn D3DXVECTOR3 targetPoint(0.0f,0.0f,0.0f);rn D3DXVECTOR3 worldUp(0.0f,1.0f,0.0f);rnrn D3DXMatrixLookAtLH(&matLook,&position,&targetPoint,&worldUp);rn g_pd3dDevice->SetTransform(D3DTS_VIEW,&matLook);rnrn g_pd3dDevice->SetRenderState(D3DRS_CULLMODE,D3DCULL_NONE);rnrn g_pd3dDevice->SetStreamSource(0,g_pVertexBuffer,0,sizeof(BACKVERTEX));rn g_pd3dDevice->SetFVF(D3DFVF_BACKVERTEX);rn g_pd3dDevice->SetIndices(g_pIndexBuffer);rn g_pd3dDevice->SetTexture(0,g_pTexture);rnrnrn g_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,0,0,3,0,1);rnrnrnrn g_pd3dDevice->EndScene();rn g_pd3dDevice->Present(NULL,NULL,NULL,NULL);rn tPre=GetTickCount();rnrn//清理资源函数定义rnvoid Clear(HINSTANCE hInstance)rnrn UnregisterClass(WINDOW_CLSNAME,hInstance);rn SAFE_RELEASE(g_pd3dDevice);rn