在屏幕上画简单图形和显示图片、处理简单鼠标键盘事件

/***************************************************************
* Name: MyApp.h
* Purpose: Defines Application Class
* Author: PingGe (414236069@qq.com)
* Created: 2013-10-14
* Copyright: PingGe (http://www.cnblogs.com/pingge/)
* License:
**************************************************************/ #ifndef WXTESTAPP_H
#define WXTESTAPP_H #include <wx/app.h> class MyApp : public wxApp //应用程序类,应用程序的入口点
{
public:
virtual bool OnInit(void); //在应用程序启动时调用,如果返回false,退出应用程序
}; #endif // WXTESTAPP_H
/***************************************************************
* Name: MyApp.cpp
* Purpose: Code for Application Class
* Author: PingGe (414236069@qq.com)
* Created: 2013-10-14
* Copyright: PingGe (http://www.cnblogs.com/pingge/)
* License:
**************************************************************/ #include <wx/wx.h>
//(*AppHeaders
#include "MyApp.h"
#include "MyFrame.h"
//*) DECLARE_APP(MyApp);
IMPLEMENT_APP(MyApp); bool MyApp::OnInit(void)
{
MyFrame * frame = new MyFrame(NULL, wxT("wxWidgets")); //为新窗口分配空间,设定标题 frame->Show(); return wxOK;
}
/***************************************************************
* Name: MyFrame.h
* Purpose: Defines Application Frame
* Author: PingGe (414236069@qq.com)
* Created: 2013-10-14
* Copyright: PingGe (http://www.cnblogs.com/pingge/)
* License:
**************************************************************/ #ifndef WXTESTMAIN_H
#define WXTESTMAIN_H #include <wx/frame.h> class MyFrame : public wxFrame //窗体类
{
public:
//Constructor
MyFrame(wxWindow * parent, const wxString & title); //窗体的构造函数
//Destructor
~MyFrame() {}; //Event handlers
void OnAbout (wxCommandEvent & event);
void OnQuit (wxCommandEvent & event);
void OnMotion (wxMouseEvent & event);
void OnPaint (wxPaintEvent & event);
void OnMousePrc (wxMouseEvent & event);
void OnKeyPrc (wxKeyEvent & event); private:
DECLARE_EVENT_TABLE();
}; #endif // WXTESTMAIN_H
/***************************************************************
* Name: MyFrame.cpp
* Purpose: Code for Application Frame
* Author: PingGe (414236069@qq.com)
* Created: 2013-10-14
* Copyright: PingGe (http://www.cnblogs.com/pingge/)
* License:
**************************************************************/ #include <wx/wx.h>
#include <wx/dcbuffer.h>
//(*FrameHeaders
#include "MyApp.h"
#include "MyFrame.h"
#include "wxPingGe.h"
//*) //事件表:(类,基类)
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
//(*EventTable(MyFrame)
EVT_MENU (wxID_ABOUT, MyFrame::OnAbout) //把wxID_ABOUT和OnAbout关联
EVT_MENU (wxID_EXIT, MyFrame::OnQuit) //把wxID_EXIT和OnQuit关联
EVT_MOTION ( MyFrame::OnMotion) //鼠标事件
EVT_PAINT ( MyFrame::OnPaint) //刷屏消息
EVT_MOUSE_EVENTS( MyFrame::OnMousePrc) //鼠标事件
EVT_KEY_DOWN ( MyFrame::OnKeyPrc) //键盘事件
//*)
END_EVENT_TABLE() #include "wx.xpm"
MyFrame::MyFrame(wxWindow * parent, const wxString & title)
: wxFrame(NULL, wxID_ANY, title)
{
SetIcon(wxIcon(wx_xpm)); wxMenu * fileMenu = new wxMenu; //建立“文件”菜单
wxMenu * helpMenu = new wxMenu; //建立“帮助”菜单 //增加菜单项(标识、文本、帮助字符)
helpMenu->Append(wxID_ABOUT, wxT("&About...\tF2"), wxT("Show about dialog"));
fileMenu->Append(wxID_EXIT, wxT("&Exit...\tAlt-X"), wxT("Quit this programe")); wxMenuBar * menuBar = new wxMenuBar(); //建立一个菜单条
menuBar->Append(fileMenu, wxT("&File")); //将"文件"菜单加入到菜单条
menuBar->Append(helpMenu, wxT("&Help")); //将“帮助”菜单加入到菜单条 SetMenuBar(menuBar); //将菜单条放到窗体上 CreateStatusBar(); //创建两个状态栏,并写上字符串
SetStatusText(wxT("welcome to wxWidgets!"), );
} void MyFrame::OnAbout(wxCommandEvent & event)
{
wxString msg;
msg.Printf(wxT("hello and welcome to %s"), wxVERSION_STRING); //消息的字符串 //消息框:(消息内容、标题、窗口类型、父窗口)
wxMessageBox(msg, wxT("About Minimal"), wxOK | wxICON_INFORMATION, this);
} void MyFrame::OnQuit(wxCommandEvent & event)
{
Close();
} void MyFrame::OnMotion(wxMouseEvent & event)
{
if(event.Dragging()) //鼠标拖动时为真
{
wxClientDC dc(this); //创建一个指向当前窗口的设备指针dc
wxPen pen(*wxRED, ); //创建画笔,颜色:红色,宽度:1
dc.SetPen(pen);
dc.DrawPoint(event.GetPosition()); //画点
dc.SetPen(wxNullPen);
}
} void MyFrame::OnPaint(wxPaintEvent & event) //刷屏消息处理函数
{
wxBufferedPaintDC mydc(this);
mydc.SetPen(*wxWHITE_PEN); //mydc.SetBrush(*wxRED_BRUSH);
mydc.SetBrush(wxColor(, , )/*wxRED_BRUSH*/); mydc.SetBackground(wxBrush(*wxWHITE, wxSOLID)); wxSize sz = GetClientSize(); //获取窗口大小 wxCoord w = , h = ; //要绘制的矩形大小 int x = wxMax(, sz.x / ) - w / ; //将矩形放置在窗口的正中间,但不为负
int y = wxMax(, sz.y / ) - h / ; wxRect rectToDraw(x, y, w, h); if(IsExposed(rectToDraw)) //只有在需要的时候才重新画以便提高效率
{
//mydc.DrawRectangle(rectToDraw); //画矩形 //DrawTextString(mydc, wxT("test"), wxPoint(50, 50)); //画字符串 //DrawRotatedTest(mydc, wxT("PingGe"), wxPoint(100, 100), 60); //旋转字符串 DrawSimpleShape(mydc); DrawMap(mydc);
}
/*
窗口最大化后出现两个矩形,原因是窗口变大时原先部分没有刷新,
只把新增部分刷新出来;
*/
} void MyFrame::OnMousePrc(wxMouseEvent & event)
{
wxPoint pt(event.GetPosition()); //获取当前坐标pt wxClientDC dc(this); //设置一个设备上下文 if((pt.x > ) && (pt.y > ) && (event.LeftDown()))
{
wxPen pen(*wxWHITE, ); //白色画笔
dc.SetPen(pen);
dc.DrawLine(, , , ); //当鼠标左键点击位置在(100, 100)之后时用白色画笔画线
}
if(event.LeftUp())
{
wxPen pen(*wxRED, ); //红色画笔
dc.SetPen(pen);
dc.DrawLine(, , , ); //当鼠标左键弹起时,用红色画笔画线
}
} void MyFrame::OnKeyPrc(wxKeyEvent & event) //处理按键按下的消息
{
wxClientDC dc(this); //设置一个设备上下文 wxPen pen(*wxWHITE, );
dc.SetPen(pen); //白色画笔 if(event.ShiftDown()) //按下shift键画一条直线
{
dc.DrawLine(, , , );
} int code = event.GetKeyCode(); //获取按下按键的编码
if(code == )
{
dc.DrawLine(, , , ); //当按下A键时画一条直线
}
}
/***************************************************************
* Name: wxPingGe.h
* Purpose: Code for Application Frame
* Author: PingGe (414236069@qq.com)
* Created: 2013-10-14
* Copyright: PingGe (http://www.cnblogs.com/pingge/)
* License:
**************************************************************/
#ifndef _WXPINGGE_H_
#define _WXPINGGE_H_ #include <wx/wx.h>
#include <wx/dcbuffer.h> //画字符函数:(DC,文本,位置)
void DrawTextString(wxDC & dc, const wxString & text, const wxPoint & pt); //画旋转字符函数:(DC,文本,位置,旋转角度)
void DrawRotatedTest(wxDC & dc, const wxString & text, const wxPoint & pt, int angle = ); //画一些图形
void DrawSimpleShape(wxDC & dc); //画图片
void DrawMap(wxDC & dc); #endif //_WXPINGGE_H_
/***************************************************************
* Name: wxPingGe.cpp
* Purpose: Code for Application Frame
* Author: PingGe (414236069@qq.com)
* Created: 2013-10-14
* Copyright: PingGe (http://www.cnblogs.com/pingge/)
* License:
**************************************************************/ #include "wxPingGe.h" void DrawTextString(wxDC & dc, const wxString & text, const wxPoint & pt)
{
//定义一个wxFont类的对象font
//构造函数wxFont::wxFont(字体大小、字体类型(书法、艺术)、斜体)
wxFont font(, wxFONTFAMILY_SCRIPT, wxNORMAL, wxBOLD); //利用DC类的成员函数SetFont设置字体
dc.SetFont(font); //设置背景透或者不透
dc.SetBackgroundMode(wxSOLID/*wxTRANSPARENT*/); //设置前景颜色
dc.SetTextForeground(*wxRED); //设置背景颜色
dc.SetTextBackground(*wxWHITE); //写字,文本wxString,位置wxPoint
dc.DrawText(text, pt);
} void DrawRotatedTest(wxDC & dc, const wxString & text, const wxPoint & pt, int angle)
{
wxFont font(, wxFONTFAMILY_SCRIPT, wxNORMAL, wxBOLD); dc.SetFont(font); dc.SetBackgroundMode(wxTRANSPARENT/*wxSOLID*/); dc.SetTextForeground(*wxWHITE); dc.SetTextBackground(*wxRED); dc.DrawRotatedText(text, pt, angle);
} void DrawSimpleShape(wxDC & dc)
{
//设置画笔画刷
dc.SetPen(wxPen(*wxRED, , wxSOLID)); dc.SetBrush(wxBrush(*wxGREEN, wxSOLID)); //画抛物线
dc.DrawSpline(, , , , , ); //画点
dc.DrawPoint(, ); //画线:(注意,最后一个点不会画)
dc.DrawLine(, , , ); //画矩形:(用画笔画边框,画刷填充内部)
dc.DrawRectangle(, , , ); //设置画刷为红色
dc.SetBrush(*wxRED_BRUSH); //画圆角矩形
dc.DrawRoundedRectangle(, , , , ); //设置颜色
dc.SetBrush(wxColor(, , )); //画圆
dc.DrawCircle(, , );
} #include "1.xpm"
void DrawMap(wxDC & dc)
{
wxBitmap bitmap(logo_xpm);
dc.DrawBitmap(bitmap, , , wxBITMAP_TYPE_XPM); dc.SetTextBackground(*wxBLACK);
dc.SetTextForeground(*wxWHITE); wxString msg = wxT("Some text is mixed in bmp shade."); for(int i = , step = ; i < ; i++, step += )
{
dc.DrawText(msg, , step);
}
}

