|
Please check following codes, it dosen'g work properly, the title bar is still empty.
( the method PanitNonClientArea(Graphics, RectangleF) can work properly. )
<br />
protected override void WndProc(ref Message m)<br />
{<br />
Graphics g;<br />
RectangleF rectf;<br />
<br />
Point pt;<br />
<br />
switch (m.Msg)<br />
{<br />
case WMConsts.WM_NCPAINT :<br />
IntPtr hrgn = m.WParam;<br />
if ( hrgn != (IntPtr)1 )<br />
{<br />
Region rgn = Region.FromHrgn(hrgn);<br />
g = CreateGraphics();<br />
rectf = rgn.GetBounds(g);<br />
PaintNonClientArea(g, rectf);<br />
}<br />
else<br />
{<br />
g = CreateGraphics();<br />
rectf = new RectangleF(0,-23, Width, 23);<br />
PaintNonClientArea(g, rectf);<br />
g.Dispose();<br />
}<br />
<br />
break;<br />
<br />
default :<br />
base.WndProc (ref m);<br />
break;<br />
}<br />
}<br />
|
|
|
|
|
I want to create a menu control on top of all windows and desktop as parent.so that I can make it available to all applications..Is it possible?
VikramS
|
|
|
|
|
You mean a menu-like equivalent of the Taskbar? Yes, it's possible. If you plan to do this in C#, you're going to be redefine a hell of a lot of interfaces and structs. You best stick to C++ because this requires a lot of COM.
For starters, see the Platform SDK docs for the SHAppBarMessage function, or search for said function in google. There are lots of examples, though mostly in VB and Delphi, but it shouldn't be hard for you to understand the concepts.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
|
Good find!
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Im writing a toolbar for internet explorer . I am usijng COM . I need to access the current document in the browser . How do i do this . Ie what are the classes i can use . The code for this is to be embedded in the toolbar and the functions in the toolbar code should be able to perform some actions on the document in the browser . Also importantly i need to get the selected /highlited section in the document . Are there direct classes supporting this operation .
Srikar Y
NITK Surathkal
|
|
|
|
|
First, wrong forum.
Second, when writing COM clients, there's really no such things as classes that you can access. Everything is done through interfaces. If you're writing a COM server, you of course use classes but they implement the interface through which clients access the classes. This is one of the fundamentals of COM.
Finally, when the host (Internet Explorer) calls IObjectWithSite::SetSite(IUnknown*) , you QI (QueryInterface) for the IWebBrowser2 interface. That's your web browser. Later, call IWebBrowser2::get_Document(IDispatch**) and QI the IDispatch for IHTMLDocument2 (or a newer interface, depending on your browser requirements).
Next time, though, there is a forum for ATL and COM. This would be a more suitable place. If you are using C# to do this, instead of QI'ing for an interface, you simply do a type-cast. The CLR treats this the same.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
|
How can I draw zigzag red lines under some words in a RichTextBox or any other textual environment? (Just like what is done in spell checkers)
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
I create a MDI contain form, add a MainMenu, a ImageList, a ToolBar, and the ToolBar relate the ImageList.
When I use the function Application.EnableVisualStyles() to enable xp style, the toolbar icons are disappeared. But when I use instead of a manifest file, the toolbar icons display correct.
Is this a bug with .net framwork 1.1?
(I used VS.net2003 simplified chinese version)
=== Game is power! ===
|
|
|
|
|
Does anyone know if it is possible to give the ComboBox control a flat appearance? If not, do you know where I may find a flat combo box?
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Anything's possible (given time)!
Search for the author "Carlos H. Perez". He has some great flat controls available here on CP.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Heath Stewart wrote:
He has...
He had...
|
|
|
|
|
Yeah, I noticed that just today. I remember him saying that he was moving everything new to a commercial library. Nice of him to pull the old stuff! Greedy bastard.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I can get the form's graphics with CreateGraphics(). But how can I get the title bar's graphics? or How to determine the title bar's retangle?
The wParam gotten from WM_NCPAINT always is 1.
|
|
|
|
|
Ok, I am trying to figure out the best way to do this. I have string representing an HTML page that I need to render and then save as a .jpg or .gif image. I currently use the IE control to preview the HTML page, but I need to be able to capture an image without previewing the document. Any pointers or ideas?
|
|
|
|
|
I'm currently working on a project where I need to scrape a web page for info.
Seems pretty simple far. The problem is that the site has a password protected front end. When you log in it takes you to a menu page. The data I want to scrape is on another inside the site.
The question is after making my initial webrequest and posting data to the stream, how to I navigate to another page and then do a request for it's data.
Thanks in advance
|
|
|
|
|
Are you using the WebClient class? Does the site use cookies to store session data? If so, make sure to set it up to receive those cookies.
|
|
|
|
|
I solved this.
I am using HttpWebRequest and HttpWebResponse. I created a CookieContainer to hold all the session stuff from the first request which is the login page.
I can now copy that Cookie container into the CookieContainer of any new request that I want to make on the site.
HttpWebRequest loginRequest = null;
HttpWebRequest secondPageRequest = null;
loginRequest = (HttpWebRequest)WebRequest.Create(loginURL);
secondPageRequest = (HttpWebRequest)WebRequest.Create(secondPageURL);
CookieContainer loginCookies = new CookieContainter();
loginCookies = loginRequest.CookieContainer;
secondPageRequest.CookieContainer = loginCookies;
Thanks
David
|
|
|
|
|
Heath Stewart kindly provided me with the code snippet below which works generally for exposing functionality that somebody's wrapper of a windows system control left out.
My question now is, how do i best integrate it with VS Designer? The textbook way is to create a new component TreeViewNoHScroll. I am then free to register the class in the designer toolbox etc. But that seems a bit heavy, adding my own Windows Forms control dll to the toolbox for every simple wrapper patch. At the other extreme, I could directly edit the designer code where it creates the new TreeView() and make it a new TreeViewNoHScroll, but I dont like to muck with designer generated code because i have a hard enough time replacing controls or properties that somehow get lost and dealing with other designer quirks and gremlins.
So, is there a way to dynamically create a TreeViewNoHScroll that inherits from the existing instance of a designed TreeView, before the window is created? Or to somehow use reflection to just replace the protected function in TreeView without even creating a new wrapper class?
What's the best way to fix the wrapper with minimal impact on the designer? Thanks in advance for any suggestions.
// Exposing functionality from under a Wrapper, courtesy Heath Stewart
private const int TVS_NOSCROLL = 0x8000;
protected override CreateParams CreateParams
{
get
{
CreateParams ret = base.CreateParams;
ret.Style |= TVS_NOSCROLL;
return ret;
}
}
|
|
|
|
|
You could put the create params in an enum and create a new control from the treeview
TreeViewEx or something and expose the parameters as a property
You can then set the property to noscroll for the implementation you want, instead of hard coding the create params. This also gives you a treeview which you can add extra properties later when you need them.
James
James Simpson
Web Developer
imebgo@hotmail.com
P S - This is what part of the alphabet would look like if Q and R were eliminated Mitch Hedberg
|
|
|
|
|
yeah, that's the solution i was trying to avoid, the TreeViewNoHScroll control. anyway maybe like you suggest it's the best way, and does have the plus of being the place to put in any other mods to TreeView.
Any way to deal with the downsides i perceive:
-- another file in the project
-- registering the control with the toolbox (which sometimes forgets which of my controls are registered anyway)
-- is it possible that TreeView will ever be changed and break my code.
Thanks in advance!
".. and Toto too."
(reassurance by Glenda, the good witch of the North)
|
|
|
|
|
I'm working on my own XmlSerializer/deserializer class, and while developing the deserializer, I've noticed that Type.GetType("System.Drawing.Color") is returning null instead of a Type object. What's the reason for that? I don't see an explanation in the documentation, and I can do Type.GetType("System.Double") fine, so it's not an issue with ValueType objects... Perhaps it's an issue with structs for some other reason?
Thanks,
Arun
|
|
|
|
|
It expects the FULLY QUALIFIED NAME (iow assembly name, ver , etc, public key).
Rather use typeof(Color) or recursive thru the loaded assemblies.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Ah, okay, that must be it, thanks! System.Drawing.Color is not in my assembly or mscorlib.dll, it's in System.Drawing.dll.
I guess I'll iterate over loaded assemblies and see if they have the type I'm looking for.
|
|
|
|