| 
 
				Отличный ответ, спасибо! 
EDIT: good news --- 
you can place any custom *.pcx, *.def, *.bmp inside your plugin folder and it can be used directly. 
вы можете разместить любой заказ, *.pcx, *.def, *.bmp ..., внутри папки плагинов и его можно использовать напрямую.
   
EDIT2: after some thinking... started making a function for dynamic background. 
Lacks color but maybe that can be fixed... 
после некоторых размышлений, я начал делать функцию для динамического фона.
 
It works will all graphic modes as far as I could tell.
 
Code:
 int create_standard_background(_Dlg_* dlg, int status_bar){
 //dlg->AddItem(_DlgStaticPcx8_::Create(0, 0, min(dlg->width,256), min(dlg->height,256), 0, "DiBoxBck.pcx"));
 
 int current_x, remaining_x, current_y, remaining_y, horizontal_row;
 
 current_x = 0;
 remaining_x = dlg->width;
 current_y = 0;
 remaining_y = dlg->height;
 horizontal_row = 0;
 
 if (remaining_x < 64 || remaining_y < 64)
 return 0;
 
 while (TRUE) {
 while (TRUE) { // do horizontal pass first
 if (remaining_x > 0) {
 dlg->AddItem(_DlgStaticPcx8_::Create(current_x, horizontal_row * 256, min(remaining_x, 256), min(remaining_y, 256), 0, "DiBoxBck.pcx"));
 current_x = current_x + 256;
 remaining_x = remaining_x - 256;
 }
 else break;
 }
 current_x = 0;        // reset x position to 0
 remaining_x = dlg->width; // reset length of horizontal line
 remaining_y = remaining_y - 256; // update remaining y since we're done with horizontal pass
 horizontal_row = horizontal_row + 1;    // we might be working on a new row soon if condition below is met
 if (remaining_y <= 0)
 break;        // no more rows to add
 }
 
 int top_left = 0;
 int top_right = 1;
 int bottom_left = 2;
 int bottom_right = 3;
 int left_middle = 4;
 int right_middle = 5;
 int top_middle = 6;
 int bottom_middle = 7;
 
 if (status_bar) {
 bottom_left = 8;
 bottom_right = 9;
 bottom_middle = 10;
 }
 
 // add horizontal borders
 current_x = 0;
 remaining_x = dlg->width;
 while (remaining_x >= 64) {
 dlg->AddItem(_DlgStaticDef_::Create(current_x, 0, 0, "dialgbox.def", top_middle, 0, 0));
 dlg->AddItem(_DlgStaticDef_::Create(current_x, dlg->height - 64, 0, "dialgbox.def", bottom_middle, 0, 0));
 current_x += 64;
 remaining_x -= 64;
 }
 // add vertical borders
 current_y = 0;
 remaining_y = dlg->height;
 while (remaining_y >= 64) {
 dlg->AddItem(_DlgStaticDef_::Create(0, current_y, 0, "dialgbox.def", left_middle, 0, 0));
 dlg->AddItem(_DlgStaticDef_::Create(dlg->width - 64, current_y, 0, "dialgbox.def", right_middle, 0, 0));
 current_y += 64;
 remaining_y -= 64;
 }
 
 // add four corners
 dlg->AddItem(_DlgStaticDef_::Create(0, 0, 0, "dialgbox.def", top_left, 0, 0));
 dlg->AddItem(_DlgStaticDef_::Create(0, dlg->height - 64, 0, "dialgbox.def", bottom_left, 0, 0));
 dlg->AddItem(_DlgStaticDef_::Create(dlg->width - 64, 0, 0, "dialgbox.def", top_right, 0, 0));
 dlg->AddItem(_DlgStaticDef_::Create(dlg->width - 64, dlg->height - 64, 0, "dialgbox.def", bottom_right, 0, 0));
 }
  
				
(This post was last modified: 08.09.2017 10:24 by RoseKavalier.)
 |