在屏幕上画普通文字和旋转的文字

/***************************************************************
* Name: MyApp.h
* Purpose: Defines Application Class
* Author: PingGe (414236069@qq.com)
* Created: 2013-10-14
* Copyright: PingGe (http://www.cnblogs.com/pingge/)
* License:
**************************************************************/ #ifndef WXTESTAPP_H
#define WXTESTAPP_H #include <wx/app.h> class MyApp : public wxApp //应用程序类,应用程序的入口点
{
public:
virtual bool OnInit(void); //在应用程序启动时调用,如果返回false,退出应用程序
}; #endif // WXTESTAPP_H
/***************************************************************
* Name: MyApp.cpp
* Purpose: Code for Application Class
* Author: PingGe (414236069@qq.com)
* Created: 2013-10-14
* Copyright: PingGe (http://www.cnblogs.com/pingge/)
* License:
**************************************************************/ #include <wx/wx.h>
//(*AppHeaders
#include "MyApp.h"
#include "MyFrame.h"
//*) DECLARE_APP(MyApp);
IMPLEMENT_APP(MyApp); bool MyApp::OnInit(void)
{
MyFrame * frame = new MyFrame(NULL, wxT("wxWidgets")); //为新窗口分配空间,设定标题 frame->Show(); return wxOK;
}
/***************************************************************
* Name: MyFrame.h
* Purpose: Defines Application Frame
* Author: PingGe (414236069@qq.com)
* Created: 2013-10-14
* Copyright: PingGe (http://www.cnblogs.com/pingge/)
* License:
**************************************************************/ #ifndef WXTESTMAIN_H
#define WXTESTMAIN_H #include <wx/frame.h> class MyFrame : public wxFrame //窗体类
{
public:
//Constructor
MyFrame(wxWindow * parent, const wxString & title); //窗体的构造函数
//Destructor
~MyFrame() {}; //Event handlers
void OnAbout (wxCommandEvent & event);
void OnQuit (wxCommandEvent & event);
void OnMotion (wxMouseEvent & event);
void OnPaint (wxPaintEvent & event); private:
DECLARE_EVENT_TABLE();
}; #endif // WXTESTMAIN_H
/***************************************************************
* Name: MyFrame.cpp
* Purpose: Code for Application Frame
* Author: PingGe (414236069@qq.com)
* Created: 2013-10-14
* Copyright: PingGe (http://www.cnblogs.com/pingge/)
* License:
**************************************************************/ #include <wx/wx.h>
#include <wx/dcbuffer.h>
//(*FrameHeaders
#include "MyApp.h"
#include "MyFrame.h"
#include "wxPingGe.h"
//*) //事件表:(类,基类)
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
//(*EventTable(MyFrame)
EVT_MENU (wxID_ABOUT, MyFrame::OnAbout)
EVT_MENU (wxID_EXIT, MyFrame::OnQuit)
EVT_MOTION ( MyFrame::OnMotion)
EVT_PAINT ( MyFrame::OnPaint)
//*)
END_EVENT_TABLE() #include "wx.xpm"
MyFrame::MyFrame(wxWindow * parent, const wxString & title)
: wxFrame(NULL, wxID_ANY, title)
{
SetIcon(wxIcon(wx_xpm)); wxMenu * fileMenu = new wxMenu; //建立“文件”菜单
wxMenu * helpMenu = new wxMenu; //建立“帮助”菜单 //增加菜单项(标识、文本、帮助字符)
helpMenu->Append(wxID_ABOUT, wxT("&About...\tF2"), wxT("Show about dialog"));
fileMenu->Append(wxID_EXIT, wxT("&Exit...\tAlt-X"), wxT("Quit this programe")); wxMenuBar * menuBar = new wxMenuBar(); //建立一个菜单条
menuBar->Append(fileMenu, wxT("&File")); //将"文件"菜单加入到菜单条
menuBar->Append(helpMenu, wxT("&Help")); //将“帮助”菜单加入到菜单条 SetMenuBar(menuBar); //将菜单条放到窗体上 CreateStatusBar(); //创建两个状态栏,并写上字符串
SetStatusText(wxT("welcome to wxWidgets!"));
} void MyFrame::OnAbout(wxCommandEvent & event)
{
wxString msg;
msg.Printf(wxT("hello and welcome to %s"), wxVERSION_STRING); //消息的字符串 //消息框:(消息内容、标题、窗口类型、父窗口)
wxMessageBox(msg, wxT("About Minimal"), wxOK | wxICON_INFORMATION, this);
} void MyFrame::OnQuit(wxCommandEvent & event)
{
Close();
} void MyFrame::OnMotion(wxMouseEvent & event)
{
if(event.Dragging()) //鼠标拖动时为真
{
wxClientDC dc(this); //创建一个指向当前窗口的设备指针dc
wxPen pen(*wxRED, ); //创建画笔,颜色:红色,宽度:1
dc.SetPen(pen);
dc.DrawPoint(event.GetPosition()); //画点
dc.SetPen(wxNullPen);
}
} void MyFrame::OnPaint(wxPaintEvent & event) //刷屏消息处理函数
{
wxBufferedPaintDC mydc(this);
mydc.SetPen(*wxBLACK_PEN);
mydc.SetBrush(*wxRED_BRUSH); wxSize sz = GetClientSize(); //获取窗口大小 wxCoord w = , h = ; //要绘制的矩形大小 int x = wxMax(, sz.x / ) - w / ; //将矩形放置在窗口的正中间,但不为负
int y = wxMax(, sz.y / ) - h / ; wxRect rectToDraw(x, y, w, h); if(IsExposed(rectToDraw)) //只有在需要的时候才重新画以便提高效率
{
mydc.DrawRectangle(rectToDraw); DrawTextString(mydc, wxT("test"), wxPoint(, )); //画字符串 DrawRotatedTest(mydc, wxT("PingGe"), wxPoint(, ), ); //旋转字符串
}
/*
窗口最大化后出现两个矩形,原因是窗口变大时原先部分没有刷新,
只把新增部分刷新出来;
*/
}
/***************************************************************
* Name: wxPingGe.h
* Purpose: Code for Application Frame
* Author: PingGe (414236069@qq.com)
* Created: 2013-10-14
* Copyright: PingGe (http://www.cnblogs.com/pingge/)
* License:
**************************************************************/
#ifndef _WXPINGGE_H_
#define _WXPINGGE_H_ #include <wx/wx.h>
#include <wx/dcbuffer.h> //画字符函数:(DC,文本,位置)
void DrawTextString(wxDC & dc, const wxString & text, const wxPoint & pt); //画旋转字符函数:(DC,文本,位置,旋转角度)
void DrawRotatedTest(wxDC & dc, const wxString & text, const wxPoint & pt, int angle = ); #endif //_WXPINGGE_H_
/***************************************************************
* Name: wxPingGe.cpp
* Purpose: Code for Application Frame
* Author: PingGe (414236069@qq.com)
* Created: 2013-10-14
* Copyright: PingGe (http://www.cnblogs.com/pingge/)
* License:
**************************************************************/ #include "wxPingGe.h" void DrawTextString(wxDC & dc, const wxString & text, const wxPoint & pt)
{
//定义一个wxFont类的对象font
//构造函数wxFont::wxFont(字体大小、字体类型(书法、艺术)、斜体)
wxFont font(, wxFONTFAMILY_SCRIPT, wxNORMAL, wxBOLD); //利用DC类的成员函数SetFont设置字体
dc.SetFont(font); //设置背景透或者不透
dc.SetBackgroundMode(wxSOLID/*wxTRANSPARENT*/); //设置前景颜色
dc.SetTextForeground(*wxRED); //设置背景颜色
dc.SetTextBackground(*wxWHITE); //写字,文本wxString,位置wxPoint
dc.DrawText(text, pt);
} void DrawRotatedTest(wxDC & dc, const wxString & text, const wxPoint & pt, int angle)
{
wxFont font(, wxFONTFAMILY_SCRIPT, wxNORMAL, wxBOLD); dc.SetFont(font); dc.SetBackgroundMode(wxTRANSPARENT/*wxSOLID*/); dc.SetTextForeground(*wxWHITE); dc.SetTextBackground(*wxRED); dc.DrawRotatedText(text, pt, angle);
}

