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
572 Views

Similar Articles

[PageSpeed] 32

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:

Logic Control Pol Display Config
Hi I am trying to LCPD configer pole display. When do all the steps to configer it takes over se 100 pinpad I mean pin pad goes offline. Any Help Check for Port Conflicts Look in Device Manager and see what port each has been assigned. "Ray" <Ray@discussions.microsoft.com> wrote in message news:33E61630-086B-488C-9842-035E073C228D@microsoft.com... > Hi I am trying to LCPD configer pole display. When do all the steps to > configer it takes over se 100 pinpad I mean pin pad goes offline. Any Help On Jan 22, 7:54=A0pm, Ray <R...@discussions.microsoft.com> wrot...

Details of how Filter By Form works
I'm trying to use Filter By Form in some applications for several projects, and the more I use this functionality, the more it baffles me. For instance: - When a form is displayed as FilterByForm, clicking to close the form doesn't close it - it changes it from FBF view to normal form view - Command buttons are disabled on the form when viewed as FBF - Non-search fields - for instance, a field in the form footer - are disabled, so that a value can't be assigned to those fields while FBF is in force Is there a document out there that explains just how a form in F...

namespaces and protected static members VC .NET bug?
I found bug when use namespaces in mfc application. When I wrote DECLARE_MESSAGE_MAP/BEGIN_MESSAGE_MAP in base (CDialog-derived) class A and in class B : public A (A and B in different namespaces). I narrowed this problem to simple peace of code: class A { protected: static int f; static int *p; public: A() {} ~A() {} }; int A::f = 1; int *A::p = NULL; namespace some { class A : public ::A { static int f; static int *p; public: A() {} ~A() {} }; int A::f = 2; int *A::p = &::A::f; // this line produces error } This code does not work, VC compiller said: error C2248...

CHM Control
Hi *.*! Does someone know a control with which i can control a CHM File? I want to recognize when someone click�s a button inside of a CHM File and then i want a IHTMLDocument2 to that HTML File, in which it happened. Is there a own *View Class for that purpose, like the CHtmlView? I�ve seen the Microsoft Help 2.0 Contents Control, but i haven�t found any Documentation about it yet :( Thanks for every help! Greetings -- Thomas ...

BUG? Outlook 2003 Not Responding
Hi all, I'm currently running Outlook 2003 (11.5608.5606) along with Active Sync 3.7 (Build 3083). I have the *Hide When Minimized* option set Outlook (thanks MS!) Since my upgrade, I've noticed the following behaviors: When my pocket-pc is disconnected/off: If I *minimize* Outlook, it hides itself in the system tray, and can (almost) always be restored. If I *close* Outlook closes, and can be restarted. When my pocket-pc is connected/on: If I *minimize* Outlook, it hides itself in the system tray, and can (almost) always be restored. However if I *close* Outlook Outlook minimizes ...

editing accont form
I change some fields on the account form but the form show the same as before when I add a new account. please help jonathan You have to publish the changes in the "deployment manager" on the server and restart the IIS! -- Christian support@mscrm-addons.com www.mscrm-addons.com Your company for MS-CRM ADD-ONS! GroupCalendar for MSCRM Related Documents for MSCRM WordMailMerge for MSCRM "jonathan shepherd" <jonathanshepherd@discussions.microsoft.com> schrieb im Newsbeitrag news:2A48C854-65C8-440F-BD46-A46BD244F5B2@microsoft.com... &...

Transactions By Category Report Bug (Money 2005)
All, I'm experiencing a problem that I can't seem to work around and I hope somebody can help me out. I ran the transaction by category report and selected category A. I then went to the category setup screen and moved category A into B. I then went back to the transactions by category report and this time it won't open. Instead, it acts like it's going to open, but then immediately reverts back to the report menu screen. I'm pretty sure it's doing that because the last selected category the report ran was for category A and that category doesn't exist anymore...

OL2003 Signature Bug?
I have four pop-mail accounts in a single profile. I'll call the Accounts A, B, C, and D. "A" is the default account. In OL2003, you are able to create a different signature for each account. I have created "New Message" and "Reply-to/Forward Message" signatures for two of the accounts (A and C). When creating a new message, the signature for A appears correctly by default. If I switch the "send from" account to C, the signature for C replaces the signature for A. This is expected. If instead, I switch to accounts B or D, the signature...

Is it just me - or are - windows 7 - media center - windows live mail
Some three months into Windows 7 X64 and just about reconciled to absence of NewsGroups via Outlook Express - when up jumps Windows Live Mail - evidently with capability to reach out and subscribe to NTTP Newsgroups. I surmise - there must also be a host of features (or at least - some) which also I have managed to overlook - which are part of the Media Center Software. Won't even mention the new look of Office 2007 (2010 you say?) where it takes a dullard like me - a few weeks to find the help tab.... But - getting there is said to be more important than the final ...

Graph control with input
Hi, all! Maybe some can help me to find control which shows the graph but with possibility to move points of the graph with mouse e.g, so the graph change the position of the the point and return x,y of point moved. Some links if possible on such products TIA Arkady You might want to look at www.infragistics.com and their NetAdvantage product. They sell a class called UltraWinChart which is extremely dynamic as to what you can do with it. They support both VS2003 and VS2005. "Arkady Frenkel" <arkadyf@hotmailxdotx.com> wrote in message news:u2PjWPQFGHA.2704@TK2MSFTN...

Money 2006 net worth bug
I have noticed that one of my net worth over time favorite reports refuses to load. If I watch the CPU, it appears that $ is in an infinite loop with the load bouncing back and forth between 50 and 80%. But the really amusing thing is this: during the loop if I select "custom date", change either the start or stop date (move either to a new date, or just touch one - change a date and move it back) and select the APPLY button, the load will converge. If you select the OK button, the load will not converge. I have saved a net worth report that converges and attempted to reload...

controls in groupbox
Hi how can I group a set of controls under "group box" so that when I move the groupbox to a specific location on the main dialog, all the controls will move with it. Thanks I don't think there is a way to do this with resource editor. I typically just select them all when I want to move them. There is no concept of "grouping" like in a drawing program. In this case a "group box" is just a box. Tom "msnews.microsoft.com" <kwadowkwadow@yahoo.com> wrote in message news:eE5MDpzJGHA.2864@TK2MSFTNGP10.phx.gbl... > Hi > > ho...

Customize transaction entry windows
Hello, Can transaction entry windows be customized ? Specifically I would like to change the Receivings Transaction Entry window by moving the Batch ID field up near the top before the Date field. Thanks so much, Aimee You can move fields around with Modifier. "Aimee" <Aimee@discussions.microsoft.com> wrote in message news:18ADC5EB-4B6C-4F7E-832A-700D9F3602E4@microsoft.com... > Hello, > Can transaction entry windows be customized ? > Specifically I would like to change the Receivings Transaction Entry > window > by moving the Batch ID field up near the top...

Open Sub Form
I have an Employee Form and form it I have a command button to open the subform time card. It does open it but what it does not do is add the employee # to the Time Card Table. Here is the code I use to open the sub form. Private Sub OpenTimeCard_Click() On Error GoTo Err_OpenTimeCard_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "frmTimeCard" stLinkCriteria = "[EmployeeID]=" & Me![ID] DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_OpenTimeCard_Click: Exit Sub Err_OpenTimeCard_Click: MsgBox Err.Descript...

Is this a bug or not?
I replied to an email that was archived in Outlook 2007. The 'sent' copy was placed in the archived sent folder instead of the one in my personal folders. Is this normal or a bug? Is there anyway that I configure responses to archived 'mails to be put in the current sent folder? TIA. Cheers, Guy ** Stress - the condition brought about by having to ** resist the temptation to beat the living daylights ** out of someone who richly deserves it. "Dr Teeth" wrote in message news:db8si3lpuejhnpm3luacpu2rkkaef66stt@4ax.com... > I replied to an email that was archiv...

Access 2007: bug? quick filter list is sometimes empty
Access 2007 has a great new feature which allows to easily filter by selecting different values from a drop down box on top of each column. However, sometimes the list of values simply is EMPTY in some columns. It seems that this has to do with the complexity of the underlying query. Does anyone know how to circumvent this? Or is it simply a bug? Kind regards Georg When the list of unique choices gets too big they don't show. You have some control over this office button/access options/current database/Filter lookup options (look at bottom of screen). It takes tim...

Bug in queue an activity association
When I see, for example, in my work queue, an email, and I make the following steps: 1. Open Email in New Window (from work item queue) 2. I delete email (not queue, just Email) 3. When I return to queue, even if I refresh, email is still there in my queue. 4. When I try to open email again from queue, I get error because record is not there anymore. Invistigatin further, I saw that ActivityParty and ActivityPointer tables doesn't have activityid, but queueitembase table has not deleted reference. This seems an error, and as workaround, I need to execute SQL directly (which btw is n...

Calculating percentage from eneterd values within a table/form
Within my database I have a table where I will enter the fresh weight of an object in one field and the thawed weight of the object in another field. I then wish access to calculate the percentage weight loss by : (Fresh Weight-Thawed Weight)/Fresh Weight*100 I have attempted to do this as a default value of a field during the design of a table, but as data has not been entered into the weight fields access gets confused and won't allow this. Is there a way to do this without creating a query or doing it within a form? If I have to create a query or do it within the form, is...

How to add horizontal scrollbars to ListCtrl???
How to add horizontal scrollbars to ListCtrl??? A list control adds the horizontal scrollbar automatically. If you are talking about a listbox then you need to call SetHorizontalExtent() AliR. "jklioe" <ranu2006@gmail.com> wrote in message news:1162797359.923199.13150@h48g2000cwc.googlegroups.com... > How to add horizontal scrollbars to ListCtrl??? > ...

BUGS BUGS BUGS
Dear Microsoft. I can understand programming bugs - you invent, you create, everyone makes mistakes etc etc. But how on earth can you have bugs in financial calculations? Take Finance 101 book. Replicate formulas. DON"T CHANGE THEM! I have already complained about mistakes in calculating bond yields in M2005 (has it been fixed?) where accrued interest is simply disregarded in calculations. Performance calculations in multiple currencies ARE ALL WRONG!!! here is example "buy" any asset in the account which is in a currency different to your base (say base is US$ and a...

how do i locate the cell linking to another spreadsheet
on opening spreadsheet a, i am always asked if i would like to update links. one link reference is to spreadsheet c, which i open and update regularly. the other is to spreadsheet b, which i haven't used in over a year. is there an easy way to locate the cell(s) on the tab(s) in spreadsheet a which contains the link(s)? it is likely that the update-requesting link to spreadsheet b is no longer needed, and that i could simplify my process be deleting the cell(s) and tab(s). thanks, Jack When I can't find links, I'll use Bill Manville's FindLink program: http://www....

control list
I am not able to see my control list (by mistake i have press the del button) so that i can add control in my dialog box,What option should i use to display it again. Thanks > I am not able to see my control list (by mistake i have press the del > button) so that i can add control in my dialog box,What option should i > use to display it again. In VS2005, its ToolBar under View menu or hit Ctrl+Alt+X (unless you have remapped this sequence). --- Ajay Your message is kinda confusing. Are you missing a control from your dialog box or are you missing a control from the Toolbox? Al...

How to trigger property dialog of windows ?
I wanna simulate the action that right click of a file,and then select property. So how can i programmatically to achieve this effect ? "howen" <howen@actions-semi.com> wrote in message news:%23eCiMONGGHA.552@TK2MSFTNGP10.phx.gbl... >I wanna simulate the action that right click of a file,and then select > property. > > So how can i programmatically to achieve this effect ? > > First create your menu resource and then do something like this... void CPoptestView::OnRButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here an...

_USE_MATH_DEFINES bug
There is an interesting problem with the _USE_MATH_DEFINES preprocessor symbol, which is used to get math constants defined. There are two different compilation models used for Release and Debug configurations, such that using _USE_MATH_DEFINES as it is supposed to be used in a Debug configuration compiles successfully, but using it in a Release configuration causes an undefined symbol error. For details see http://www.flounder.com/msdn_documentation_errors_and_omissions.htm#_USE_MATH_DEFINES joe Joseph M. Newcomer [MVP] email: newcomer@flounder.com Web: http://www.flounder.com MVP Tips...

Pass control name to Word
Access 2003, XP I am on a subform that opens a document in MS Word and renames it. When Word is closing, I want to save the text that was entered in Word into a memo field in Access. I don't know how to pass the control name to MS Word and then save the text to that control. I don't want to use the mainform name so that the subform can be used in multiple main forms. ***Here's the control: frmMain!fsubPub1.Form!txtPub1 ***Here's the code on the command button on the subform: Private Sub cmdOpenPub1_Click() On Error GoTo Err_cmdOpenPub1_Click ...