Zoom Image in the PictureBox where user make selection

  • Thread starter Thread starter VinuMPillai
  • Start date Start date
V

VinuMPillai

Guest
Gurus,

I have a c# windows form application. There is a PictureBox within a Panel. An image is loaded in the PictureBox. I want the image to be zoomed the area user selects. The user will select by dragging using the left mouse button. What <g class="gr_ gr_517 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="517" id="517">i</g> did is on the mouse down event, <g class="gr_ gr_518 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="518" id="518">i</g> saved the x/y in a variable and in mouse move event <g class="gr_ gr_638 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="638" id="638">i</g> am drawing the rectangle plus <g class="gr_ gr_693 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="693" id="693">i</g> am recording the x/y of the current position in another variable. And in mouse up event, <g class="gr_ gr_972 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="972" id="972">i</g> create a rectangle of the size of the selection made. And <g class="gr_ gr_1172 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="1172" id="1172">i</g> create a bitmap using the rectangle's width and height. Then I created a graphics object using the created bitmap. Then <g class="gr_ gr_1538 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="1538" id="1538">i</g> use the DrawImage function to draw the image to the bitmap created and assigned to the PictureBox. But it always takes the x/y coordinates from 0,0.

Please help


Vinu

Continue reading...
 
Back
Top