- HCURSOR hcursor = wxBitmapToHCURSOR
- (
- wxBitmap(image.Scale(w, h)),
- hotSpotX,
- hotSpotY
- );
+ wxImage imageSized(image); // final image of correct size
+
+ // if image is too small then place it in the center, resize it if too big
+ if ((w > image_w) && (h > image_h))
+ {
+ wxPoint offset((w - image_w)/2, (h - image_h)/2);
+ hotSpotX = hotSpotX + offset.x;
+ hotSpotY = hotSpotY + offset.y;
+
+ imageSized = image.Size(wxSize(w, h), offset);
+ }
+ else if ((w != image_w) || (h != image_h))
+ {
+ hotSpotX = int(hotSpotX * double(w) / double(image_w));
+ hotSpotY = int(hotSpotY * double(h) / double(image_h));
+
+ imageSized = image.Scale(w, h);
+ }
+
+ HCURSOR hcursor = wxBitmapToHCURSOR( wxBitmap(imageSized),
+ hotSpotX, hotSpotY );
+