Пример #1
0
        ////////////////////////////////////////////////////////////////////////////
        // Function: SetImageInfo --
        // Author: TWAIN Working Group
        // Input:
        // Output: none
        // Comments:
        //
        public twainDefs.TwRC SetImageLayout(short topWhole, short topFrac, short leftWhole, short leftFrac, short rightWhole, short rightFrac, short bottomWhole, short bottomFrac)
        {
            twainDefs.TwRC          rc            = 0;
            twainDefs.TwImageLayout twImageLayout = new twainDefs.TwImageLayout();

            // Check ImageInfo information
            //rc = CallDSMEntry(appID, dsID, DG_IMAGE, DAT_IMAGELAYOUT, MSG_GET, (TW_MEMREF) twImageLayout);

            rc = DSMImageLayout(appid, srcds, twainDefs.TwDG.Image, twainDefs.TwDAT.ImageLayout, twainDefs.TwMSG.Get, twImageLayout);

            switch (rc)
            {
            case twainDefs.TwRC.Success:
                twImageLayout.Frame.Left.Whole   = leftWhole;
                twImageLayout.Frame.Left.Frac    = (ushort)(leftFrac / 100.0 * 65536);
                twImageLayout.Frame.Top.Whole    = topWhole;
                twImageLayout.Frame.Top.Frac     = (ushort)(topFrac / 100.0 * 65536);
                twImageLayout.Frame.Right.Whole  = rightWhole;
                twImageLayout.Frame.Right.Frac   = (ushort)(rightFrac / 100.0 * 65536);
                twImageLayout.Frame.Bottom.Whole = bottomWhole;
                twImageLayout.Frame.Bottom.Frac  = (ushort)(bottomFrac / 100.0 * 65536);

                //rc = CallDSMEntry(&appID, &dsID, DG_IMAGE, DAT_IMAGELAYOUT, MSG_SET, (TW_MEMREF) & twImageLayout);
                rc = DSMImageLayout(appid, srcds, twainDefs.TwDG.Image, twainDefs.TwDAT.ImageLayout, twainDefs.TwMSG.Set, twImageLayout);
                twainDefs.TwStatus dsmstat1 = new twainDefs.TwStatus();
                rc = DSMstatus(appid, srcds, twainDefs.TwDG.Control, twainDefs.TwDAT.Status, twainDefs.TwMSG.Get, dsmstat1);
                break;

            case twainDefs.TwRC.Failure:
                twainDefs.TwStatus dsmstat = new twainDefs.TwStatus();
                rc = DSMstatus(appid, srcds, twainDefs.TwDG.Control, twainDefs.TwDAT.Status, twainDefs.TwMSG.Get, dsmstat);
                break;

            default: break;
            }

            return(rc);
        }
Пример #2
0
 private static extern twainDefs.TwRC DSMImageLayout([In, Out] twainDefs.TwIdentity origin, [In, Out] twainDefs.TwIdentity dest, twainDefs.TwDG dg, twainDefs.TwDAT dat, twainDefs.TwMSG msg, [In, Out] twainDefs.TwImageLayout idds);