Build1=Default,bage.image2pdf File1=add1.png File10=close_image_up.png File11=delete1.png File12=delete2.png File13=download.png File14=edit1.png File15=edit2.png File16=filemanager.bal File17=files.png File18=files1.png File19=files2.png File2=add2.png File20=goback1.png File21=goback2.png File22=img.db File23=main.bal File24=menu.bal File25=menu1.png File26=menu2.png File27=move.png File28=next.png File29=ok1.png File3=checkbox.png File30=ok2.png File31=open1.png File32=open2.png File33=panelresult.bal File34=pdficon.png File35=radiobox1.png File36=radiobox2.png File37=reload1.png File38=reload2.png File39=remove1.png File4=clear1.png File40=remove2.png File41=removead.png File42=removead1.png File43=removead2.png File44=rename1.png File45=rename2.png File46=save1.png File47=save2.png File48=selectall1.png File49=selectall2.png File5=clear2.png File50=setting.bal File51=share1.png File52=share2.png File53=sort1.png File54=sort2.png File55=thumbnails1.png File56=thumbnails2.png File57=thumbnails3.png File58=thumbnails4.png File6=clearall1.png File7=clearall2.png File8=close.png File9=close_image_down.png FileGroup1=Default Group FileGroup10=Default Group FileGroup11=Default Group FileGroup12=Default Group FileGroup13=Default Group FileGroup14=Default Group FileGroup15=Default Group FileGroup16=Default Group FileGroup17=Default Group FileGroup18=Default Group FileGroup19=Default Group FileGroup2=Default Group FileGroup20=Default Group FileGroup21=Default Group FileGroup22=Default Group FileGroup23=Default Group FileGroup24=Default Group FileGroup25=Default Group FileGroup26=Default Group FileGroup27=Default Group FileGroup28=Default Group FileGroup29=Default Group FileGroup3=Default Group FileGroup30=Default Group FileGroup31=Default Group FileGroup32=Default Group FileGroup33=Default Group FileGroup34=Default Group FileGroup35=Default Group FileGroup36=Default Group FileGroup37=Default Group FileGroup38=Default Group FileGroup39=Default Group FileGroup4=Default Group FileGroup40=Default Group FileGroup41=Default Group FileGroup42=Default Group FileGroup43=Default Group FileGroup44=Default Group FileGroup45=Default Group FileGroup46=Default Group FileGroup47=Default Group FileGroup48=Default Group FileGroup49=Default Group FileGroup5=Default Group FileGroup50=Default Group FileGroup51=Default Group FileGroup52=Default Group FileGroup53=Default Group FileGroup54=Default Group FileGroup55=Default Group FileGroup56=Default Group FileGroup57=Default Group FileGroup58=Default Group FileGroup6=Default Group FileGroup7=Default Group FileGroup8=Default Group FileGroup9=Default Group Group=Default Group Library1=core Library10=inappbilling3 Library11=firebaseadmob Library12=imageprocessing Library13=sql Library14=runtimepermissions Library15=phone Library16=javaobject Library2=reflection Library3=stringutils Library4=gesturedetector Library5=scrollview2d Library6=mediabrowser Library7=bitmapplus Library8=pdflib Library9=dialogs ManifestCode='This code will be applied to the manifest file during compilation.~\n~'You do not need to modify it in most cases.~\n~'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136~\n~AddManifestText(~\n~~\n~)~\n~SetApplicationAttribute(android:icon, "@drawable/icon")~\n~SetApplicationAttribute(android:label, "$LABEL$")~\n~SetApplicationAttribute(android:theme, "@android:style/Theme.Holo.Light")~\n~~\n~AddPermission (android.permission.WRITE_EXTERNAL_STORAGE)~\n~SetApplicationAttribute(android:largeHeap, "true")~\n~'End of default text.~\n~~\n~'************ sdk 29 need it ************~\n~SetApplicationAttribute(android:requestLegacyExternalStorage, true)~\n~~\n~'************ FileProvider ************~\n~AddApplicationText(~\n~ ~\n~ ~\n~ ~\n~)~\n~CreateResource(xml, provider_paths,~\n~ ~\n~)~\n~~\n~'************ Google Play Services Base ************~\n~AddApplicationText(~\n~ ~\n~ ~\n~)~\n~'************ Google Play Services Base (end) ************~\n~~\n~'************ Firebase Base ************~\n~CreateResourceFromFile("google-services", "google-services.json")~\n~AddPermission(android.permission.ACCESS_NETWORK_STATE)~\n~AddPermission(android.permission.INTERNET)~\n~AddPermission(android.permission.WAKE_LOCK)~\n~AddPermission(com.google.android.c2dm.permission.RECEIVE)~\n~AddPermission(${applicationId}.permission.C2D_MESSAGE)~\n~AddManifestText( )~\n~AddApplicationText(~\n~~\n~ ~\n~ ~\n~ ~\n~ ~\n~~\n~ ~\n~ ~\n~ ~\n~ ~\n~ ~\n~ ~\n~ ~\n~~\n~ ~\n~ ~\n~ ~\n~ ~\n~ ~\n~ ~\n~ ~\n~ ~\n~ ~\n~~\n~~\n~ ~\n~ ~\n~ ~\n~ ~\n~ ~\n~)~\n~'************ Firebase Base (end) ************~\n~~\n~'************ Firebase Ads ************~\n~AddApplicationText(~\n~ ~\n~ ~\n~)~\n~'************ Firebase Ads (end) ************ Module1=ActImageViewer Module2=ActivityFileManager Module3=ActivityGallery Module4=ClsCustomGalleryPro Module5=CustomListViewEx Module6=FileProvider Module7=Starter NumberOfFiles=58 NumberOfLibraries=16 NumberOfModules=7 Version=10.2 @EndOfDesignText@ #Region Project Attributes #ApplicationLabel: Image to PDF Converter #VersionCode: 28 #VersionName: 4.7 'SupportedOrientations possible values: unspecified, landscape or portrait. #SupportedOrientations: portrait #CanInstallToExternalStorage: true #End Region #Region Activity Attributes #FullScreen: False #IncludeTitle: False '#BridgeLogger: True #End Region '#BridgeLogger:True #AdditionalJar:itextg.jar '#AdditionalJar:itext-asian.jar Sub Process_Globals Dim ReturnFromOtherActivity As Boolean Dim AdodbID As String = "" Dim AdodbIDFull As String = "" Dim manager As BillingManager3 Dim ownedProducts As Map Dim Owned_id001 As Boolean Dim TimerCloseMenu As Timer Private rp As RuntimePermissions End Sub Sub Globals Private ImgListView1 As CustomListViewEx Dim ListItemHeight As Int = 90dip Dim ImgSize As Int = 86dip Dim BtnSize As Int = 43dip Dim OutputFolder As String Dim OutputFilename As String Dim PDFThumbFolder As String Dim ResizeImage As Boolean Dim MaxWidth As Long Dim MaxHeight As Long Dim BtnRemoveImg(2) As Bitmap Private PanelTop As Panel Private PanelTopEdit As Panel Dim BtnAddDra(2) As BitmapDrawable Dim BtnSortDra(2) As BitmapDrawable Dim BtnSaveDra(2) As BitmapDrawable Dim BtnFilesDra(2) As BitmapDrawable Dim BtnClearDra(2) As BitmapDrawable Dim BtnEditDra(2) As BitmapDrawable Dim BtnOKDra(2) As BitmapDrawable Dim BtnMenuDra(2) As BitmapDrawable Dim BtnIAPDra(2) As BitmapDrawable Dim ButtonAddImgSLD As StateListDrawable Dim ButtonSortSLD As StateListDrawable Dim ButtonSaveSLD As StateListDrawable 'Dim ButtonFilesSLD As StateListDrawable Dim ButtonClearSLD As StateListDrawable Dim ButtonEditSLD As StateListDrawable Dim ButtonOKSLD As StateListDrawable Dim ButtonMenuSLD As StateListDrawable Dim ButtonIAPSLD As StateListDrawable Private ButtonAddImg As Button Private ButtonSort As Button Private ButtonSave As Button 'Private ButtonFiles As Button Private ButtonClear As Button Private ButtonEdit As Button Private ButtonOK As Button Private ButtonMenu As Button Private ButtonIAP As Button Dim PanelPDF As Panel Dim BtnGoBackDra(2) As BitmapDrawable Dim BtnGoBackSLD As StateListDrawable Dim BtnFilesonPanelPDFSLD As StateListDrawable Private BtnBackonPanelPDF As Button Private BtnFilesonPanelPDF As Button Private BtnOpen As Button Private BtnSendto As Button Private LabelOutput As Label Private ImageViewPDF As ImageView Private LabelPages As Label Private LabelTitle As Label Dim IndexSource As Int Dim IndexTarget As Int Dim BtnMoveImg As Bitmap Dim ImgDrag As ImageView Dim DragStart As Boolean Dim ImgDragStartPostion As Int Dim ImgDragEndPostion As Int Dim ImgDragLength As Int Dim DragMaxTop As Int Dim DragMaxBottom As Int Dim ScrollScopeTop As Int Dim ScrollScopeBottom As Int Dim ScrollSpeed As Int Dim ScrollStartPosition As Int Dim ScrollEndPosition As Int Dim ScrollLength As Int Dim DrageLength As Int Dim GD As GestureDetector Private BannerAd As AdView Private IAd As InterstitialAd Dim LastTime_IAD As Long Dim PanelSetting As Panel Private PanelSettingTop As Panel Private ButtonSettingBack As Button Dim ButtonSettinDra(2) As BitmapDrawable Dim ButtonSettinSLD As StateListDrawable Private BtnSavePDF As Button Private LabelSettingTitle As Label Private RButtonNoResize As RadioButton Private RButtonResize As RadioButton Private LabelSize1 As Label Private LabelSize2 As Label Private EditTextWidth As EditText Private EditTextHeight As EditText Private LabelFrame1Title As Label Private LabelFrame2Title As Label Private LabelColor As Label Private SpinnerColor As Spinner Dim lblProgress As Label Dim pnlProgress As Panel Dim pnlProgressBkG As Panel Dim prgProgress As ProgressBar Dim IPC As ImageProcessing Private MenuBody As Panel Dim MenuWidth As Float '= 300dip Dim DelayTime As Float = 200 Private ImageViewLogo As ImageView Private ListViewExMenu As CustomListViewEx Dim MenuItemHeight As Int = 44dip Dim MenuIconSize As Int = 24dip Dim MenuPanel As Panel Private ButtonMenu As Button Private PanelTitle As Panel Private PanelBody As Panel End Sub Sub Activity_PermissionResult (Permission As String, Result As Boolean) If Permission = rp.PERMISSION_WRITE_EXTERNAL_STORAGE Then If Result = False Then 'ToastMessageShow("Please allow the permission.", True) Msgbox("Please allow the permission.", Application.LabelName) ExitApplication End If End If End Sub Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer. For example: Activity.LoadLayout("main") rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE) If File.ExternalWritable = True Then OutputFolder = File.Combine(File.DirRootExternal, "Image to PDF Converter") Else OutputFolder = File.Combine(File.DirInternal, "Image to PDF Converter") End If PDFThumbFolder =File.Combine(File.DirDefaultExternal,"PDFThumb") CheckOutputDir BtnRemoveImg(0).Initialize(File.DirAssets,"remove1.png") BtnRemoveImg(1).Initialize(File.DirAssets,"remove2.png") BtnAddDra(0).Initialize(LoadBitmap(File.DirAssets,"add1.png")) BtnAddDra(1).Initialize(LoadBitmap(File.DirAssets,"add2.png")) BtnSortDra(0).Initialize(LoadBitmap(File.DirAssets,"sort1.png")) BtnSortDra(1).Initialize(LoadBitmap(File.DirAssets,"sort2.png")) BtnSaveDra(0).Initialize(LoadBitmap(File.DirAssets,"save1.png")) BtnSaveDra(1).Initialize(LoadBitmap(File.DirAssets,"save2.png")) BtnFilesDra(0).Initialize(LoadBitmap(File.DirAssets,"files1.png")) BtnFilesDra(1).Initialize(LoadBitmap(File.DirAssets,"files2.png")) BtnClearDra(0).Initialize(LoadBitmap(File.DirAssets,"clear1.png")) BtnClearDra(1).Initialize(LoadBitmap(File.DirAssets,"clear2.png")) BtnEditDra(0).Initialize(LoadBitmap(File.DirAssets,"edit1.png")) BtnEditDra(1).Initialize(LoadBitmap(File.DirAssets,"edit2.png")) BtnOKDra(0).Initialize(LoadBitmap(File.DirAssets,"goback1.png")) BtnOKDra(1).Initialize(LoadBitmap(File.DirAssets,"goback2.png")) BtnMenuDra(0).Initialize(LoadBitmap(File.DirAssets,"menu1.png")) BtnMenuDra(1).Initialize(LoadBitmap(File.DirAssets,"menu2.png")) BtnIAPDra(0).Initialize(LoadBitmap(File.DirAssets,"removead1.png")) BtnIAPDra(1).Initialize(LoadBitmap(File.DirAssets,"removead2.png")) '----------- ButtonAddImgSLD.Initialize ButtonSortSLD.Initialize ButtonSaveSLD.Initialize ' ButtonFilesSLD.Initialize ButtonClearSLD.Initialize ButtonEditSLD.Initialize ButtonOKSLD.Initialize ButtonMenuSLD.Initialize ButtonIAPSLD.Initialize ButtonAddImgSLD.AddState(ButtonAddImgSLD.State_Pressed,BtnAddDra(1)) ButtonAddImgSLD.AddCatchAllState(BtnAddDra(0)) ButtonAddImg.Background = ButtonAddImgSLD ButtonSortSLD.AddState(ButtonSortSLD.State_Pressed,BtnSortDra(1)) ButtonSortSLD.AddCatchAllState(BtnSortDra(0)) ButtonSort.Background = ButtonSortSLD ButtonSaveSLD.AddState(ButtonSaveSLD.State_Pressed,BtnSaveDra(1)) ButtonSaveSLD.AddCatchAllState(BtnSaveDra(0)) ButtonSave.Background = ButtonSaveSLD ' ' ButtonFilesSLD.AddState(ButtonFilesSLD.State_Pressed,BtnFilesDra(1)) ' ButtonFilesSLD.AddCatchAllState(BtnFilesDra(0)) ' ButtonFiles.Background = ButtonFilesSLD ButtonClearSLD.AddState(ButtonClearSLD.State_Pressed,BtnClearDra(1)) ButtonClearSLD.AddCatchAllState(BtnClearDra(0)) ButtonClear.Background = ButtonClearSLD ButtonEditSLD.AddState(ButtonEditSLD.State_Pressed,BtnEditDra(1)) ButtonEditSLD.AddCatchAllState(BtnEditDra(0)) ButtonEdit.Background = ButtonEditSLD ButtonOKSLD.AddState(ButtonOKSLD.State_Pressed,BtnOKDra(1)) ButtonOKSLD.AddCatchAllState(BtnOKDra(0)) ButtonOK.Background = ButtonOKSLD ButtonMenuSLD.AddState(ButtonMenuSLD.State_Pressed,BtnMenuDra(1)) ButtonMenuSLD.AddCatchAllState(BtnMenuDra(0)) ButtonMenu.Background = ButtonMenuSLD ButtonIAPSLD.AddState(ButtonIAPSLD.State_Pressed,BtnIAPDra(1)) ButtonIAPSLD.AddCatchAllState(BtnIAPDra(0)) ButtonIAP.Background = ButtonIAPSLD PanelSetting.Initialize("PanelPDF") PanelSetting.LoadLayout("setting") ButtonSettinDra(0).Initialize(LoadBitmap(File.DirAssets,"goback1.png")) ButtonSettinDra(1).Initialize(LoadBitmap(File.DirAssets,"goback2.png")) ButtonSettinSLD.Initialize ButtonSettinSLD.AddState(ButtonSettinSLD.State_Pressed,ButtonSettinDra(1)) ButtonSettinSLD.AddCatchAllState(ButtonSettinDra(0)) ButtonSettingBack.Background = ButtonSettinSLD BtnSavePDF.Text = "Save PDF" LabelSettingTitle.Text = "Settings" RButtonNoResize.Text = "Don't resize image." RButtonResize.Text = "Set the size limit." LabelSize1.Text = "Max Width:" LabelSize2.Text = "Max Height:" LabelFrame1Title.Text = "Image Size" LabelFrame2Title.Text = "Color" LabelColor.Text = "Image Color:" SpinnerColor.Add("Don't change") SpinnerColor.Add("Convert to Grayscale") SpinnerColor.Add("Convert to Black & White") SpinnerColor.SelectedIndex = 0 Activity.AddView(PanelSetting,0,0,100%x,100%y) PanelSetting.BringToFront PanelSetting.Visible = False PanelPDF.Initialize("PanelPDF") PanelPDF.LoadLayout("panelresult") BtnOpen.Text = "Open PDF" BtnSendto.Text = "Send to..." LabelTitle.Text = "Done!" 'button - GoBack BtnGoBackDra(0).Initialize(LoadBitmap(File.DirAssets,"goback1.png")) BtnGoBackDra(1).Initialize(LoadBitmap(File.DirAssets,"goback2.png")) BtnGoBackSLD.Initialize BtnGoBackSLD.AddState(ButtonSettinSLD.State_Pressed,BtnGoBackDra(1)) BtnGoBackSLD.AddCatchAllState(BtnGoBackDra(0)) BtnBackonPanelPDF.Background = BtnGoBackSLD 'button - PDF File Manager BtnFilesonPanelPDFSLD.Initialize BtnFilesonPanelPDFSLD.AddState(BtnFilesonPanelPDFSLD.State_Pressed,BtnFilesDra(1)) BtnFilesonPanelPDFSLD.AddCatchAllState(BtnFilesDra(0)) BtnFilesonPanelPDF.Background = BtnFilesonPanelPDFSLD Activity.AddView(PanelPDF,0,0,100%x,100%y) PanelPDF.BringToFront PanelPDF.Visible = False Dim pnlProgressDraBKG As ColorDrawable pnlProgressDraBKG.Initialize(Colors.ARGB(150,0,0,0),0) pnlProgressBkG.Initialize("PanelNothing") pnlProgressBkG.Background = pnlProgressDraBKG Activity.AddView(pnlProgressBkG,0,0,100%x,100%y) Dim pnlProgressDra As ColorDrawable pnlProgressDra.Initialize(Colors.RGB(255,255,255),5) pnlProgress.Initialize("") pnlProgress.Background = pnlProgressDra pnlProgressBkG.AddView(pnlProgress, 30dip, (100%y - 130dip)/2, 100%x - 60dip, 130dip) lblProgress.Initialize("") lblProgress.Text = "Please wait..." lblProgress.TextSize = 14 lblProgress.Gravity = Gravity.CENTER_HORIZONTAL pnlProgress.AddView(lblProgress, 10dip, 30dip, pnlProgress.Width -20dip, 30dip) prgProgress.Initialize("") prgProgress.Progress = 0 pnlProgress.AddView(prgProgress, 20dip,lblProgress.Top + lblProgress.Height + 10dip, pnlProgress.Width-40dip, 30dip) pnlProgressBkG.Visible = False '} BtnMoveImg.Initialize(File.DirAssets,"move.png") ImgDrag.Initialize("ImgDrag") Activity.AddView(ImgDrag,0,0,100%x,ListItemHeight) ImgDrag.Visible = False '---- 'G.SetOnTouchListener(ImgListView1.AsView, "GesturesTouch") 'TouchMap.Initialize GD.SetOnGestureListener(ImgListView1.AsView, "Gesture") GD.EnableLongPress(False) DragMaxTop = ImgListView1.AsView.Top - ListItemHeight/2 DragMaxBottom = ImgListView1.AsView.Top + ImgListView1.AsView.Height - ListItemHeight/2 ScrollScopeTop = DragMaxTop + ListItemHeight/4 ScrollScopeBottom = DragMaxBottom - ListItemHeight/4 ScrollSpeed = ListItemHeight/5 ImgDrag.BringToFront MenuWidth = GetStringWidth("Download more free PDF tools", Typeface.DEFAULT,14) + 70dip MenuBody.Color = Colors.ARGB(150,0,0,0) MenuPanel.Initialize("") MenuPanel.LoadLayout("menu") MenuBody.AddView(MenuPanel, 100%x, 0, MenuWidth, 100%y) MenuPanel.Color = Colors.White ImageViewLogo.Left=0 ImageViewLogo.Top=0 ImageViewLogo.Width = MenuWidth ImageViewLogo.Height = MenuWidth*132/240 ListViewExMenu.AsView.Left = 0 ListViewExMenu.AsView.Top = ImageViewLogo.Height ListViewExMenu.AsView.Height = MenuPanel.Height-ImageViewLogo.Height ListViewExMenu.AsView.Width = MenuWidth*2 ListViewExMenu.Add(CreateMenuItem(LoadBitmap(File.DirAssets,"files.png"), "PDF file manager",MenuWidth),MenuItemHeight,"manager") ListViewExMenu.Add(CreateMenuItem(LoadBitmap(File.DirAssets,"download.png"), "Download more free PDF tools",MenuWidth),MenuItemHeight,"download") ListViewExMenu.Add(CreateMenuItem(LoadBitmap(File.DirAssets,"close.png"), "Close",MenuWidth),MenuItemHeight,"close") MenuBody.BringToFront MenuBody.Visible = False TimerCloseMenu.Initialize("TimerCloseMenu",DelayTime) TimerCloseMenu.Enabled = False '} End Sub Sub PanelNothing_Click End Sub Sub Activity_Resume If ReturnFromOtherActivity = True Then ReturnFromOtherActivity = False ShowResult End If 'Log(AdView1.IsInitialized & " - " & Owned_id001) If BannerAd.IsInitialized=True And Owned_id001=False Then BannerAd.Resume End If End Sub Sub Activity_Pause (UserClosed As Boolean) If BannerAd.IsInitialized=True Then BannerAd.Pause End If End Sub Sub Activity_KeyPress (KeyCode As Int) As Boolean Dim choice As Int Dim Result As Boolean If KeyCode=KeyCodes.KEYCODE_BACK Then If MenuBody.Visible = True Then CloseMenu Return True End If If PanelSetting.Visible = True Then If pnlProgressBkG.Visible = True Then Return True End If PanelSetting.Visible = False Return True End If If PanelPDF.Visible = True Then PanelPDF.Visible = False Return True End If If PanelTopEdit.Visible = True Then ButtonOK_Click Return True End If Result = True choice=Msgbox2("Do you want to exit?","Exit","Yes","","No",Null) Select Case choice Case DialogResponse.POSITIVE Result = False Case DialogResponse.NEGATIVE Result = True End Select End If Return Result End Sub Sub ImgListView1_ItemClick (Index As Int, Value As Object) 'Log(Index & " = " & Value) 'Log(Value) Dim pnl As Panel pnl = ImgListView1.GetPanel(Index) Dim label1 As Label Dim label2 As Label label1 = pnl.GetView(1) label2 = pnl.GetView(2) 'Log("Index: " & Index & ", fliename = " & label1.Text & " path:" & label2.Text) 'ImagePath2Show = label2.Text 'ImageName2Show = label1.Text ActImageViewer.ImageDir = label2.Text ActImageViewer.ImageFileName = label1.Text StartActivity(ActImageViewer) End Sub Sub CreateListItem(FilePath As String, FileName As String, ThumBitmp As Bitmap, DateTaken As String, InfoString As String) As Panel Dim p As Panel p.Initialize("") 'Dim bmpTemp As Bitmap 'bmpTemp=LoadBitmap(File.DirAssets,IndexText & ".png") ' bmpTemp=LoadBitmap(FilePath,FileName) ' ' ' Dim WidthBig As Boolean ' If bmpTemp.Width> bmpTemp.Height Then ' WidthBig = True ' Else ' WidthBig = False ' End If '-------- Dim img As ImageView img.Initialize("") img.Gravity=Gravity.FILL img.Bitmap = ThumBitmp Dim tmpB As Bitmap = img.Bitmap 'Log(ImgSize & ": " & tmpB.Width & " x " & tmpB.Height) Dim ImgW As Int, ImgH As Int If tmpB.Width > tmpB.Height Then ImgW = ImgSize ImgH = ImgSize * (tmpB.Height/tmpB.Width) Else ImgW = ImgSize * (tmpB.Width/tmpB.Height) ImgH = ImgSize End If Dim labelFileName As Label labelFileName.Initialize("") labelFileName.Gravity = Bit.Or(Gravity.BOTTOM, Gravity.LEFT) 'labelFileName.Text =ImgSize & " " & ImgSize & " " & (ImgSize * bmpTemp.Height/bmpTemp.Width) & IndexText labelFileName.Text = FileName labelFileName.TextSize = 14 labelFileName.TextColor = Colors.Black 'Colors.White Dim labelFilePath As Label labelFilePath.Initialize("") labelFilePath.Text = FilePath labelFilePath.Visible=False Dim labelDateTaken As Label labelDateTaken.Initialize("") labelDateTaken.Text = DateTaken labelDateTaken.Visible=False Dim lblWidth As Int lblWidth = 100%x - ImgSize - BtnSize - 20dip Dim btnMoveItem As Button btnMoveItem.Initialize("btnMoveItem") btnMoveItem.SetBackgroundImage(BtnMoveImg) Dim btnRemove As Button btnRemove.Initialize("buttonRemove") btnRemove.SetBackgroundImage(BtnRemoveImg(0)) btnRemove.Visible = False Dim lblInfo As Label lblInfo.Initialize("") lblInfo.Gravity = Bit.Or(Gravity.TOP, Gravity.LEFT) lblInfo.Text = InfoString lblInfo.TextColor = Colors.Gray lblInfo.TextSize = labelFileName.TextSize - 1 Dim labelLine As Label labelLine.Initialize("") labelLine.Color = 0xFFd9dbdc 'p.AddView(img, 2dip, 2dip, ImgSize, ImgSize) 'p.AddView(labelFileName, img.Left + img.Width + 5dip, 2dip, lblWidth, ImgSize) 'p.AddView(labelFilePath, img.Left + img.Width + 5dip, 2dip, lblWidth, ImgSize) 'p.AddView(labelDateTaken, img.Left + img.Width + 5dip, 2dip, lblWidth, ImgSize) p.AddView(img, (ListItemHeight-ImgW)/2, (ListItemHeight-ImgH)/2, ImgW, ImgH) p.AddView(labelFileName, ImgSize + 8dip, 2dip, lblWidth, ImgSize/2) p.AddView(labelFilePath, labelFileName.Left, 2dip, lblWidth, ImgSize) p.AddView(labelDateTaken, labelFileName.Left, 2dip, lblWidth, ImgSize) p.AddView(btnMoveItem, 100%x - BtnSize - 8dip, 2dip, BtnSize, ImgSize) p.AddView(btnRemove, 100%x - BtnSize - 2dip, 2dip, BtnSize, ImgSize) p.AddView(lblInfo, labelFileName.Left, ImgSize/2+2dip, lblWidth, ImgSize/2) p.AddView(labelLine, labelFileName.Left, ListItemHeight - 1dip,100%x, 1dip) labelLine.BringToFront Return p End Sub '-------------btnMoveItem Sub btnMoveItem_Down IndexSource = ImgListView1.GetItemFromView(Sender) ImgDrag.Bitmap = GetPanelItemShot(IndexSource) 'Log("IndexSource: " & IndexSource) DragStart = True ScrollStartPosition = ImgListView1.AsView.VerticalScrollPosition 'ScrollPositionFix = ScrollStartPosition End Sub Sub btnMoveItem_Click ToastMessageShow("Drag to move it",False) DragStart = False End Sub '-------------buttonRemove Sub buttonRemove_Up Dim b As Button b=Sender b.SetBackgroundImage(BtnRemoveImg(0)) End Sub Sub buttonRemove_Down Dim b As Button b=Sender b.SetBackgroundImage(BtnRemoveImg(1)) End Sub Sub buttonRemove_Click Dim index As Int index = ImgListView1.GetItemFromView(Sender) ImgListView1.RemoveAt(index) If ImgListView1.GetSize = 0 Then ButtonOK_Click End If End Sub Sub CreateScaledBitmap(Original As Bitmap, Width As Int, Height As Int) As Bitmap Dim r As Reflector Dim b As Bitmap Dim filter As Boolean: filter=True b = r.RunStaticMethod("android.graphics.Bitmap", "createScaledBitmap", Array As Object(Original, Width, Height, filter), Array As String("android.graphics.Bitmap", "java.lang.int", "java.lang.int", "java.lang.boolean")) Return b End Sub '-------------ButtonAddImg Sub ButtonAddImg_Click ReturnFromOtherActivity = True StartActivity(ActivityGallery) End Sub '-------------ButtonSort Sub ButtonSort_Click If ImgListView1.GetSize <=1 Then ToastMessageShow("Please add more images",False) Return End If Dim SortType(4) As String Dim choice As Int SortType(0)="↓ File Name (A to Z)" SortType(1)="↑ File Name (Z to A)" SortType(2)="↓ File Time" SortType(3)="↑ File Time" choice=InputList(SortType,"Sort", -1) If choice<0 Then Return ImgListView1.SortList(choice) ToastMessageShow(SortType(choice),False) End Sub '-------------ButtonSave Sub ButtonSave_Click If ImgListView1.GetSize = 0 Then ToastMessageShow("There is no image",False) Return End If PanelSetting.Visible = True End Sub '-------------ButtonFiles Sub ButtonFiles_Click StartActivity(ActivityFileManager) End Sub '-------------ButtonEdit Sub ButtonEdit_Click If ImgListView1.GetSize < 1 Then ToastMessageShow("There is no image",False) Return End If Dim i As Int Dim total As Int total = ImgListView1.GetSize For i = 0 To (total - 1) Dim pnl As Panel pnl = ImgListView1.GetPanel(i) Dim btnMove As Button Dim btnRemove As Button btnMove = pnl.GetView(4) btnRemove = pnl.GetView(5) btnMove.Visible = False btnRemove.Visible = True Next End Sub '-------------ButtonOK Sub ButtonOK_Click PanelTopEdit.Visible = False Dim i As Int Dim total As Int total = ImgListView1.GetSize For i = 0 To (total - 1) Dim pnl As Panel pnl = ImgListView1.GetPanel(i) Dim btnMove As Button Dim btnRemove As Button btnMove = pnl.GetView(4) btnRemove = pnl.GetView(5) btnMove.Visible = True btnRemove.Visible = False Next End Sub '-------------ButtonClear Sub ButtonClear_Click If ImgListView1.GetSize = 0 Then 'Msgbox("The list is empty", Application.LabelName) Return End If Dim choice As Int choice=Msgbox2("Clear the list?","Remove all items","Yes","","No",Null) Select Case choice Case DialogResponse.POSITIVE ImgListView1.Clear ButtonOK_Click 'Case DialogResponse.NEGATIVE End Select End Sub Sub ButtonIAP_Click 'Owned_id001 = True 'AdView1.RemoveView 'ButtonIAP.Visible = False 'ImgListView1.AsView.Height = 100%y - PanelTop.Height Try manager.RequestPayment("id001", "inapp", "buyapp") Catch Log(LastException.Message) End Try End Sub Public Sub ShowResult ProgressDialogShow2("Please wait...",False) If ActivityGallery.SQL1.IsInitialized Then 'Dim Location As String Dim Dir As String Dim DisplayName As String Dim DateTaken As String Dim Width As String Dim Height As String Dim Size As String Dim ThumBitmp As Bitmap Dim InfoString As String Dim FileTimeStr As String 'Dim info As typInfo Dim ID As Int Dim x As Int Dim Cursor1 As Cursor For x =0 To ActivityGallery.ListSelectedimg.Size - 1 ID = ActivityGallery.ListSelectedimg.Get(x) Cursor1 =ActivityGallery.SQL1.ExecQuery("SELECT * FROM main where ID=" & ID) If Cursor1.RowCount>0 Then Cursor1.Position = 0 'Location = Cursor1.GetString("Location") Dir = Cursor1.GetString("Dir") DisplayName = Cursor1.GetString("DisplayName") DateTaken = Cursor1.GetString("DateTaken") Width = Cursor1.GetString("Width") Height = Cursor1.GetString("Height") 'DisplayName = info.DisplayName Size = Cursor1.GetString("Size") If Size < 1048576 Then Size = NumberFormat((Size/1024),1,2) & " KB" Else Size = NumberFormat((Size/1048576),1,2) & " MB" End If Dim FileLastModified As Long = DateTaken FileTimeStr = DateTime.Date(FileLastModified) & " " & DateTime.GetHour(FileLastModified) & ":" & DateTime.GetMinute( FileLastModified) & ":" & DateTime.GetSecond( FileLastModified) If IsNumber(Width) = False Or IsNumber(Height) = False Then InfoString = Size & CRLF & FileTimeStr Else InfoString = Width & "x" & Height & " " & Size & CRLF & FileTimeStr End If Try ThumBitmp = SquareBmp(LoadBitmapSample(Dir,DisplayName,ImgSize,ImgSize),ImgSize) DoEvents If File.Exists(Dir, DisplayName) Then ImgListView1.Add(CreateListItem(Dir, DisplayName, ThumBitmp, DateTaken, InfoString), ListItemHeight, "") End If Catch Log("") End Try End If Cursor1.Close Next End If ProgressDialogHide End Sub Sub SavePDF CheckOutputDir OutputFilename = GenOutputFilename Dim i As Int Dim libPDF As PDFLib Dim TotalPage As Int Dim Resized As Boolean Dim bmpIn As Bitmap Dim bmpOut As Bitmap Dim Out As OutputStream TotalPage = ImgListView1.GetSize 'ProgressDialogShow2("Please wait...",False) prgProgress.Progress = 0 pnlProgressBkG.Visible = True libPDF.NewPDF For i = 0 To TotalPage - 1 Sleep(0) Dim pnl As Panel pnl = ImgListView1.GetPanel(i) Dim label1 As Label Dim label2 As Label label1 = pnl.GetView(1) label2 = pnl.GetView(2) 'Log("Index: " & Index & ", fliename = " & label1.Text & " path:" & label2.Text) Resized = False If File.Exists(label2.Text,label1.Text) = False Then Continue Try If ResizeImage = True Then '-----------Resize bmpIn = LoadBitmap(label2.Text,label1.Text) Log(bmpIn.Width & " x " & bmpIn.Height) If bmpIn.Width>MaxWidth Or bmpIn.Height>MaxHeight Then If bmpIn.Width/bmpIn.Height > MaxWidth/MaxHeight Then bmpOut = CreateScaledBitmap(bmpIn, MaxWidth, MaxWidth * bmpIn.Height/bmpIn.Width) Else bmpOut = CreateScaledBitmap(bmpIn, MaxHeight * bmpIn.Width/bmpIn.Height, MaxHeight) End If Select Case SpinnerColor.SelectedIndex Case 0 'nothing Case 1 'Grayscale bmpOut = IPC.GreyScale(bmpOut) Case 2 'Black & White bmpOut = IPC.BlackWhite(bmpOut) End Select '} Out = File.OpenOutput(File.DirDefaultExternal, i & ".jpg", False) bmpOut.WriteToStream(Out, 90, "JPEG") Out.Flush Out.Close Resized = True '图片被Resize了 End If End If Catch Log(LastException) End Try Try If Resized = True Then libPDF.AddImageFile(File.Combine(File.DirDefaultExternal, i & ".jpg")) Else Select Case SpinnerColor.SelectedIndex Case 0 libPDF.AddImageFile(File.Combine(label2.Text,label1.Text)) Case 1 bmpIn = LoadBitmap(label2.Text,label1.Text) bmpOut = IPC.GreyScale(bmpIn) Out = File.OpenOutput(File.DirDefaultExternal, i & ".jpg", False) bmpOut.WriteToStream(Out, 90, "JPEG") Out.Flush Out.Close libPDF.AddImageFile(File.Combine(File.DirDefaultExternal, i & ".jpg")) Case 2 bmpIn = LoadBitmap(label2.Text,label1.Text) bmpOut = IPC.BlackWhite(bmpIn) Out = File.OpenOutput(File.DirDefaultExternal, i & ".jpg", False) bmpOut.WriteToStream(Out, 90, "JPEG") Out.Flush Out.Close libPDF.AddImageFile(File.Combine(File.DirDefaultExternal, i & ".jpg")) End Select End If Catch Log(LastException) End Try prgProgress.Progress = ((i+1)/TotalPage) * 100 Next libPDF.SaveImgPDF(File.Combine(OutputFolder, OutputFilename)) libPDF.ClosePDF Catch Log(LastException) End Try 'If ResizeImage = True Then For i = 0 To TotalPage - 1 If File.Exists(File.DirDefaultExternal, i & ".jpg") Then File.Delete(File.DirDefaultExternal, i & ".jpg") End If Next Dim pnl0 As Panel pnl0 = ImgListView1.GetPanel(0) Dim tmpImg As ImageView tmpImg = pnl0.GetView(0) Select Case SpinnerColor.SelectedIndex Case 0 ImageViewPDF.Bitmap = tmpImg.Bitmap Case 1 'Grayscale ImageViewPDF.Bitmap = IPC.GreyScale(tmpImg.Bitmap) Case 2 'Black & White ImageViewPDF.Bitmap = IPC.BlackWhite(tmpImg.Bitmap) End Select Dim FileSize As Long Dim SizeString As String FileSize = File.Size(OutputFolder,OutputFilename) If FileSize < 1048576 Then SizeString = NumberFormat((FileSize/1024),1,2) & " KB" Else SizeString = NumberFormat((FileSize/1048576),1,2) & " MB" End If LabelOutput.Text = "Path: " & OutputFolder & "/" 'File.Combine(OutputFolder, OutputFilename) LabelPages.Text = OutputFilename & CRLF & CRLF & "Total Pages: " & TotalPage & CRLF & "File Size: " & SizeString PanelPDF.Visible = True Dim TmpBmp As Bitmap = ImageViewPDF.Bitmap Dim TmpFilename As String = File.LastModified(OutputFolder,OutputFilename) Dim Out As OutputStream Out = File.OpenOutput(PDFThumbFolder, TmpFilename & ".jpg", False) TmpBmp.WriteToStream(Out, 90, "JPEG") Out.Close pnlProgressBkG.Visible = False End Sub Sub PanelPDF_Click End Sub Sub BtnBackonPanelPDF_Click PanelPDF.Visible = False End Sub Sub BtnFilesonPanelPDF_Click BtnBackonPanelPDF_Click ButtonFiles_Click End Sub Sub BtnOpen_Click Try ' Dim intent As Intent ' intent.Initialize(intent.ACTION_VIEW, "file://" & File.Combine(OutputFolder, OutputFilename)) ' intent.SetType("application/pdf") ' 'intent.WrapAsIntentChooser("Choose Excel Viewer") ' StartActivity(intent) '------------- File.Copy(OutputFolder, OutputFilename, Starter.Provider.SharedFolder, OutputFilename) Dim in As Intent in.Initialize(in.ACTION_VIEW, "") Starter.Provider.SetFileUriAsIntentData(in, OutputFilename) in.SetType("application/pdf") StartActivity(in) Catch MsgboxAsync("There is no APP on your device can read PDF file.","Error") End Try End Sub Sub BtnSendto_click Try 'Dim share As MESShareLibrary 'share.sharebinary("file://" & File.Combine(OutputFolder, OutputFilename), "application/pdf", "Send to","") 'Dim FileToSend As String = File.Combine(OutputFolder, OutputFilename) File.Copy(OutputFolder, OutputFilename, Starter.Provider.SharedFolder, OutputFilename) Dim in As Intent in.Initialize(in.ACTION_SEND, "") in.SetType("application/pdf") in.PutExtra("android.intent.extra.STREAM", Starter.Provider.GetFileUri(OutputFilename)) in.Flags = 1 'FLAG_GRANT_READ_URI_PERMISSION StartActivity(in) Catch MsgboxAsync("There is no APP on your device can share file.","Error") End Try End Sub Sub GenOutputFilename As String Dim s1, s2 As String DateTime.DateFormat = "yyyy-MM-dd" DateTime.TimeFormat = "HHmmss" s1 = DateTime.Date(DateTime.Now) s2 = DateTime.Time(DateTime.Now) Return s1 & " " & s2 & ".pdf" End Sub Sub CheckOutputDir If File.ExternalWritable = True Then If File.Exists(File.DirRootExternal, "Image to PDF Converter")=False Then File.MakeDir(File.DirRootExternal, "Image to PDF Converter") End If Else If File.Exists(File.DirInternal, "Image to PDF Converter")=False Then File.MakeDir(File.DirInternal, "Image to PDF Converter") End If End If If File.Exists(File.DirDefaultExternal,"PDFThumb")=False Then File.MakeDir(File.DirDefaultExternal,"PDFThumb") End If 'Log(OutputFolder) End Sub Sub GetPanelItemShot(index As Int) As Bitmap Return ViewToBmp(ImgListView1.GetPanel(index)) End Sub ' Returns a screenshot of the given view Private Sub ViewToBmp(MyView As View) As Bitmap ' Thanks to Stevel05 for this code Dim bmp As Bitmap Dim c As Canvas bmp.InitializeMutable(MyView.Width, MyView.Height) c.Initialize2(bmp) Dim r1, r2 As Reflector r1.Target = MyView r2.Target = c r2.Target = r2.GetField("canvas") Dim args(1) As Object Dim types(1) As String args(0) = r2.Target types(0) = "android.graphics.Canvas" r1.RunMethod4("draw", args, types) Return c.Bitmap End Sub #Region GestureDetector Sub Gesture_onTouch(Action As Int, X As Float, Y As Float, MotionEvent As Object) As Boolean If Action = GD.ACTION_UP Then 'Log("onTouch: ACTION_UP") If DragStart = True Then 'ScrollEndPosition = ImgListView1.AsView.ScrollPosition ScrollEndPosition = ImgListView1.AsView.VerticalScrollPosition ScrollLength = ScrollEndPosition - ScrollStartPosition 'Log("ScrollLength: " & ScrollLength) ImgDragEndPostion = ImgDrag.Top ImgDrag.Visible = False ImgDragLength = ImgDragEndPostion - ImgDragStartPostion 'Log("ImgDragLength: " & ImgDragLength) DrageLength = ImgDragLength + ScrollLength 'Log("DrageLength: " & DrageLength) DragStart = False Dim SkipItem As Int SkipItem = Round(DrageLength/ListItemHeight) IndexTarget = IndexSource + SkipItem If IndexTarget > ImgListView1.GetSize-1 Then IndexTarget = ImgListView1.GetSize-1 Dim panelx As Panel panelx = ImgListView1.GetPanel(IndexSource) panelx.Visible = True '} ImgListView1.DragPanelto(IndexSource, IndexTarget) Return True End If End If If DragStart = True Then Return True Else Return False End If End Sub Sub Gesture_onDrag(deltaX As Float, deltaY As Float, MotionEvent As Object) 'Try Dim Y As Int Y = GD.getY(MotionEvent, 0) Dim ListTop As Int = ImgListView1.AsView.Top If DragStart = True Then If GD.getPointerCount(MotionEvent)=1 Then ImgDrag.Top = Y + ListTop - ListItemHeight/2 If ImgDrag.Top < DragMaxTop Then ImgDrag.Top = DragMaxTop If ImgDrag.Top > DragMaxBottom Then ImgDrag.Top = DragMaxBottom If ImgDrag.Visible = False Then ImgDrag.Visible = True ImgDragStartPostion = ImgDrag.Top Dim panelx As Panel panelx = ImgListView1.GetPanel(IndexSource) panelx.Visible = False '} End If Dim CurrentPostion As Int If ImgDrag.Top < ScrollScopeTop Then CurrentPostion = ImgListView1.AsView.VerticalScrollPosition ImgListView1.AsView.VerticalScrollPosition = CurrentPostion - ScrollSpeed ScrollLength = ScrollLength - ScrollSpeed 'Log("up " & ScrollPositionFix) End If If ImgDrag.Top > ScrollScopeBottom Then CurrentPostion = ImgListView1.AsView.VerticalScrollPosition ImgListView1.AsView.VerticalScrollPosition = CurrentPostion + ScrollSpeed ScrollLength = ScrollLength + ScrollSpeed 'Log("down " & ScrollPositionFix) End If End If End If ' Catch ' Log(LastException) ' End Try End Sub #End Region '-------------ButtonSettingBack Sub ButtonSettingBack_Click PanelSetting.Visible = False End Sub Sub RButtonNoResize_CheckedChange(Checked As Boolean) If Checked = True Then EditTextWidth.Enabled = False EditTextHeight.Enabled = False End If End Sub Sub RButtonResize_CheckedChange(Checked As Boolean) If Checked = True Then EditTextWidth.Enabled = True EditTextHeight.Enabled = True End If End Sub Sub BtnSavePDF_Click Dim MinValue As Long If RButtonResize.Checked = True Then If IsNumber(EditTextWidth.Text) = False Then ToastMessageShow("Wrong Number",False) EditTextWidth.RequestFocus Return End If MinValue = EditTextWidth.Text If MinValue <16 Then ToastMessageShow("Can't be less than 16",False) EditTextWidth.RequestFocus Return End If If IsNumber(EditTextHeight.Text) = False Then ToastMessageShow("Wrong Number",False) EditTextHeight.RequestFocus Return End If MinValue = EditTextHeight.Text If MinValue <16 Then ToastMessageShow("Can't be less than 16",False) EditTextHeight.RequestFocus Return End If MaxWidth = EditTextWidth.Text MaxHeight = EditTextHeight.Text End If ResizeImage = RButtonResize.Checked SavePDF PanelSetting.Visible = False End Sub #Region Interstitial AD Sub ShowIAD End Sub Sub IAD_AdClosed End Sub #End Region Private Sub SquareBmp(bmp As Bitmap, FixedDimension As Int) As Bitmap Private BmpPlus As BitmapPlus If bmp.Width > bmp.Height Then bmp = BmpPlus.CreateScaledBitmap(bmp, Round(FixedDimension / bmp.Height * bmp.Width), FixedDimension, True) Else bmp = BmpPlus.CreateScaledBitmap(bmp, FixedDimension, Round(FixedDimension * bmp.Height / bmp.Width), True) End If Dim BmpTop, BmpLeft As Int BmpLeft = Round((FixedDimension - bmp.Width) / 2) BmpTop = Round((FixedDimension - bmp.Height) / 2) Return BmpPlus.Crop(bmp, Abs(BmpLeft), Abs(BmpTop), FixedDimension, FixedDimension) 'Return MakeItNice(BmpPlus.Crop(bmp, Abs(BmpLeft), Abs(BmpTop), FixedDimension, FixedDimension)) End Sub #Region MenuPanel Sub OpenMenu If MenuBody.Visible = False Then MenuBody.Visible = True MenuPanel.SetLayoutAnimated(DelayTime, 100%x-MenuWidth,0,MenuWidth,MenuPanel.Height) Else End If End Sub Sub CloseMenu MenuPanel.SetLayoutAnimated(DelayTime, 100%x,0,MenuWidth,MenuPanel.Height) TimerCloseMenu.Enabled = True End Sub Sub ButtonMenu_Click OpenMenu End Sub Sub TimerCloseMenu_Tick MenuBody.Visible = False TimerCloseMenu.Enabled = False End Sub Sub MenuPanel_Click CloseMenu End Sub Sub MenuBody_Click CloseMenu End Sub Sub ListViewExMenu_ItemClick (Index As Int, Value As Object) Select Case Value Case "manager" CloseMenu ButtonFiles_Click Case "download" Dim Intent1 As Intent Intent1.Initialize(Intent1.ACTION_VIEW, "http://www.pdfarea.com") StartActivity(Intent1) Case "close" CloseMenu End Select End Sub Sub CreateMenuItem(MenuIcon As Bitmap, MenuText As String, MenuPanlWidth As Float) As Panel Dim p As Panel p.Initialize("") Dim img As ImageView img.Initialize("") img.Gravity=Gravity.FILL img.Bitmap = MenuIcon Dim tmpB As Bitmap = img.Bitmap 'Log(MenuIconSize & ": " & tmpB.Width & " x " & tmpB.Height) Dim ImgW As Int, ImgH As Int If tmpB.Width > tmpB.Height Then ImgW = MenuIconSize ImgH = MenuIconSize * (tmpB.Height/tmpB.Width) Else ImgW = MenuIconSize * (tmpB.Width/tmpB.Height) ImgH = MenuIconSize End If Dim lblWidth As Int lblWidth = MenuPanlWidth - MenuIconSize - 8dip Dim lblInfo As Label lblInfo.Initialize("") lblInfo.Gravity = Bit.Or(Gravity.CENTER_VERTICAL, Gravity.LEFT) lblInfo.Text = MenuText lblInfo.TextColor = Colors.Black lblInfo.TextSize = 14 Dim labelLine As Label labelLine.Initialize("") labelLine.Color = 0xFFd9dbdc p.AddView(img, (MenuItemHeight-ImgW)/2, (MenuItemHeight-ImgH)/2, ImgW, ImgH) p.AddView(lblInfo, MenuIconSize + 16dip, 2dip, lblWidth, MenuItemHeight-4dip) p.AddView(labelLine, 0, MenuItemHeight - 1dip, MenuPanlWidth, 1dip) labelLine.BringToFront Return p End Sub Sub GetStringWidth(Str As String, Font As Typeface, FontSize As Float) As Float Dim pnl As Panel pnl.Initialize("") Activity.AddView(pnl,0,0, 100%x, 100%y) Dim cv As Canvas cv.Initialize(pnl) Dim R As Float = cv.MeasureStringWidth(Str,Font, FontSize) pnl.RemoveView Return R End Sub #End Region