在屏幕上画点和矩形

/***************************************************************
* Name: MyApp.h
* Purpose: Defines Application Class
* Author: PingGe (414236069@qq.com)
* Created: 2013-10-14
* Copyright: PingGe (http://www.cnblogs.com/pingge/)
* License:
**************************************************************/ #ifndef WXTESTAPP_H
#define WXTESTAPP_H #include <wx/app.h> class MyApp : public wxApp
{
public:
virtual bool OnInit(void);
}; #endif // WXTESTAPP_H
/***************************************************************
* Name: MyApp.cpp
* Purpose: Code for Application Class
* Author: PingGe (414236069@qq.com)
* Created: 2013-10-14
* Copyright: PingGe (http://www.cnblogs.com/pingge/)
* License:
**************************************************************/ #include "MyApp.h" //(*AppHeaders
#include "wx/wx.h"
#include "MyFrame.h"
//*) DECLARE_APP(MyApp);
IMPLEMENT_APP(MyApp); bool MyApp::OnInit(void)
{
MyFrame * frame = new MyFrame(NULL, wxT("wxWidgets")); //为新窗口分配空间,设定标题 frame->Show(); return wxOK;
}
/***************************************************************
* Name: MyFrame.h
* Purpose: Defines Application Frame
* Author: PingGe (414236069@qq.com)
* Created: 2013-10-14
* Copyright: PingGe (http://www.cnblogs.com/pingge/)
* License:
**************************************************************/ #ifndef WXTESTMAIN_H
#define WXTESTMAIN_H #include <wx/frame.h> class MyFrame : public wxFrame
{
public:
//Constructor
MyFrame(wxWindow * parent, const wxString & title);
//Destructor
~MyFrame() {}; //Event handlers
void OnAbout (wxCommandEvent & event);
void OnQuit (wxCommandEvent & event);
void OnMotion (wxMouseEvent & event);
void OnPaint (wxPaintEvent & event); private:
DECLARE_EVENT_TABLE();
}; #endif // WXTESTMAIN_H
/***************************************************************
* Name: MyFrame.cpp
* Purpose: Code for Application Frame
* Author: PingGe (414236069@qq.com)
* Created: 2013-10-14
* Copyright: PingGe (http://www.cnblogs.com/pingge/)
* License:
**************************************************************/ #include "MyFrame.h" //(*InternalHeaders(wxTestDialog)
#include "wx/wx.h"
#include "wx/dcbuffer.h"
#include "MyApp.h"
//*) BEGIN_EVENT_TABLE(MyFrame,wxFrame)
//(*EventTable(wxTestDialog)
EVT_MENU (wxID_ABOUT, MyFrame::OnAbout)
EVT_MENU (wxID_EXIT, MyFrame::OnQuit)
EVT_MOTION ( MyFrame::OnMotion)
EVT_PAINT ( MyFrame::OnPaint)
//*)
END_EVENT_TABLE() #include "wx.xpm"
MyFrame::MyFrame(wxWindow * parent, const wxString & title)
: wxFrame(NULL, wxID_ANY, title)
{
SetIcon(wxIcon(wx_xpm)); wxMenu * fileMenu = new wxMenu; //定义两个菜单项
wxMenu * helpMenu = new wxMenu; //增加菜单项(标识、文本、帮助字符)
helpMenu->Append(wxID_ABOUT, wxT("&About...\tF2"), wxT("Show about dialog"));
fileMenu->Append(wxID_EXIT, wxT("&Exit...\tAlt-X"), wxT("Quit this programe")); wxMenuBar * menuBar = new wxMenuBar(); //定义菜单条
menuBar->Append(fileMenu, wxT("&File"));
menuBar->Append(helpMenu, wxT("&Help")); SetMenuBar(menuBar); CreateStatusBar(); //创建两个状态栏,并写上字符串
SetStatusText(wxT("welcome to wxWidgets!"));
} void MyFrame::OnAbout(wxCommandEvent & event)
{
wxString msg;
msg.Printf(wxT("hello and welcome to %s"), wxVERSION_STRING); //消息的字符串 //消息框:(消息内容、标题、窗口类型、父窗口)
wxMessageBox(msg, wxT("About Minimal"), wxOK | wxICON_INFORMATION, this);
} void MyFrame::OnQuit(wxCommandEvent & event)
{
Close();
} void MyFrame::OnMotion(wxMouseEvent & event)
{
if(event.Dragging()) //鼠标拖动时为真
{
wxClientDC dc(this); //创建一个指向当前窗口的设备指针dc
wxPen pen(*wxRED, ); //创建画笔,颜色:红色,宽度:1
dc.SetPen(pen);
dc.DrawPoint(event.GetPosition());
dc.SetPen(wxNullPen);
}
} void MyFrame::OnPaint(wxPaintEvent & event)
{
wxBufferedPaintDC mydc(this);
mydc.SetPen(*wxBLACK_PEN);
mydc.SetBrush(*wxRED_BRUSH); wxSize sz = GetClientSize(); //获取窗口大小 wxCoord w = , h = ; //要绘制的矩形大小 int x = wxMax(, sz.x / ) - w / ; //将矩形放置在窗口的正中间,但不为负
int y = wxMax(, sz.y / ) - h / ; wxRect rectToDraw(x, y, w, h); if(IsExposed(rectToDraw)) //只有在需要的时候才重新画以便提高效率
{
mydc.DrawRectangle(rectToDraw);
}
/*
窗口最大化后出现两个矩形,原因是窗口变大时原先部分没有刷新,
只把新增部分刷新出来;
*/
}

