View previous topic :: View next topic |
Author |
Message |
ideage
Joined: 12 Jul 2006 Posts: 63 Location: china
|
Posted: Tue Dec 09, 2008 12:57 am Post subject: Panel don't catch onMouseWheel EVENT! |
|
|
When I use Panel ContainerControl,It don't trigger Panel 's onMouseWheel Event,but Form's mouse Event.
but click even correct.
please help me! Thanks!
Code: |
/*
Generated by Entice Designer
Entice Designer written by Christopher E. Miller
www.dprogramming.com/entice.php
*/
import dfl.all;
import std.gc;
import std.stdio;
class PreView: dfl.form.Form
{
// Do not modify or move this block of variables.
//~Entice Designer variables begin here.
dfl.panel.Panel panel1;
dfl.button.Button btPrint;
dfl.button.Button btZI;
dfl.button.Button btZO;
dfl.button.Button btClose;
dfl.button.Button btPrior;
dfl.button.Button btNext;
dfl.button.Button btOpen;
dfl.panel.Panel plFill;
dfl.picturebox.PictureBox pic;
//~Entice Designer variables end here.
this()
{
initializePreView();
pic.sizeMode = PictureBoxSizeMode.AUTO_SIZE;
//@ Other PreView initialization code here.
plFill.scrollSize = Size(800, 600);
plFill.vScroll = true;
plFill.hScroll = true;
//btOpen.click ~= &file_open_click;
plFill.click ~= &file_open_click;
plFill.mouseWheel ~= &pic_mouseWheel;
}
final void doOpen()
{
OpenFileDialog ofd;
ofd = new typeof(ofd);
ofd.title = "Open Image";
//ofd.filter = "Bitmap Files (*.bmp)|*.bmp|All Files|*.*";
ofd.filter = "All Image Files|*.bmp;*.ico;*.gif;*.jpg;*.jpeg|Bitmap Files|*.bmp|Icon Files|*.ico|JPEG Files|*.jpg;*.jpeg|All Files|*.*";
if(DialogResult.OK == ofd.showDialog())
{
//pic.image = new Bitmap(ofd.fileName);
pic.image = new Picture(ofd.fileName);
plFill.scrollSize = Size(pic.right, pic.bottom);
std.gc.fullCollect(); // Clean up old resources.
}
}
private void file_open_click(Object sender, EventArgs ea)
{
doOpen();
}
private void pic_mouseWheel(Object sender, MouseEventArgs mea)
{
//scroll pic.
//plFill.onMouseWheel(mea);
writefln("wheel!");
}
private void initializePreView()
{
// Do not manually modify this function.
//~Entice Designer 0.8.5.02 code begins here.
//~DFL Form
text = "PicView";
clientSize = dfl.all.Size(792, 494);
//~DFL dfl.panel.Panel=panel1
panel1 = new dfl.panel.Panel();
panel1.name = "panel1";
panel1.dock = dfl.all.DockStyle.TOP;
panel1.bounds = dfl.all.Rect(0, 0, 792, 32);
panel1.parent = this;
//~DFL dfl.button.Button=btOpen
btOpen = new dfl.button.Button();
btOpen.name = "btOpen";
btOpen.text = "Open";
btOpen.bounds = dfl.all.Rect(496, 8, 75, 23);
btOpen.parent = panel1;
//~DFL dfl.panel.Panel=plFill
plFill = new dfl.panel.Panel();
plFill.name = "plFill";
plFill.backColor = dfl.all.SystemColors.appWorkspace;
plFill.dock = dfl.all.DockStyle.FILL;
plFill.borderStyle = dfl.all.BorderStyle.FIXED_3D;
plFill.bounds = dfl.all.Rect(0, 32, 792, 462);
plFill.parent = this;
//~DFL dfl.picturebox.PictureBox=pic
pic = new dfl.picturebox.PictureBox();
pic.name = "pic";
pic.bounds = dfl.all.Rect(16, 24, 488, 360);
pic.parent = plFill;
//~Entice Designer 0.8.5.02 code ends here.
}
}
int main()
{
int result = 0;
try
{
Application.enableVisualStyles();
//@ Other application initialization code here.
Application.run(new PreView());
}
catch(Object o)
{
msgBox(o.toString(), "Fatal Error", MsgBoxButtons.OK, MsgBoxIcon.ERROR);
result = 1;
}
return result;
}
|
________
jailbroken
Last edited by ideage on Wed Feb 02, 2011 5:09 pm; edited 1 time in total |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Fri Jan 09, 2009 8:06 pm Post subject: Re: Panel don't catch onMouseWheel EVENT! |
|
|
Sorry about the delay, but there's a perfectly reasonable explanation! The control with focus gets the wheel events. This got it working for me:
load ~= &form_load; // in ctor
// in class:
void form_load(Object sender, EventArgs ea)
{
plFill.focus();
} |
|
Back to top |
|
|
ideage
Joined: 12 Jul 2006 Posts: 63 Location: china
|
Posted: Mon Jan 12, 2009 6:48 am Post subject: |
|
|
Thanks! it' OK.
________
vaporizer shop |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|