AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 22.01.2014, 21:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
palleagermark: Setup a Manged WPF control for drag 'n' drop
Источник: http://www.agermark.com/2014/01/setu...ag-n-drop.html
==============

In an earlier post I have made an example of to make a form with a drag 'n' drop enabled WPF control.

Now, here is the initialization code to put a nice image in the control (which is a PictureBox control now), and set the transparency color of the control to the background color of , in this case, the tab page it is on:

private void initDropControl()
{
Image resImg;
System.Drawing.Image img;
System.Drawing.Color backGroundColor;
int colorR;
int colorG;
int colorB;
System.Windows.Forms.PictureBox dropControl;

// Get handle to the control
dropControl = ManagedHostDropFile.control();

// Setup event handlers for the control
dropControl.add_DragDrop(new ManagedEventHandler(this, 'dropFile_DragDrop'));
dropControl.add_DragEnter(new ManagedEventHandler(this, 'dropFile_DragEnter'));
dropControl.set_AllowDrop(true);

// Load the AX resource image
resImg = new Image();
resImg.loadResource(12452);

// Get the tab page background color
backGroundColor = System.Drawing.ColorTranslator::FromOle(TabPageLoadFile.backgroundColor());
colorR = backGroundColor.get_R();
colorG = backGroundColor.get_G();
colorB = backGroundColor.get_B();

// Set the transparancy color of the AX resource image to the tab page background color
resImg.transparent(true, colorR, colorG, colorB);

// Create an image object that the WPF control is able to load
img = System.Drawing.Image::FromHbitmap(new System.IntPtr(resImg.exportBitmap()));

// Add the image to the control
dropControl.set_Image(img);
}


Источник: http://www.agermark.com/2014/01/setu...ag-n-drop.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Axilicious:Hosting custom WPF calendar control in AX 2012 Blog bot DAX Blogs 0 20.05.2013 18:11
palleagermark: Setup the March 2013 demo machine for VirtualBox Blog bot DAX Blogs 0 02.04.2013 23:12
emeadaxsupport: AX for Retail 2012 R2: Adding a Custom User Control to the POS Blog bot DAX Blogs 0 27.02.2013 07:14
palleagermark: Parsing a custom parameter from a user control to a data set used on another user control Blog bot DAX Blogs 0 28.10.2010 12:05
axStart: Microsoft Dynamics AX 2009 White Paper: Team Foundation Server Version Control Setup Blog bot DAX Blogs 0 27.07.2008 13:06

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 18:10.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.