wxWidgets学习笔记——在屏幕上画简单的图形和文字的更多相关文章

  1. (转)第02节:在Canvas上画简单的图形

    我们现在已经可以在HTML中使用Fabric.js库了,那这节我们就详细的学习一下如何在canvas上画出简单的图形. 在画东西之前我们需要了解画任何东西的基本三个步骤: 声明画布(canvas),用 ...

  2. unity3d之在屏幕上画线

    如何在屏幕上画线,简单的代码如下: using UnityEngine; public class Test : MonoBehaviour { void OnGUI() { GL.LoadOrtho ...

  3. SpringMVC:学习笔记(8)——文件上传

    SpringMVC--文件上传 说明: 文件上传的途径 文件上传主要有两种方式: 1.使用Apache Commons FileUpload元件. 2.利用Servlet3.0及其更高版本的内置支持. ...

  4. Django:学习笔记(8)——文件上传

    Django:学习笔记(8)——文件上传 文件上传前端处理 本模块使用到的前端Ajax库为Axio,其地址为GitHub官网. 关于文件上传 上传文件就是把客户端的文件发送给服务器端. 在常见情况(不 ...

  5. Flutter学习笔记(14)--StatefulWidget简单使用

    如需转载,请注明出处:Flutter学习笔记(14)--StatefulWidget简单使用 今天上班没那么忙,突然想起来我好像没StatefulWidget(有状态组件)的demo,闲来无事,写一个 ...

  6. 学习笔记:利用GDI+生成简单的验证码图片

    学习笔记:利用GDI+生成简单的验证码图片 /// <summary> /// 单击图片时切换图片 /// </summary> /// <param name=&quo ...

  7. Directx11学习笔记【一】 最简单的windows程序HelloWin

    声明:本系列教程代码有部分来自dx11龙书及dx11游戏编程入门两本书,后面不再说明 首先,在vs2013中创建一个空的解决方案Dx11Demo,以后的工程都会放在这个解决方案下面.然后创建一个win ...

  8. Web安全学习笔记 SQL注入上

    Web安全学习笔记 SQL注入上 繁枝插云欣 --ICML8 SQL注入分类 SQL注入检测 一.注入分类 1.简介 SQL注入是一种代码注入技术用于攻击数据驱动的应用程序在应用程序中,如果没有做恰当 ...

  9. deepin linux学习笔记(四)进不去图形界面怎么办?

    目录 deepin linux学习笔记(四)进不去图形界面怎么办? 前言 更换成lxde桌面 进不去图形界面怎么办? 总结 deepin linux学习笔记(四)进不去图形界面怎么办? 前言 生命不息 ...

随机推荐

  1. 九度OJ 1118 数制转换

    题目地址:http://ac.jobdu.com/problem.php?pid=1118 题目描述: 求任意两个不同进制非负整数的转换(2进制-16进制),所给整数在long所能表达的范围之内.   ...

  2. 状态模式(State Pattern)

    状态模式:允许对象在内部状态改变时改变它的行为,对象看起来好像修改了它的类. 这个模式将状态封装成为独立的类,并将动作委托到代表当前对象的对象,这样行为就与拥有状态类解耦了. 从客户的角度来看,对象的 ...

  3. ASP.NET全局文件与防盗链

    添加Web→全局应用程序类,注 文件名不要改 Global.asax 全局文件是对Web应用声明周期的一个事件响应的地方,将Web应用启动时初始化的一些代码写到 Application_Start中, ...

  4. Cookies和Sseeion的选择

    Cookies和Session都是用来记录个人信息  来保持页面状态 现在介绍些Cookies 的优点 1 把存储数据的压力分担到了客户端 ,这样服务器就少点压力 2 可以用来记录用户状态(如放入用户 ...

  5. python 自动化之路 day 08_2 网络编程

    本节内容 Socket介绍 Socket参数介绍 基本Socket实例 Socket实现多连接处理 通过Socket实现简单SSH 通过Socket实现文件传送 作业:开发一个支持多用户在线的FTP程 ...

  6. Unix环境高级编程学习笔记——fcntl

    写这篇文正主要是为了介绍下fcntl,并将我自己在学习过程中的一些理解写下来,不一定那么官方,也有错误,希望指正,共同进步- fcntl: 一个修改一打开文件的性质的函数.基本的格式是 int fcn ...

  7. Nginx 第三方模块-漫谈缘起

    http://www.cnblogs.com/yjf512/archive/2012/03/30/2424726.html http://chenxiaoyu.org/2011/10/30/nginx ...

  8. 结构型模式(Structural patterns)->外观模式(Facade Pattern)

    动机(Motivate): 在软件开发系统中,客户程序经常会与复杂系统的内部子系统之间产生耦合,而导致客户程序随着子系统的变化而变化.那么如何简化客户程序与子系统之间的交互接口?如何将复杂系统的内部子 ...

  9. css3实现垂直居中,水平

    .box{ text-align:center; } .content{ margin-top:50%; transform:translateY(-50%);/**沿Y轴移动**/ } <di ...

  10. 如何在版本控制工具中管理Sencha Architect的項目

    根據數次痛苦的經歷結合stack overflow上的解答,發現原來還是可以使用svn.git之類的版本控制工具管理Sencha Architect生成的項目的. 具體的要點如下,假定項目記作{PRO ...