Simple GUI questions

J

James

I'm making a very simple slideshow application. The issue I'm facing now is
the application (by design) has no menus or max/min/close icons. It's
basically just a rectangle as far as the end user is concerned.

Now, because the standard windows toolbar is suppressed, there's no way to
"move" the window. What I'd like to be able to do is have a transparent
control over my viewable area, so the user can drag anywhere that's visible
and drop it wherever. I have a feeling I'm dramatically over-complicating
this, so alternative solutions would be very much welcomed.

Anyway, are there built in events for handling this functionality, or do I
need to get into MouseDown/MouseUp logic? That could get ugly in a hurry
I'd imagine.

Also, what type of controls support transparency? I set the background
color of a Panel to Transparent, but that just made it the form's background
color. I need true transparency, which I imagine means I'm going to
override whatever method handles background painting?

Thanks in advance!
 
J

James

I want the entire form to be clickable/draggable...not just a specific part.
And I need it to involve no additional gui elements (visually). So I think
I'm stuck with a transparent control that goes over the entire viewable
area.
 
O

Oliver Sturm

Hello James,
I want the entire form to be clickable/draggable...not just a specific
part. And I need it to involve no additional gui elements (visually).

Well, that's the easy part of that sample program then :) You just have
to remove a lot of the code from the WndProc method, so that it looks like
this:

protected override void WndProc(ref Message m) {
base.WndProc(ref m);

if (m.Msg == 0x0084 /* WM_NCHITTEST */) {
if (m.Result == (IntPtr) HitTest.HTCLIENT) {
m.Result = (IntPtr) HitTest.HTCAPTION;
}
}
}

And of course you can remove all the code everywhere else that deals with
the handling of the "sensitive" rectangles on the sample form.

Thinking about it... instead of removing code from my sample, you could
also just create a new form in your own project and add the method above -
that should do it. Oh, and copy over the HitTest enum from my sample. That
should really be all you need


Oliver Sturm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top