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

📄 win_infocreatdraft.c

📁 这是一个linux下基于MiniGUI的手机界面设计源码
💻 C
字号:
/*win_infoCreatDraft.c*/#include "sysSrcInfo.h"#define ID_EDIT_MLEDIT 234#define ID_EDIT_EDIT   354static HWND editTitleCreatDraft,mleditCreatDraft;static HWND hWndMainCreatDraft;static BITMAP bmp_CreatDraft;	//缓存中间状态栏图片static int flagCreatDraft;static int currDraft ,countDraft;static const char *bmp_name_CreatDraft[] = {"./Pictures/b_windowsbackground_1.PNG",			//第一张来做主界面"./Pictures/OK.PNG",			"./Pictures/return.PNG"				};static skin_item_t skin_main_items [] ={{SIID_OK,           SI_TYPE_CHKBUTTON    | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,     BUTTONLEFT_X,   BUTTON_Y, {},    1 ,"" },{SIID_RETURN,        SI_TYPE_CHKBUTTON   | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,     BUTTONRIGHT_X, BUTTON_Y, {},   2, "" }};/* 定义皮肤 */static skin_head_t main_skin_CreatDraft ={    "main",  //const BITMAP* bmps;   SKIN_STYLE_TOOLTIP, NULL, NULL,     0, 2, skin_main_items, FALSE /** The number of the items in this skin. */  /* 定义皮肤元素数组 */};static void CloseWindow_CreatDraft(){                    	LoadSkinBmps( &main_skin_CreatDraft, FALSE ,bmp_name_CreatDraft ,					(sizeof (bmp_name_CreatDraft))/sizeof(char *) );            ShowWindow ( hWndMainCreatDraft, SW_HIDE);			UnloadBitmap(  &bmp_CreatDraft );}static int main_event_cb (HWND hwnd, skin_item_t* item, int event, void* data){	FILE *fp;	int i;    if (event == SIE_BUTTON_CLICKED) {        switch (item->id) {  //按的那个图片		    case SIID_OK:    //				if (flagCreatDraft == 1){//新建草稿					draftBox.lockSymbol=0;					GetWindowText (editTitleCreatDraft,draftBox.title,10);					GetWindowText (mleditCreatDraft,draftBox.content,209);					fp=fopen("./DataBase/draftbox.data","a");//add					fwrite(&draftBox,sizeof(struct draftbox),1,fp);					fclose(fp);				}				else if(flagCreatDraft == 2){//修改草稿					GetWindowText (editTitleCreatDraft,draftBoxs[currDraft].title ,41);					GetWindowText (mleditCreatDraft,draftBoxs[currDraft].content ,201);					WriteToCreatDraft(countDraft);									}                 break;                  case SIID_RETURN://return				 				 win_InfoDraftbox ( hWndMain);				 CloseWindow_CreatDraft ();            break;        }    }    return 1;}static int msg_event_cb_CreatDraft (HWND hwnd, int message, WPARAM wparam, LPARAM lparam, int* result){	HDC hdc;	int i=0;        switch (message) {            case MSG_CREATE:				LoadBitmap (HDC_SCREEN, &bmp_CreatDraft, "Pictures/system.PNG");				 editTitleCreatDraft = CreateWindow( CTRL_SLEDIT, "",							WS_VISIBLE  | WS_CHILD | WS_BORDER ,//|ES_READONLY ,// | ES_AUTOWRAP,							ID_EDIT_EDIT,35, 21,120 , 18, hwnd, 0);				 //SendMessage (editTitleCreatDraft, EM_SETLINEHEIGHT,line_height,0); 					 SendMessage (editTitleCreatDraft, EM_LIMITTEXT, 10,0L);//set length of inputing text				mleditCreatDraft = CreateWindow( CTRL_MLEDIT,  "",WS_VISIBLE | WS_BORDER  							| WS_VSCROLL  | ES_AUTOWRAP, ID_EDIT_MLEDIT, 0, 40,158 , 95, hwnd, 0);							SendMessage (mleditCreatDraft, EM_SETLINEHEIGHT,10,0);//行高				SendMessage (mleditCreatDraft, EM_LIMITTEXT, 99,0L);//set length of input text								if (flagCreatDraft == 2)				{					SetWindowText (editTitleCreatDraft,draftBoxs[currDraft].title);					SetWindowText (mleditCreatDraft,draftBoxs[currDraft].content);								}		  				break;            case MSG_PAINT :				hdc=BeginPaint (hwnd); 						SetBkMode (hdc, BM_TRANSPARENT); 		  				FillBoxWithBitmap (hdc, ZTL_PIC_X,ZTL_PIC_Y, ZTL_PIC_W,ZTL_PIC_H, &bmp_CreatDraft);		  				if (flagCreatDraft == 1){						TextOut (hdc, WZ_ZTL_X4, WZ_ZTL_Y, "新建草稿" );						}						else if (flagCreatDraft == 2)						{						TextOut (hdc, WZ_ZTL_X4, WZ_ZTL_Y, "修改草稿" );						}						 						TextOut (hdc, RJ_X, 22, "主题" ); 				EndPaint (hwnd,hdc);                 break;    }    return 1;}int win_infoCreatDraft (HWND hwnd ,int currDraftFlag,int count, int flag ){    	MSG msg;    	flagCreatDraft = flag;	currDraft = currDraftFlag;	countDraft = count;       if (!InitMiniGUIExt()) { //must have the function                // return 2;        }	LoadSkinBmps( &main_skin_CreatDraft, TRUE ,bmp_name_CreatDraft ,					(sizeof (bmp_name_CreatDraft))/sizeof(char *) );    	if (main_skin_CreatDraft.bmps == NULL) {      	  	printf ("Could not load skin bitmaps!\n");    	}	//定义的皮肤,皮肤事件回调函数,皮肤窗口消息回调函数    	if ( !skin_init (&main_skin_CreatDraft, main_event_cb, msg_event_cb_CreatDraft) ){    /* 初始化皮肤 */        	printf ("skin init fail!\n");    	}    	else{               hWndMainCreatDraft = create_skin_control (&main_skin_CreatDraft,                                 hwnd,1324, DEF_X_, DEF_Y_,  DEF_WIDTH, DEF_HEIGHT);			  currShowWindowHwnd = hWndMainCreatDraft;	        	}       }#ifndef _LITE_VERSION#include <minigui/dti.c>#endif

⌨️ 快捷键说明

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