473,545 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do you draw a border around a scrollable control

I have a scrollable control I'm working on.
Some parts of the painting I want to always be in the same position
like my border. But when I hit the scroll bars my border moves. I
dont't understand why. Here's an example:

public class ListTable : System.Windows. Forms.Scrollabl eControl
{
public ListTable()
{
SetStyle(Contro lStyles.ResizeR edraw, true);
SetStyle(Contro lStyles.Optimiz edDoubleBuffer, true);
SetStyle(Contro lStyles.UserPai nt, true);
SetStyle(Contro lStyles.AllPain tingInWmPaint, true);

AutoScrollMinSi ze = new Size( 300, 300 );
}

protected override void OnPaint(PaintEv entArgs e)
{
base.OnPaint(e) ;

//Draw Border
e.Graphics.Draw Rectangle(Pens. Gray, 0,0, DisplayRectangl e.Width-1,
DisplayRectangl e.Height-1);
}
}

I thought this would keep the border in the same place since I am not
doing and translating and because the width/height of DisplayRectangl e
never change.
But when I click on the scroll buttons my border moves around.
Why is this? What should I do? I do want some parts to scroll, just
not everything.
Jul 21 '05 #1
0 1450

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1932
by: Florida Draw | last post by:
------=_NextPart_000_0012_1D5428A2.65C196F8 Content-Type: text/plain Content-Transfer-Encoding: 8bit Sign-up for the FREE Holiday Giveaway Draw You must register to be eligible for the draw. Fill out this form to register and you may be eligible for our monthly draw.
6
3313
by: Rolf Brauser | last post by:
Hello, is it possible to draw a one pixel line around every cell in a table? with "border: 1px solid; " just the outer tableborder ist concerned ? thanks for any help rolf
1
2582
by: Patrick Blackman | last post by:
I would like to have a panel control which has the ability to have different color borders, any idea how to accomplish this. Thanks
0
1803
by: John R. | last post by:
I want to add a textbox next to each item in a Listbox on a Windows Form. The items need to be scrollable so I thought that maybe this is possible with an Owner Draw listbox. Searching the web and newsgroups I don't find an example anywhere how I could add a textbox or other control to an Owner Draw listbox. Can someone show me how I'd...
3
4231
by: Richard | last post by:
I have a requirement to put a GDI style circle or rectangle border around the selected row of a datagrid/ It will overlap into the row above and below the selected row. Doing this in a the OnPaint of a subclassed DataGridTextBoxColum dos not seem like a practical way to do it. I have subclassed a DataGrid and overridden the OnPaint as...
0
315
by: Phill | last post by:
I have a scrollable control I'm working on. Some parts of the painting I want to always be in the same position like my border. But when I hit the scroll bars my border moves. I dont't understand why. Here's an example: public class ListTable : System.Windows.Forms.ScrollableControl { public ListTable() {...
7
10684
by: Mark Ingram | last post by:
Hi, how can i draw a rounded rectange, with a border within a specified area? i.e. if i have a Rectangle with width and height of 100, how can i draw a rectange with 2 pixel border inside of the original one? (the current attempts all draw the border just outside of the original rectangle). At the moment im using the following code, but...
8
12086
by: UJ | last post by:
I have a table with multiple cells and I want to draw a box around the entire table but not around the individual cells. How do I do that? TIA - Jeff.
8
2178
by: Mel | last post by:
I need to draw a red frame around the element under current pointer. I have seen it done in debuggers, but need to have it in my application, without the need to download and install applications. Any help is appreciated
0
7420
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7934
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7446
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7778
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6003
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5349
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4966
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3476
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1908
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.