How to make TSaveDialog customization dpi aware / scaleable? - delphi

Using Delphi 2010 I have customized a TSaveDialog using the resource template approach as shown in TOpenPictureDialog in Delpi's ExtDlgs.
The template approach allows me to successfully insert a form containing several controls in the system save dialog. This works fine as long as the Windows DPI setting is 96. With user defined (text) scaling or hdpi monitors the inserted form is only partly visible. This is of course due to Form.Scaled = True which causes the form plus containing controls to scale (become larger). Currently the template file ( the default as used in for example TOpenPictureDialog ) contains fixed size dialog and static text elements that define the space that will be taken up by the inserted form.
I can think of several workarounds:
No form scaling (not really a solution for hdpi monitors)
Provide different templates based on Screen.PixelsPerInch/96: 100% 125%, 150%
200% etc).
Using the IFileDialogCustomize interface, but that's not really expressive enough for what I want.
The best solution would probably be a way to resize that template (based on Screen.PixelsPerInch/ 96) in memory before it gets loaded by the dialog.
Is something like that available?

Related

TImageList/TListview: correct design choice?

This is a question about picking the right Delphi components.
Using Delphi for a new app.
I'm looking to allow my user to have a list of (his own, on harddisk) pictures (just jpg for now, but should support different formats in the future), import them into my app, and then display them to him in a TListView. I was planning to tie that TListView to a TImageList (since this comes out of the box)... but when I tried, I ran into a set of weird problems about importing jpg's into a TImageList, reported here:
TImagelist not adding bitmap
So I'm wondering, am I using components for something they aren't intended for? Specifically, is the TImageList (even with some pre-formatting on import) useful for this kind of freestyle-all-sizes-and-formats-allowed stuff?
Any advice appreciated!
TImageList is designed to contain images of stored with the same format and size. If I am understanding correctly, TImageList doesn't do what you ask for.
TListView is tied to TImageList and therefore has the same limits. In my experience, a component flexible as you ask requires a custom component and manual drawing.
If you could change the requirement and decide a fixed size, you can preprocess the images making a thumbnail of the decided sizes and store them in the image list. This way you avoid building a component specific for your needs.

C# Newbie - Vector Printing of Visio Document using AxVisioViewer ActiveX control

I am using VS2013Express to create a windows form based application which will display and eventually print Visio documents, rather than relying on the browser based Visio Viewer. Needless to say this is a very specific requirement, so really don't need anyone telling me to use the MS Visio Viewer!
So far, I can open the Visio document, display it using the AxVisioViewer.dll control. I can even print... to a degree.
The issue is that I can only print currently using a PrintFromScreen method which basically captures the image of the form as displayed on screen and creates a Raster BitMap of it.
I copy the BitMap image to a hidden panel on the form (to remove toolbars etc), then print the contents of the panel. Simple (ish)!
Here's a link to the page I used to create the panel and print the image.
What I want to be able to do is resize (Vector not Raster to retain scale) and centre the image as required to ensure the document prints properly.
You'll want to center the drawing in the control.
Check the following link.
https://msdn.microsoft.com/en-us/vba/visio-vba/articles/viewer-zoomtorect-method-visio-viewer
You may also check the zoom and pan methods.

Delphi Firemonkey Scale for High DPI Windows

I thought scaling an application in FireMonkey should be easy as it is supposed to work an a Retina-Mac too. It seems there is some background magic which chooses another style than, but this doesn't seem to be the case in Windows.
In VCL there was TForm.Scaled which does the job (more or less).
For FireMonkey I found this Article by Embarcadero but it seems Embarcadero is not quite sure if this approach is useful as in XE5 the sampleproject "ControlsDemo" doesn't contain the scale-trackbar anymore. It also requires to have a root-TLayout present in all forms for which the scale factor can be set. I don't have such a element in my forms (and I'm afraid to add one as I cannot be sure if I run in another firemonkey bug than).
So how do I account for different DPI-Settings using FireMonkey?
Edit: I tried hacking TPlatFormWin and set CurrentScreenScale to 2 but it didn't work: I got black toolbars, but no scaling, but at least it used the HighRes alternative from the provided TImage.MultiResBitmap.
If anyone reads this... my experience with Windows desktop Firemonkey is that you have to take care of OS DPI setting manually and it's OK to put your controls in a top container (a TLayout) that's Scale is set according to the OS screen DPI settings (determined with some low level code).
However there are cases when you need to reverse this scaling - for example a Viewport3D must be scaled back 1/X to correctly show inside the scaled up container. Otherwise pixel level artifacts will show, image quality will be awful.
This scale up/scale back technique works nicely.
U can do something like this to change the root TLayout:
with 100 being the default
if windowsscale>0 then begin
LayoutScale.height:=ClientHeight*100/windowsscale;
LayoutScale.Width :=Clientwidth*100/windowsscale;
LayoutScale.Scale.X:=windowsscale/100;
LayoutScale.Scale.Y:=windowsscale/100;
end;

Customising Product Specification in Rails

I work for a window manufacturing company and would like to add the functionality within the website for customers to be able to customise a product online with a visual representation when adding parts to the order.
So my question really is when parts are selected is it possible to build an SVG image via ajax or maybe Raphael?
The parts would be:
width
height
color
glass type
grid on outside of glass and so on
thanks in advace
I would do it with carefully crafted images. You can easily grow / shrink an image, hide/display an image, and overlay them (keep transparency) all with javascript on the client.
I would not do it with AJAX, instead I'd just load all the images and display, hide or overlay as needed (assuming the number of options are within reason).

Looking for a simple graphical component for Delphi

I am looking for a graphical component in Delphi winch have such features:
allows to paint text in different font types, sizes and colors
allows to select previously drawn text and copy it
paints images on a given coords, gif support would be nice
its very fast in terms of CPU usage
I need this component as a main chat window. I don't want to use it as a text editor.
I've tried two solutions so far:
TVirtualStringTree
THtml
Currently I am using THtml. It performs quite nice but it is a bit to slow due to two facts:
It supports many features which are not necessary in my case
Each time I want to add some content to it, I must reload the whole content
I really don't want to go into its sources and modify them until I have no other choice. So maybe someone of you knows some nice lightweight component which I can use instead?
Take a look at TRichView. It's derived from TCustomControl so no external dependencies. It's third party commercial component, but a very good one. Skype Win client uses it.
What about a TRichEdit? Most of the things you mention should be easiliby possible with this component.
Concering the insertion of a bitmap, see this article on Delphi 3000.
Did you consider using TWebBrowser?
At least it ticks all your boxes...

Resources