Bug with controls location and scrollbars in a Windows Form

Hi,

I've noticed a bug with WinForm and scrollbars, and I would like to
know if there is a workaround ...

Bug description :
------------------------
1) create a win form, and add 3 buttons :
             * FirstButton      : upper left corner of the winform
             * SecondButton : location = (0 ; 600)
             * ThirdButton     : location = (100, 600)

2) Set : ThirdButton.Visible = false

3) Set the Form size to 100 x 100 ... and set : AutoScroll = true

4) Add the following event handler to the Click event of FirstButton
and SecondButton ...

    private void OnButton_Click(object sender, EventArgs e)
    {
      this.ThirdButton.Visible = true;
    }

Now is the trick :
- if you click on FirstButton ... the ThirdButton will be displayed to
its right location

- if you scroll to SecondButton and click on it, ThirdButton is
displayed to a wrong location (offset added)


Does anybody know how to solve this issue?
Thanks in advance
0
Tophe
3/12/2010 3:45:30 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

1 Replies
711 Views

Similar Articles

[PageSpeed] 36

Tophe wrote:
> [...]
> Now is the trick :
> - if you click on FirstButton ... the ThirdButton will be displayed to
> its right location
> 
> - if you scroll to SecondButton and click on it, ThirdButton is
> displayed to a wrong location (offset added)
> 
> 
> Does anybody know how to solve this issue?

Sure.  You have to take the AutoScrollPosition into account when setting 
the button's location.  It's "by design".

Alternatively, put all three button instances in a Panel instance that 
is itself a child of the Form.  Then the Panel is what scrolls and the 
Button instances are all relative to the Panel, unscrolled.

Pete
0
Peter
3/12/2010 4:58:45 PM
Reply:

Similar Artilces:

Windows Live Calendar 12-22-09
I went to http://calendar.live.com and imported some .ics files into my Windows Live Calendar from my old Windows Calendar from VISTA using the "Subscribe" feature. Everything seemed to work fine. However, when I then opened my Windows Live Mail program, everything there worked fine, EXCEPT when I clicked to open the Calendar portion, the entire program crashes. Does it everytime. What's going on and how can I fix it. -- Ed65 Are the imported calendars viewable at calendar.live.com and the data intact ? Are you using the same Live ID(that was used at calend...

control charts #2
Might some direct me to some good examples of control charts and or directions for creating. I have been asked to get up to speed on them and this is somehting new for me. Thanks Jon Peltier has information on creating them in EXCEL, http://www.peltiertech.com/Excel/Charts/statscharts.html I'd suggest you do some reading on control charts from other sites. There should be something here that could help you. http://www.isixsigma.com/st/control_charts/ "Todd F." wrote: > Might some direct me to some good examples of control charts and or > directions for creatin...

faxing form
Is there a way to fax the form page via the fax modem on my computer? Create a report based on your form then fax the resulting report. Take a look at http://support.microsoft.com/Default.aspx?kbid=231797 hopefully it is what you are looking for. -- Hope this helps, Daniel Pineault If this post was helpful, please rate it by using the vote buttons. "He cries for help" wrote: > Is there a way to fax the form page via the fax modem on my computer? "He cries for help" <Hecriesforhelp@discussions.microsoft.com> wrote in message news:252D07EA-5886-4B0C-99...

Checkbox event to control other checkbox selections
I have been working for a couple of hours now trying different ways to solve this problem and I'm out of ideas (or tired). :-/ Here's what I'm trying to do: On a form I have a section with six checkboxes that represent 6 different mailing lists an organization can subscribe to: MailList01, MailList02, etc. I have a seventh checkbox named MailListOmit for orgs that want to opt out of mailings. If MailListOmit is checked, when the user attempts to click any one of the MailList checkboxes, I want to return a dialog box that says, "This organization has chosen to not receive ma...

reference to master form
Hello there I have master form and inside there is subform. If an event procedure uccur on subform, how can i get refence to the master form in order to change there things when the name of the master form is diffrent always? Roy Look in Access HELP for the "Parent." property. Your code will look something like: Me.Parent.... from within the subform. -- Regards Jeff Boyce www.InformationFutures.net Microsoft Office/Access MVP http://mvp.support.microsoft.com/ Microsoft IT Academy Program Mentor http://microsoftitacademy.com/ "Roy Goldhammer" <roy@ho...

How can I refresh the master form from a subform?
Hello. On the After Update of the subform I am trying to refresh the Master form. I have tried things like Docmd.requery and Me.Refresh, but not sure what I am doing. Can you help me with this? Thanks. Iram Iram wrote: >On the After Update of the subform I am trying to refresh the Master form. I >have tried things like Docmd.requery and Me.Refresh, but not sure what I am >doing. Try using: Parent.Requery -- Marsh MVP [MS Access] ...

