473,322 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Drawing on CodeWindow - AddIn

I created an addin and wrote a class that inherits from
System.Windows.Forms.NativeWindow. In the Connect method, I created an
event handler to listen for DTE.Events.DocumentEvents.DocumentOpened. In
the handler for DocumentOpened, I call EnumChildWindows. In the callback
for EnumChildWindows, I compare the child window's text (using GetText API)
to the caption of the document being opened (Document.ActiveWindow.Caption).
All this works fine and dandy, when the caption of the doc = the child
window's text, the hWnd passed to the EnumChildWindows callback function is
the handle I use to create the NativeWindow derived class. I am overriding
the NativeWindow derived class' WndProc and listening for the WM_PAINT
message. The problem is, I can't seem to figure out how to paint a line on
the device context of the window. My WndProc code is modified from C++
version of the VSWallPaper WndProc code. The following is my WndProc
method:

protected override void WndProc(ref Message Message)
{
if (Message.Msg == (int) WindowMessage.Paint) {
// Save the update rectangle.
RECT rc;
rc = new RECT(1, 1, 1, 1);
bool result = GetUpdateRect(mWindowHandle, out rc, false);

IntPtr hdc = GetDC(mWindowHandle);

// Call the .Net handler.
base.WndProc(ref Message);

if (!IsRectEmpty(ref rc) && !mReEntry) {
HideCaret(mWindowHandle);

// Draw the line.
MoveToEx(hdc, rc.Left, rc.Top, IntPtr.Zero);
LineTo(hdc, rc.Width, rc.Height / 2);
}

// Cleanup.
ReleaseDC(mWindowHandle, hdc);
Message.Result = new IntPtr(1);
return;
}

base.WndProc(ref Message);
}
If any can help me get this working, it would be great! As of now, the
CodeWindow doesn't even refresh. When I alt-tab, then alt-tab back, the
code window doesn't get repainted and shows whatever I alt-tabbed to,
instead of being the code window.

Thanks! :)

Mythran

Dec 30 '05 #1
1 1453
Have you tried using a Graphics object. I think you might get your
results your looking for by looking into that.

Dec 30 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Jaime Rios | last post by:
Hi, I created a COM AddIn for Word that performs the functions that it needs to, but I needed to add the ability for the toolbar created by the COM AddIn to remember it's last position and...
6
by: jchao123 | last post by:
Dear All, I have an MDB file (Access 2000/XP) which contains generic routines I use in various apps (eg, API calls, File access classes etc). I have compiled into an MDE file which I reference...
0
by: maitrepoy | last post by:
Hello I have to create a small addin which works on Powerpoint, Word, Outlook, and Excel on Office 2000, XP, and 2003. This addin consists in adding 2 new Buttons in the "File" Menu of office....
0
by: guilligan.geo | last post by:
Hello, I'm trying to create an addin for Outlook 2002 using the one provided in the demo of win32com as a starting point. I've been able to do my addin and test it if I go the "standard" way...
7
by: Joseph Geretz | last post by:
I've been working on an Addin for Outlook in C#. It hasn't been long now, just a couple of days. Suddenly though, running my project in Debug launches Outlook as specified, but no breakpoints...
1
by: AlexZh | last post by:
Hi, I'd like to stop command line build by one project build failed. To do that I've created simple AddIn (see code below), that works fine for IDE and does not work for command line. In the AddIn...
6
by: Christof Nordiek | last post by:
Hi, I created an Addin Project with the Addin-Project-Wizzard in VS2005. I added some code from a Knowledge Base How To und built the project. It worked, and the Addin got registered with...
1
by: Rainer Queck | last post by:
Hello NG, I moved my AddIn Project from one machine to a other. This AddIn is a AddIn for Visual Studio 2005.
1
by: John | last post by:
Hi I have a simple Outlook 2003 AddIn created using Outlook 2003 AddIn template in vs 2008. The full code is given below at the end. I got warnings on Interop assemblies as I have Office 2007...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.