22.01.2014, 21:11 | #1 |
Участник
|
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, напишите личное сообщение администратору. |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|