Hi, I am trying to write a function that will scroll the "image" content of
a form upwards. My Questions:
1) How do I make a bitmap of the Form image.
2) How do I copy a "region" of that bitmap back to the form (that should
give the effect that the form scrolled up);
Thanks in advance. 2 1907
Hi
You can put an image control on your form ... here is a way to get the form
image
You need to use a dll function so use dll import this way
[System.Runtime. InteropServices .DllImportAttri bute("gdi32.dll ")]
private static extern bool BitBlt(
IntPtr hdcDest, // handle to destination DC
int nXDest, // x-coord of destination upper-left corner
int nYDest, // y-coord of destination upper-left corner
int nWidth, // width of destination rectangle
int nHeight, // height of destination rectangle
IntPtr hdcSrc, // handle to source DC
int nXSrc, // x-coordinate of source upper-left corner
int nYSrc, // y-coordinate of source upper-left corner
System.Int32 dwRop // raster operation code
);
/
Then you can get the form image this way
Graphics g1 = this.CreateGrap hics();
Image MyImage = new Bitmap(this.Cli entRectangle.Wi dth,
this.ClientRect angle.Height, g1);
Graphics g2 = Graphics.FromIm age(MyImage);
IntPtr dc1 = g1.GetHdc();
IntPtr dc2 = g2.GetHdc();
BitBlt(dc2, 0, 0, this.ClientRect angle.Width,
this.ClientRect angle.Height, dc1, 0, 0, 13369376);
g1.ReleaseHdc(d c1);
g2.ReleaseHdc(d c2);
MyImage.Save(@" c:\Captured.jpg ",
System.Drawing. Imaging.ImageFo rmat.Jpeg);
MessageBox.Show ("Saved");
Then you can load this image the control on your form
Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
Thanks for you reply.
But what I need to do is not save the bitmap. I want to copy the bottom
portion of it upwards (simulate that the form or image scrolled up). So,
after copying the image of the component - into memory - I need to copy it
back - from memory - onto the form selecting the bottom part of the image.
Can you help me figure out how to copy part of the content of "MyImage"
object back onto the image control.
Regards,
"Mohamoss" <mo************ @egdsc.microsof t.com> wrote in message
news:7$******** ******@cpmsftng xa10.phx.gbl... Hi You can put an image control on your form ... here is a way to get the
form image You need to use a dll function so use dll import this way [System.Runtime. InteropServices .DllImportAttri bute("gdi32.dll ")] private static extern bool BitBlt( IntPtr hdcDest, // handle to destination DC int nXDest, // x-coord of destination upper-left corner int nYDest, // y-coord of destination upper-left corner int nWidth, // width of destination rectangle int nHeight, // height of destination rectangle IntPtr hdcSrc, // handle to source DC int nXSrc, // x-coordinate of source upper-left corner int nYSrc, // y-coordinate of source upper-left corner System.Int32 dwRop // raster operation code ); / Then you can get the form image this way Graphics g1 = this.CreateGrap hics(); Image MyImage = new Bitmap(this.Cli entRectangle.Wi dth, this.ClientRect angle.Height, g1); Graphics g2 = Graphics.FromIm age(MyImage); IntPtr dc1 = g1.GetHdc(); IntPtr dc2 = g2.GetHdc(); BitBlt(dc2, 0, 0, this.ClientRect angle.Width, this.ClientRect angle.Height, dc1, 0, 0, 13369376); g1.ReleaseHdc(d c1); g2.ReleaseHdc(d c2); MyImage.Save(@" c:\Captured.jpg ", System.Drawing. Imaging.ImageFo rmat.Jpeg); MessageBox.Show ("Saved"); Then you can load this image the control on your form
Mohamed Mahfouz MEA Developer Support Center ITworx on behalf of Microsoft EMEA GTSC This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: GrantS |
last post by:
I am trying to convert the VB.Net code example povided by
http://authors.aspalliance.com/JimRoss/Articles/MaintainScrollPos.aspx
into C# (ASP.Net)without success. No errors are thrown in the VB code
provided on the website.
Once I have this example running correctly, I will need to use the
concept in a more complex project. The code I am using involves an
webform and an htc file.
The code for ScrollPos.htc (which is located in a folder...
|
by: Stephen Lamb |
last post by:
When I add several items, 4000, to a ListView and rapidly move the vertical
scroll bar from top to bottom several times with the mouse over a period of
about 20 seconds, the ListView control seems to hang on redraw. Doing a
Debug -> Break All halts the app but of course the call stack indicates that
it is in non-user code. This happen in Debug and Release builds and in and
outside the debugger.
I'm using .NET 1.1
WinXP SP 2
|
by: Rob Webster |
last post by:
Hi,
is there a way using JavaScript to tell a textarea to scroll to the end of
it's contents? I'm implementing something that looks like messenger using
web forms, after each post the chat area gets updated but I have to manually
scroll it down to the end.
Rob
|
by: Jonathan |
last post by:
I'm trying to build a scrollable div with "up" and "down" buttons to
replicate the action of a scroll bar. The reason I'm not just using
"overflow:auto" is because I want to position the scroll buttons on the
LEFT side of the box.
Don't ask why, I'm not the client ;)
Anyway, I've managed to get this working on some browsers by modifying
the scrollTop property of the div object, but it seems that this is
actually supposed to be...
|
by: Devonish |
last post by:
I have a form designed as a Continuous form which displays one record
per
line. Taking account of the header and footer and the size of the
screen, I
can display 30 records at a time. I can see other records by scrolling
up or
down with either the scroll bar on the right of the screen, or the up
and down
arrows which are above and below this scroll bar; or I can use the
scroll wheel
| |
by: Sin Jeong-hun |
last post by:
If FlowLayoutPanel's AutoScroll is set to true, there appears a scroll
bar on the right. Normally, users would expect the contents is scrolled
while they are dragging the scroll bar. Well, it does, but not when the
Windows's "Show window contents while dragging" is disabled. Almost all
the Windows' common coltrols scrolls the contents while dragging even
if that option is disabled. So, I think FlowLayoutPanel should behave
like other...
|
by: Sharon |
last post by:
I’m using the Panel control that contains a PictureBox control (for
implementing the http://www.codeproject.com/cs/miscctrl/PictureBox.asp).
The Panel is set to AutoScroll = true.
I wish to scroll the appearing vertical and horizontal scrolls bars of the
Panel to the middle of their scrolling range so the contained PictureBox will
be centered inside the Panel.
But I could not find a way to get the scrolls bars for doing that.
|
by: Paul E Collins |
last post by:
I'm writing an application whose main window consists of a particular
UserControl that I have placed inside a docked Panel so that it will
fill the whole window. The panel also has the AutoScroll property set
so that the user can scroll if the inner control is larger than the
window.
Various dialogue boxes (displayed with Form.ShowDialog(this)) are
available for setting properties, etc., and I've noticed that when a
dialogue box is...
|
by: Celeste |
last post by:
Hello,
I'm trying to parse the referring url for google search terms so that when this page loads it will scroll to and highlight the search term(s). Should i be using document.referrer?
Please take a look at my code and tell me what i'm doing wrong:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>highlight</title>
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |