Embed Windows Form on Excel Sheet (Like Excel Charts)

218 views
Skip to first unread message

Zeeshan Akram

unread,
Jun 29, 2016, 7:05:48 AM6/29/16
to Excel-DNA
Hi,

have been using ExcelDna for a while. thanks to Govert for this effort.

have a question today,
usually, when we create a Windows Form object in an Exce add-in and we call Form.Show() or Form.ShowDialog() and it displays the form. but it's displayed as a separate window.

is it possible, somehow, that we do not display the Form as a separate Window, and embed it on the Excel sheet, just like built in charts of Excel are "pasted" on the sheets.


please guide...

thanks and best regards,
M Zeeshan Akram

Govert van Drimmelen

unread,
Jun 29, 2016, 7:22:46 AM6/29/16
to exce...@googlegroups.com

You are looking for “Custom Task Panes”.

 

There are some examples on GitHub on how you can add these to an Excel-DNA add-in, the simplest being something like this: https://github.com/Excel-DNA/ExcelDna/blob/master/Distribution/Samples/CustomTaskPane.dna

 

You can search for related issues on the Google group and the MSDN “Excel for Developers” list too. There are some quirks related to the multiple Window UI since Excel 2013 that you might run into.

 

-Govert

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at https://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.

Zeeshan Akram

unread,
Jun 29, 2016, 11:27:38 PM6/29/16
to Excel-DNA
hi Govert,

thanks a lot for the reply :)
I've checked the task panes already, but I was not sure if I can use a CTP just like a WinForm. (for example, get click events, draw lines on it etc).

to be more specific, this is what I'm trying to do, but with the pane embedded on sheet instead of a popup
(I click one point, then another point, and it draws a line between two points, and so on... I have done it with ExcelDna and WinForms)

so, do you think we can achieve the same functionality using CTP(s) ?
please suggest...

Govert van Drimmelen

unread,
Jun 30, 2016, 2:42:47 AM6/30/16
to exce...@googlegroups.com
Hi Zeeshan,

Yes, it should be fine in a CTP.
The mouse events and everything will be managed by a WinForms UserControl, instead of a Form, as your top-level object. The UserControl is then embedded in the CTP. Everything else should be the same.

-Govert
--

Zeeshan Akram

unread,
Jul 21, 2016, 10:08:20 AM7/21/16
to Excel-DNA
hi Govert,

it worked the way I needed (for one instance. I'll see if I can workaround for multiple instances opened at same time, if needed).

thanks a lot

best regards,
Zeeshan
Reply all
Reply to author
Forward
0 new messages