Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / March 2006

Tip: Looking for answers? Try searching our database.

Scrollbars

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
--Fragman-- - 13 Mar 2006 22:17 GMT
I'm trying to use the HScrollBar and VScrollBar controls, but I'm
having some problems with them...
I want them to just sit there and let the user drag them, so I can
retrieve the thumb position and handle everything else in my code.
Furthermore, I want to control when they appear and when not.
I have two values, h.iSizeX and h.iSizeY, which represent my drawing
area, however, main form can be larger or smaller. If smaller, I want
to show scrollbar(s), if larger, I just want to resize my drawing area
panel.

Here's my current code:

scr_h.Left = toolStrip1.Width;
scr_h.Top = Height-scr_h.Height;
scr_v.Left = Width-scr_v.Width;
scr_v.Top = menuStrip1.Height;
if (h.iSizeX > Width - toolStrip1.Width)
{
    pnl_Render.Width = Width - toolStrip1.Width;
    scr_h.Visible= true;
    scr_h.Enabled = true;
    scr_h.Maximum = h.iSizeX;

}
else
{
    scr_h.Visible = false;
    pnl_Render.Width = h.iSizeX;
}
if (h.iSizeY > Height - menuStrip1.Height)
{
    pnl_Render.Height = Height - menuStrip1.Height;
    scr_v.Visible = true;
    scr_v.Enabled = true;
    scr_v.Maximum = h.iSizeY;

}
else
{
    scr_v.Visible = false;
    pnl_Render.Height = h.iSizeY;
}

Problems with it:
-Right now only the VScrollbar shows up when intended, but I can't see
why.
-The Width on VScrollbar and the Height on HScrollbar values seem to be
wrong, since the VScrollbar appears too far on the right and only half
of it is shown on the right side of the window. I can already notice
that when in designer.

Any ideas on how to get that working?
--Fragman-- - 13 Mar 2006 22:41 GMT
Just to make sure, I did debug this and the ifs etc are working
properly and the values get assigned correctly, yet the HScrollbar
doesn't show up.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.