⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mdraw.cpp

📁 飞虹 vision仿windows开发
💻 CPP
字号:
#include"\sunshine\include\mdraw.h"
#include"\sunshine\include\mdia.h"
#include"\sunshine\include\mtext.h"
#include"\sunshine\include\mradio.h"
#include"\sunshine\include\mstaticb.h"
#include"\sunshine\include\medit.h"
#include<stdlib.h>
#include<fstream.h>
#include<alloc.h>
int saveb::F()
 {
	char *c1="文件名\n";
	int sx=160,sy=60;
	MDialog &adia=*new MDialog(
			  sx,sy,290,120,"SAVED","存盘");
		adia.Add(*new SavePB(sx+32,sy+70));
		adia.Add(*new Cancelb(sx+148,sy+70));
		adia.Add(*new MEdit(sx+70,sy+40,20,TEXT,"LIB\\NONAME.BMP","edit1"));
		adia.Add(*new MText(sx+20,sy+45,"ST",c1));
		MApp::Application->Add(adia);
		return 1;
 }
int SavePB::F()
 {
  int px=(MApp::Application->GetObj("PBOX")).x();
  int py=(MApp::Application->GetObj("PBOX")).y();
  int pw=(MApp::Application->GetObj("PBOX")).w();
  int ph=(MApp::Application->GetObj("PBOX")).h();
  long imagelength=imagesize(px,py,px+pw-1,py+ph-1);
  void far *savebuffer=farmalloc(imagelength);
  ofstream file(((MEdit&)((MDialog&)MApp::Application->GetObj("SAVED")).
					  GetObj("edit1")).GetEdit(),ios::binary);
  if(!file) return 1;
  if(savebuffer==(void far *)0xffff) return 1;
  getimage(px,py,px+pw-1,py+ph-1,savebuffer);
  char far *c;
  c=(char far*)savebuffer;
  file.write((char *)&pw,2);file.write((char *)&ph,2);
  for(long i=0;i<imagelength&&file;i++) file.put(*c++);
  farfree(savebuffer);
  return DEL;
 }
int readb::F()
 {
	char *c1="文件名\n";
	int sx=160,sy=160;
	MDialog &adia=*new MDialog(
			  sx,sy,290,120,"READD","读入");
		adia.Add(*new ReadPB(sx+32,sy+70));
		adia.Add(*new Cancelb(sx+148,sy+70));
		adia.Add(*new MEdit(sx+70,sy+40,20,TEXT,"LIB\\NONAME.BMP","edit1"));
		adia.Add(*new MText(sx+20,sy+45,"ST",c1));
		MApp::Application->Add(adia);
		return 1;
 }

int ReadPB::F()
 {
  ifstream file(((MEdit&)((MDialog&)MApp::Application->GetObj("READD")).
					  GetObj("edit1")).GetEdit(),ios::binary);
  void far *pbuffer;
  char far *c;
  int ww,hh;
  long length;
  if(!file) return 1;
  file.read((char *)&ww,2);
  file.read((char *)&hh,2);
  file.seekg(0,ios::end);
  length=file.tellg();
  file.seekg(4,ios::beg);
  if((pbuffer=farmalloc(length))==(void far *)0xffff) return 1;
  c=(char far*)pbuffer;
  while(file) file.get(*c++);
  MApp::Application->Del("PBOX");
  MApp::Application->Del("CELLBOX");
  CellBox &ac=*new CellBox(130,10,ww,hh);
  PBox &ap=*new PBox(10,10,ww,hh);
  ac.TransMes(READ);
  ap.TransMes(READ);
  MApp::Application->Add(ac);
  MApp::Application->Add(ap);
  Mouse am(1);
  putimage(10,10,pbuffer,COPY_PUT);
  farfree(pbuffer);
  return DEL;
 }

//clear picture class function////////////////////////
int clearb::F()
 {
		char *c="选确认将把你现在所画的图形清除掉\n"
				  "   请慎重考虑后才确定操作\n";
		MDialog &adia=*new MDialog(
			  60,60,350,150,"CLEARD","清除确认");
		adia.Add(*new Yesb(60+60,60+106));
		adia.Add(*new Cancelb(60+180,60+106));
		adia.Add(*new MText(60+40,60+60,"ST",c));
		MApp::Application->Add(adia);
		return 1;
 }
int Yesb::F()
 {
  (MApp::Application->GetObj("CELLBOX")).TransMes(ERASE);
  (MApp::Application->GetObj("PBOX")).TransMes(ERASE);
  return DEL;
 }
int aboutb::F()
 {
	 char *c="       DRAW TOOL\n "
				"\n"
				"  未经作者许可,不得擅自复制和转让\n"
				"  COPYRIGHT 1994,1997\n"
				"       四川南充    杨海俊\n"
				"南充炼油厂计算机室

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -