By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,529 Members | 864 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,529 IT Pros & Developers. It's quick & easy.

Centre Bitmap in another one!?

P: 24
I have a small bitmap, and I want to place it in the centre (horizontally and vertically) of another Bitmap object. (i.e. replace the pixels)

how can this be done?
Apr 21 '07 #1
Share this Question
Share on Google+
5 Replies


Frinavale
Expert Mod 5K+
P: 9,731
I have a small bitmap, and I want to place it in the centre (horizontally and vertically) of another Bitmap object. (i.e. replace the pixels)

how can this be done?
What language are you using?
Apr 21 '07 #2

P: 24
i'm using c#
Apr 21 '07 #3

Frinavale
Expert Mod 5K+
P: 9,731
i'm using c#

I'm not sure if this is possible.
You could try putting the bottom picture as a background in a <div id="bottom"> and then putting the upper picture in a <div id="top">. You could then put the <div id="top"> inside the <div id="bottom> and center the top one within it.
I don't know if this is going to work but its worth a try :)

-Frinny
Apr 23 '07 #4

Plater
Expert 5K+
P: 7,872
You said bitmap object right?

try something like this: (I am winging it so there might be typos)

Graphics g=Graphics.CreateFromImage(mybiggerbitmap);
g.DrawImageUnscaled(mysmallerbitmap, x,y);


bitmap objects have the .height and .width properties so you can do some quick math to determine what x and y will be to draw the image on top of the other.
Apr 23 '07 #5

Motoma
Expert 2.5K+
P: 3,235
Thanks for the response Plater!
Apr 23 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.