Modal Form from a child form
Hi, I have a little problem, I have a MDI form (Main Menu), this form open a child form (A), and I need to open a form B as modal form from form A. I can to this with showDialog(), but it open form B outside MDI form (Main Menu) and it is showed on the windows bar as another application opened. So the question is, there are any way to open a modal form from a child form inside a MDI form? Thanks El Alquimista wrote: > Hi, I have a little problem, I have a MDI form (Main Menu), this form > open a child form (A), and I need to open a form B as modal form from > form A. I c...

Templates in alternative startup location are not recognized
I've just moved up to Office 2003 from 2000. In Excel, all the templates that I have been using from our group templates location (set as the "At startup, open all the files in" location) are not recognized. Two or three (out of 14) are listed without icons, and when you click them, the pointer changes briefly and nothing happens. They are also shown when you click the "On my computer" link, but behave the same way (i.e. do nothing) when clicked. These are prper templates (Save as, *.xlt etc), and I've even recreated one using Excel 2003 with the same effec...

Data source for PivotTable-Form in ACCESS 2000
Hi, this drives me crazy, 4 years ago I defined in an ACCESS 2000 application a "PivotTable-Form". The resulting EXCEL table inclusive the "Data refresh" works perfect. I now want to update/change the query for the "Data Source" but cannot find which query is behind the "PivotTable-Form" or behind the resulting EXCEL spreadsheet. When editing the properties for the "PivotTable-Form" or the EXCEL spreadsheet the "Data Source" is always blank. Question: Where does Access 2000 or EXCEL 2000 hide the respective data source (Query)...

80070490 Error: Windows update encountered an unknown error 03-04-10
3 security updates will not complete (now 4). Error Code 80070490 02-Mar-10 I am unable to do these three security updates: KB970238(release date 6/9/09), KB97451(release date 10/13/09), KB954155(release date 10/13/09), & KB975517(release date 10/13/09). The last succesful update was KB9937286 on 2/27/2010 I have a Compaq Presario PC: SR5214X. OS Name Microsoft® Windows Vista™ Home Basic Version 6.0.6002 Service Pack 2 Build 6002 OS Manufacturer Microsoft Corporation System Manufacturer Compaq-Presario System Model GV441AA-ABA SR5214X System Type X86-based PC ...

ActiveX control
I have a ActiveX control that I got which prints barcodes, but I am unsure exactly how to use an ActiveX control from my MFC program. I inserted it onto my may main form, created a member variable, but for some reason I am unable to get to the Value property that it is supposed to have. I have never really used an activeX control before and I was wondering if someone could tell me how to include it in my program. Roger Nevermind, I figured out how to use the SetValue property. Roger "R.H." <rogerh40@mindspring.com> wrote in message news:%23y%238fFZWDHA.2272@TK2...

limit create window/control max count?
Hi all. I am testing a create control. But I want create many control (more 10000) in dialog. I test dynamic create CButton. It's created about 9800. I want work. 1. have a two dialog.(A, B) 2. A dialog has 40 controls(Button, Spin, static). 3. B dialog has contain A dialog. A dialog is more than 200. 4. create A dialog dynamic.(Using A->Create(IDD, this)) and attach B dialog. A dialog is modaless. 5. But not create about 190. dialog create function return 0. thank for read. Have a nice day. You need to redesign your system, IMO. -- - Mark Randall http://zetech.swehli.com...

Money 2007 H & B + Windows Vista
Hello, I have read a lot about problems with installing and using Money (2007) on machines running Windows Vista. Is there some kind of "manual" how to go about the install procedure? A manual that describes where to have the program installed installed and where to keep the data? And a manual that describes how to keep the rights as an administrator as you would normally have under windows XP? And maybe there are some other issues that I haven't thought about. Thanks, Eric "Eric" <nomail@hotmail.com> wrote in message news:468fe69d$0$37724$5fc3050@dre...

Tying tables to forms
I have four connected tables that work well as table input but when I put them in a form some of the fields will not let me make entries. Does this happen because I am using the Id fields and subsequent data from the wrong tables? -- Taylor It sounds like you have created a non-updatable form. One cautionary note first: Don't tie your forms directly to the tables. Use queries instead. The queries will act as a stop light for which data is written and when. If more than one person tries to make a change to the same record at the same time, you will run into problems. From wha...

Bug with controls location and scrollbars in a Windows Form
Hi, I've noticed a bug with WinForm and scrollbars, and I would like to know if there is a workaround ... Bug description : ------------------------ 1) create a win form, and add 3 buttons : * FirstButton : upper left corner of the winform * SecondButton : location = (0 ; 600) * ThirdButton : location = (100, 600) 2) Set : ThirdButton.Visible = false 3) Set the Form size to 100 x 100 ... and set : AutoScroll = true 4) Add the following event handler to the Click event of FirstButton and SecondButton ... private vo...

Stop Buttons showing when opening up form
I have a button on my Main Start up page that when click makes these buttons visible, but when I open up my DB they automatically show on start up, is it possible they not be visible till I click ckbHelp.......Thanks for any Help.....Bob Private Sub ckbHelp_Click() If ckbHelp = True Then cmbHelpNewHorse.Visible = True cmbHelpActFinHorse.Visible = True End If If ckbHelp = False Then cmbHelpNewHorse.Visible = False cmbHelpActFinHorse.Visible = False End If End Sub Bob, In design view, set the property pf the *button* Visible=No Regards/Jacob "Bob" <xxx@xx.xx> wrote i...

Using Excel to design business forms
I have been using excel hit and miss to design business forms. I have been pretty successful but in many places I have found myself doing many inelegant things to get stuff to layout. Is there a good place to start looking to see how this is done properly, as I have seen many well done forms produced in excel. ...

Custom Controls 10-16-04
Hi, I would like to create a custom control .ascx and I'd like to konow how can I put it on a standard CRM form (for example Accounts) Thanks in advance Zsolt There is not a supported way to do this on the standard forms themselves. The closest supported method wuld be to add a new Tab on the left of the page via teh ISV.Confi and have that display your control. Matt Parks MVP - Microsoft CRM ---------------------------------------- ---------------------------------------- On Sat, 16 Oct 2004 01:19:06 -0700, Zsolt Z�mbik <zombikzs@titanium-consulting.net> wrote: Hi, I would ...

Cannot view any form in crm 3.0
We have just installed CRM 3.0 on MS server 2003. I have created an account which has a system administrator role assigned to it. The issue is that when I open CRM web (on the server) when I select account, contact, activities, calendar etc... I get the following error: An error has occured. For more information, contact your system administrator. Now if I open CRM web using an account which has restricted access mode ticked, I don't get any errors, everything opens fine. The problem is that with an restricted access code i can't do much. I have tried assigning different roles ...

List all row source for all forms, reports etc.
Hi I'm doing some work cleaning out old unused forms, reports and queries. I have been going through each report in a database (There are A LOT), determining its row source query, then marking it for deletion. I will eventually end up going through and deleting all the unused queries. As you can imagine this is time consuming, and I was thinkg 'there must be a FASTER way" Does anyone have a suggestion, or link to a pre-built function or model that could assist me? Regards Darragh On Thu, 17 Jan 2008 22:14:18 -0800 (PST), Darragh <darragh.murray@gmail.com> wrote: >Hi...

Pasting Formulas bug?
I seem to be having a strange problem with my Excel (11.2.5) for Mac. I have pasted formulas for years and never had an issue...until now. The formulas are simple (addition, subtraction, etc.). I copy the formula in a cell and paste it to a new one (I even do this with Paste Special...Formula). What appears in the spreadsheet is the value of the original cell, not the result of the "relative" formula -- even though the formula bar displays the correct "relative" formula. I can only get the correct value in the new cell if I go into the formula bar and press return at the...

Calling a checkbox control with VB
Hi Is there a way I can reference a checkbox item that I can manipulate in VBA. For instance... I have a series of check boxes that I would like to change the properties of with a loop So my checkboxes are called: CheckBox1 CheckBox2 CheckBox3 etc and I want to be able to reference them like so: For i = 1 to 20 "CheckBox" & i.Value = true next i Any ideas? By the format of the name, I assume that they are control toolbox checkboxes. Dim oOLE As Object For Each oOLE In ActiveSheet.OLEObjects If TypeName(oOLE.Object) = "CheckBox" Then ...

Minimizing form
Hi How can I minimize the current form? Thanks Regards DoCmd.Minimize in a command button code or other event. -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "John" <John@nospam.infovis.co.uk> wrote in message news:uBcRcE73HHA.3600@TK2MSFTNGP02.phx.gbl... > Hi > > > > How can I minimize the current form? > > > > Thanks > > > > Regards > > ...

Wrap to Window
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) In draft view, I'd like the text to wrap to the window size rather than the document's margins. Is this feature part of Word for Mac? It's easily done in the PC version. Thanks, Robin Hi Robin - Word> Preferences> View - check the box for Wrap text to window. HTH |:>) Bob Jones [MVP] Office:Mac On 4/12/08 10:20 AM, in article ee98414.-1@webcrossing.caR9absDaxw, "Robin@officeformac.com" <Robin@officeformac.com> wrote: > Version: 2008 > Operating System: Mac OS X 10.5 (Leopard) > &g...

close all windows
is there any way to get access to close all the open windows usingVBA, without having to define all the open windows. many thanks michael Dim frm as FormFor each frm in Forms Docmd.Closenext frmOn Mar 20, 10:15 am, Wayne-I-M <Wayn...@discussions.microsoft.com>wrote:> DoCmd.Quit>> --> Wayne> Manchester, England.>>>> "michael goodall" wrote:> > is there any way to get access to close all the open windows using> > VBA, without having to define all the open windows. many thanks michael- Hide quoted text ->> - Show quoted text -...