|
Hello,
I enabled autoscroll on my tabpage.
Is there a way for me to be notified when the tabpage is scrolled? Which event should I be watching out for?
Also, I am using an animated cursor. It works fine everywhere on my form except when I am over the autoscroll scrollbars of my tabpage. Is there a way for me to change that?
Thanx a lot
-Flack
|
|
|
|
|
The scrollbar is a different control so the cursor you set on your control won't be used for the scrollbar.
To know when scrolling occures, extend TabPage with your own control (you can still add these to a TabControl ) and override WndProc like so:
private const int WM_HSCROLL = 0x0114;
private const int WM_VSCROLL = 0x0115;
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == WM_HSCROLL) OnHScroll();
else if (m.Msg == WM_VSCROLL) OnVScroll();
}
protected virtual void OnHScroll()
{
}
protected virtual void OnVScroll()
{
} If you want, add a couple of events that the On* methods fire, and use the Message.WParam and Message.LParam fields to get the relative or absolute positions (which would be handy to pass as EventArgs -derivatives to the event handlers).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanx for the help
Is it possible for me to access the autoscrollbar whenit appears and set its cursor to the one I want?
-Flack
|
|
|
|
|
It's not the "autoscrollbar". It's a normal scroll bar. "Auto" implies a particular behavior. Like any other control, you can encapsulate it and in the .NET 2.0 Framework they will do a better job handling scroll bars. For now, you have to handle all the notification messages using WndProc of the parent control (or using an IMessageFilter for the application, but that can seriously degrade performance if you're not careful). When the mouse moves over the scroll bar control, you can P/Invoke SendMessage to send the WM_SETCURSOR message to the scroll bar. Experience with Windows programming with messages will be very helpful.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Right, I have enabled windows styles on my control. It's taken a bit of time, and it's slightly complicated, but it works.
However, the effects are problematic from the nature of the control, and I can't think of a better way to do it.
Firstly, my control is composed of a number of sub pannels used for mouse over events to detect move and resize actions. This means that for each of those panels I have to run the drawTheme method on their individual device context. And this causes flickering.
I've enabled double buffering, but it's not helping. So i assume that each panel is drawing it's element to the screen.
Is it a speed problem? And is there a way about this?
Secondly.
I have enabled transparency in my theme, but i still can't view the components underneath the corners where the transparency goes straight through to the background image. So i get the corners that are kind of... X-Ray.
Cheers
Cata
Note: the problem with displaying it all came down to the clipping rectangle. If i use anything other than a null pointer, i get nothing.
|
|
|
|
|
The Catalyst wrote:
I've enabled double buffering, but it's not helping. So i assume that each panel is drawing it's element to the screen.
Enabling double buffering isn't enough. You actually have to implement it yourself. Override the Paint event, create an additional Bitmap object to paint to (i.e.; off screen) and then when you are done use the Graphics object to draw your off-screen Bitmap object.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi Nick.
Thanks, but i don't think that's the problem. YOu see my control has 8 panels that are each drawn seperately. I can't draw the bitmap all at once, because each component has a different device context. And this is what is causing the flickering.
Additionaly, i'm drawing using the GDI drawTheme methods. It's drawn straight to screen.
However, If I create a device context on a new, hidden bitmap, and then set the new bitmap to the background image, while enabling transparency on the other components.
Not sure if that's a viable solution.
Any other ideas?
Cata
|
|
|
|
|
i see applications and even Longhorn using more and more of what i would call images with a "washed out" effect (not sure what the real term is for this effect) - like the girl with the video camera in this screen shot from Longhorn. How do you load a "normal" image into a picture box for example, and give it this "washed effect"?
http://www.zolknetwork.com/contentimages/longhorn/screenshots/3683/mypictures.jpg
Thanks!!!
|
|
|
|
|
I'm guessing here, but if you put an image on a white back ground, and set it's transparency level, then you should get the washed out effect.
Cata
|
|
|
|
|
|
that is very helpful - thanks Nick!
|
|
|
|
|
How exactly would i be able to send data to the parallel port with in XP using C#.
Thanks Zane
|
|
|
|
|
You can't do it directly because of the NT Kernel Hardware Abstraction Layer. You need a helper .DLL, running in Ring 0, to get at the port for you and expose an interface you can use. Check out the stuff at Logix4U[^].
RageInTheMachine9532
|
|
|
|
|
Dear zaarzzz
I think that you have to use windows API to do that so you have refeare to CreateFile, API then you can deal with parallel port as a file where you can write and read data
Regards
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
Hi,
I have been searching for weeks for a way to put a progress-bar or other custom control on the Office CommandBar of my Outlook addin. Does anyone know how to do this?
Please refer me to any resources available...
Thanks,
Shmarya
|
|
|
|
|
Hiya, how do I write double quotes to a file?? So in the file, it writes "today is fine". I tried this:
sw.Write( ""today is fine"" );
But it like it.
|
|
|
|
|
sw.Write( @"""today is fine""" );
Mazy
"I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
|
|
|
|
|
|
Also, as with most other languages, use \" . Only use "" within a literal string (i.e., prefixed with the literal string character, @ ).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I have noticed that when I put code in, lets say a Button click event that when I click it once it will execute the code acouple of times in that click event. Any ideas what might cause that to happen?
Thanks,
JJ
|
|
|
|
|
MrJJKoolJ wrote:
Any ideas what might cause that to happen?
You've register the event handler two times.
Mazy
"I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
|
|
|
|
|
Probably because the handler function has been added to the Click event a couple of times.
Go into the 'Windows Form Designer generated code' section and look for something like the bolded line added more than once. It might not be the very next line or lines. It could be farther down the code. But, in the end, you would normally only want one EventHandler created for the Click event of the button.
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
this.button1.Location = new System.Drawing.Point(16, 16);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(144, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Output Debug Break";
this.button1.Click += new System.EventHandler(this.button1_Click);
this.button1.Click += new System.EventHandler(this.button1_Click);
this.button1.Click += new System.EventHandler(this.button1_Click);
.
. more code...
.
this.button1.Click += new System.EventHandler(this.button1_Click);
RageInTheMachine9532
|
|
|
|
|
Did you register for the event multiple times?
|
|
|
|
|
I use two radiobuttons and a "continue" button. after pressing the "continue" button i need that there won't be a way to change anymore the radios.
please help!
|
|
|
|
|
radioButton1.Enabled = false;
RageInTheMachine9532
|
|
|
|