|
-
Jan 11th, 2008, 08:36 AM
#1
Thread Starter
Member
[RESOLVED] Asociate a customized scrollbar with a multiline texfield
Hello
I'm really desperate with this problem.
I'm doing a completely customized interface with visual basic and windows forms, but now, I am blocked with this problem.
As I am customizing all the interface, I also want to draw my own scrollbars in a multiline textfield, but I don't know how to do it. I have try many things, but I'm completely lost.
Does anybody know how can I do this?
I supose that I could use GDI+ to draw my own buttons over the scrollbar but this is not a acceptable solution for me. I mean, if I could draw overriding the onPaint method of the Scroll, it would be perfect, but I don't want to overpaint.
As I hadn't been able to do this, I have chose another solution. I thought: "Hey! I could draw only two buttons (two arrows) and tell the textfield something like line_up/line_down, or a method like this, but i haven't found a method that could do something similar.
This last solution it would be perfect too, but.... I don't know hoy to implement it.
As you can see (or read), I am really desperate with this problem.
I would be pleased if someone could give me a hand.
Thanks in advance
-
Jan 14th, 2008, 02:25 AM
#2
Thread Starter
Member
Re: Asociate a customized scrollbar with a multiline texfield
So, no one knows the answer?
I'll continue doing some research. If I find the answer I'll post it here, so anybody could learn how to do it....
Don't wait for me awake 
Regards
-
Jan 14th, 2008, 11:01 AM
#3
Lively Member
Re: Asociate a customized scrollbar with a multiline texfield
You can just use the SendMessage API to send scroll up / scroll down messages to the textbox foom whatever sort of custom scroll interface you would like to make.
-
Jan 14th, 2008, 11:30 AM
#4
Thread Starter
Member
Re: Asociate a customized scrollbar with a multiline texfield
I don't know what is that API, but I'll do some research about it. Thanks a lot, Nihilistic Mystic
-
Jan 14th, 2008, 12:12 PM
#5
Lively Member
Re: Asociate a customized scrollbar with a multiline texfield
Here is an example I put together, try it out.
vb.net Code:
'API Definition, Constants and Enum
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Shared Function SendMessage( _
ByVal hWnd As IntPtr, _
ByVal Msg As UInteger, _
ByVal wParam As IntPtr, _
ByVal lParam As IntPtr) As IntPtr
End Function
Const WM_VSCROLL As UInteger = &H115
Const WM_HSCROLL As UInteger = &H114
Enum ScrollBarCommands
SB_LINEUP = 0
SB_LINELEFT = 0
SB_LINEDOWN = 1
SB_LINERIGHT = 1
SB_PAGEUP = 2
SB_PAGELEFT = 2
SB_PAGEDOWN = 3
SB_PAGERIGHT = 3
SB_THUMBPOSITION = 4
SB_THUMBTRACK = 5
SB_TOP = 6
SB_LEFT = 6
SB_BOTTOM = 7
SB_RIGHT = 7
End Enum
'Usage Examples
'Scroll TextBox1 Down
SendMessage(TextBox1.Handle, WM_VSCROLL, ScrollBarCommands.SB_LINEDOWN, IntPtr.Zero)
'Scroll Textbox1 Up
SendMessage(TextBox1.Handle, WM_VSCROLL, ScrollBarCommands.SB_LINEUP, IntPtr.Zero)
-
Jan 14th, 2008, 12:36 PM
#6
Thread Starter
Member
Re: Asociate a customized scrollbar with a multiline texfield
Thanks again, Nihilistic Mystic. Here, at my home, I don't have Visual Studio, so I'll try tomorrow at work.
-
Jan 23rd, 2008, 06:29 AM
#7
Thread Starter
Member
Re: Asociate a customized scrollbar with a multiline texfield
Wow!! I have tried at last the code that Nihilistic Mystic gave me, and it has worked perfectly.
Thanks again for your answer, Nihilistic Mystic
-
Jan 23rd, 2008, 10:27 AM
#8
Lively Member
Re: [RESOLVED] Asociate a customized scrollbar with a multiline texfield
You are very welcome, glad I could help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|