c# pdf viewer open source : How to move pages in pdf reader control SDK platform web page wpf html web browser World%20of%20Warcraft%20Programming%20(2nd%20Edition)46-part1845

Chapter 22
Creating Scroll Frames 419
Now the frame can also be adjusted via the sliders, using the
SetValue()
method, as in the following commands:
/run ScrollFrameTest_HSlider:SetValue(50)
/run ScrollFrameTest_VSlider:SetValue(50)
Creating Faux Scroll Frames
Afaux scroll frame is a bit more complex to make because it must be tailored
to the specific need. For example, you typically create a template and then a
series of entries tomake a single page. This section shows you how to create a
line of icons onscreen that can be scrolled through in order to display all valid
macro icons for selection. The API functions used here are the following:
GetNumMacroIcons()
—Returns the number of available macro icons.
GetMacroIconInfo(index)
—Returns the texture for the selected macro
index.
This addon displays six icons side by side, and the slider is used to scroll
between the available icons. Begin by creating an addon skeleton called
MacroIconTest
,and putting the following into
MacroIconTest.toc
:
## Interface: 30300
## Title: MacroIconTest
## Notes: Test addon for a faux scroll frame
MacroIconTest.lua
MacroIconTest.xml
Create
MacroIconTest.xml
with the following contents:
<Ui xmlns=“http://www.blizzard.com/wow/ui/“
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance“
xsi:schemaLocation=“http://www.blizzard.com/wow/ui/
http://wowprogramming.com/FrameXML/UI.xsd“>
<Button name=“MacroIconTest_IconTemplate“ virtual=“true“>
<Size x=“32“ y=“32“/>
<NormalTexture name=“$parentIcon“ setAllPoints=“true“/>
<HighlightTexture alphaMode=“ADD“
file=“Interface\Buttons\ButtonHilight-Square“/>
</Button>
</Ui>
This simpleXMLtemplateisused tocreate each of theicon slots. Itdefines a
defaulttexture, aswellas a highlighttexturetogivea bitmore visual feedback.
Insert the following XML before the
</Ui>
tag to create a set of icons:
<Frame name=“MacroIconTest“>
<Size x=“192“ y=“32“/>
<Anchors>
How to move pages in pdf reader - re-order PDF pages in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Support Customizing Page Order of PDF Document in C# Project
how to reorder pages in pdf preview; how to move pages around in pdf file
How to move pages in pdf reader - VB.NET PDF Page Move Library: re-order PDF pages in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Sort PDF Document Pages Using VB.NET Demo Code
reorder pages of pdf; change page order pdf acrobat
420
Part III
Advanced Addon Techniques
<Anchor point=“CENTER“/>
</Anchors>
<Frames>
<Button name=“$parentIcon1“ inherits=“MacroIconTest_IconTemplate“>
<Anchors>
<Anchor point=“TOPLEFT“/>
</Anchors>
</Button>
<Button name=“$parentIcon2“ inherits=“MacroIconTest_IconTemplate“>
<Anchors>
<Anchor point=“TOPLEFT“ relativePoint=“TOPRIGHT“ i
relativeTo=“$parentIcon1“/>
</Anchors>
</Button>
<Button name=“$parentIcon3“ inherits=“MacroIconTest_IconTemplate“>
<Anchors>
<Anchor point=“TOPLEFT“ relativePoint=“TOPRIGHT“ i
relativeTo=“$parentIcon2“/>
</Anchors>
</Button>
<Button name=“$parentIcon4“ inherits=“MacroIconTest_IconTemplate“>
<Anchors>
<Anchor point=“TOPLEFT“ relativePoint=“TOPRIGHT“ i
relativeTo=“$parentIcon3“/>
</Anchors>
</Button>
<Button name=“$parentIcon5“ inherits=“MacroIconTest_IconTemplate“>
<Anchors>
<Anchor point=“TOPLEFT“ relativePoint=“TOPRIGHT“ i
relativeTo=“$parentIcon4“/>
</Anchors>
</Button>
<Button name=“$parentIcon6“ inherits=“MacroIconTest_IconTemplate“>
<Anchors>
<Anchor point=“TOPLEFT“ relativePoint=“TOPRIGHT“ i
relativeTo=“$parentIcon5“/>
</Anchors>
</Button>
</Frames>
</Frame>
If you jump into the game at this point, you’ll have an invisible set of boxes
that can be moused over (the highlight texture will still show) but that don’t
actually display anything. Jump to
MacroIconTest.lua
and add the following
function:
function MacroIconTest_UpdateIcons(startIcon)
local name = “MacroIconTestIcon“
for i=1,6 do
local texture = GetMacroIconInfo(startIcon + (i - 1))
C# TIFF: How to Reorder, Rearrange & Sort TIFF Pages Using C# Code
Using this C#.NET Tiff image management library, you can easily change and move the position of any two or more Tiff file pages or make a totally new order for
move pages in pdf reader; pdf change page order acrobat
C# Word - Sort Word Pages Order in C#.NET
page reorganizing library control, developers can swap or adjust the order of all or several Word document pages, or just C# DLLs: Move Word Page Position.
change page order in pdf file; how to rearrange pdf pages online
Chapter 22
Creating Scroll Frames 421
local button = getglobal(name .. i)
button:SetNormalTexture(texture)
end
end
This function accepts a single argument, namely the index of the icon
that should be displayed first. It then loops through the six different icon
buttons andchanges their texture accordingly. The loop assumes the first icon
is numbered 1, because the
GetMacroIconInfo()
function makes the same
assumption.
TIP
Not all data is available immediately within the game client. For example,
the number of icons and the texture information abouteach macro icon isn’t
available until after the clienthas been partially initialized. Generally, this
information is available after the PLAYER_LOGIN event, which is fired just before
the client begins displaying the 3-Dworld. Some functions may need to be delayed
until after this event to work properly.
Add the following behavior scripts to the
MacroIconTest
frame by putting
the following section immediately after its
</Frames>
tag:
<Scripts>
<OnLoad>
self:RegisterEvent(“PLAYER_LOGIN“)
</OnLoad>
<OnEvent>
if event == “PLAYER_LOGIN“ then
GetNumMacroIcons()
MacroIconTest_UpdateIcons(1)
end
</OnEvent>
</Scripts>
Here you register for the
PLAYER_LOGIN
event, and when that event
fires, the
OnEvent
script calls
GetNumMacroIcons()
, and then calls the
MacroIconTest_UpdateIcons()
function to update the icon display. When
guild banks were introduced, the macro icon system was changed so icon
information isn’t available until the
GetNumMacroIcons()
function has been
called at least once, hence the call here. Load the game client, and you should
see something like that shown in Figure 22-6 in the center of your screen.
Figure 22-6: MacroIconTest frame
C# PowerPoint - Sort PowerPoint Pages Order in C#.NET
library control, developers can swap or adjust the order of all or several PowerPoint document pages, or just change the C# DLLs: Move PowerPoint Page Position.
how to move pages in pdf; how to reorder pdf pages in reader
C# PDF File & Page Process Library SDK for C#.net, ASP.NET, MVC
Barcoding. XImage.Barcode Reader. XImage.Barcode Generator. Others. RasterEdge XDoc.PDF allows you to easily move PDF document pages position, including
reorder pages in pdf online; how to move pages within a pdf document
422
Part III
Advanced Addon Techniques
Test the update function by running some of the following macros:
/run MacroIconTest_UpdateIcons(15)
/run MacroIconTest_UpdateIcons(180)
/run MacroIconTest_UpdateIcons(-1)
Notice that in the last example, rather than an error the first two icons are
shown as blank.
Adding Scroll Bars
As in the previous example, a slider can be used to scroll through the list of
icons. Add the following to your
MacroIconTest.xml
file after the
</Frame>
tag fromthe main frame:
<Slider name=“MacroIconTest_HSlider“ orientation=“HORIZONTAL“>
<Size y=“25“/>
<Anchors>
<Anchor point=“TOPLEFT“ relativePoint=“BOTTOMLEFT“ i
relativeTo=“MacroIconTest“/>
<Anchor point=“TOPRIGHT“ relativePoint=“BOTTOMRIGHT“
relativeTo=“MacroIconTest“/>
</Anchors>
<Backdrop edgeFile=“Interface\Buttons\UI-SliderBar-Border“
bgFile=“Interface\Buttons\UI-SliderBar-Background“ tile=“true“>
<EdgeSize>
<AbsValue val=“8“/>
</EdgeSize>
<TileSize>
<AbsValue val=“8“/>
</TileSize>
<BackgroundInsets>
<AbsInset left=“3“ right=“3“ top=“6“ bottom=“6“/>
</BackgroundInsets>
</Backdrop>
<ThumbTexture name=“$parentThumbTexture“
file=“Interface\Buttons\UI-ScrollBar-Knob“>
<Size x=“25“ y=“25“/>
</ThumbTexture>
</Slider>
This creates a slider bar with a backdrop and border to make it look a bit
more like a scroll bar. Add the scripts section to the slider by putting the
following after the
</Backdrop>
tag and before the definition of the thumb
texture:
<Scripts>
<OnLoad>
local max = GetNumMacroIcons()
C# PDF insert text Library: insert text into PDF content in C#.net
to PDF in preview without adobe reader installed in int pageIndex = 0; // Move cursor to (400F outputFilePath = Program.RootPath + "\\" output.pdf"; doc.Save
move pages in pdf; reorder pdf pages
VB.NET PDF insert text library: insert text into PDF content in vb
PDF in preview without adobe reader component installed. Dim pageIndex As Integer = 0 ' Move cursor to String = Program.RootPath + "\\" output.pdf" doc.Save
pdf reverse page order online; how to change page order in pdf document
Chapter 22
Creating Scroll Frames 423
self:SetMinMaxValues(1, max - 5)
self:SetValueStep(1.0)
self:SetValue(1)
</OnLoad>
<OnValueChanged>
MacroIconTest_UpdateIcons(value)
</OnValueChanged>
</Scripts>
The resulting addon is shown in Figure 22-7, including the scroll bar with
border and background.
Figure 22-7: MacroIconTest addon showing various macro icons
Scrolling with the Mouse Wheel
As an extra method of scrolling the icons, you can add support for scrolling
with the mouse wheel. This involves setting an
OnMouseWheel
script. Add the
following to the
<Scripts>
section ofthe
MacroIconTest
frame (not the slider):
<OnMouseWheel>
MacroIconTest_OnMouseWheel(self, delta)
</OnMouseWheel>
Then add this function to
MacroIconTest.lua
:
function MacroIconTest_OnMouseWheel(self, delta)
local current = MacroIconTest_HSlider:GetValue()
if (delta < 0) and (current < GetNumMacroIcons()) then
MacroIconTest_HSlider:SetValue(current + 1)
elseif (delta > 0) and (current > 1) then
MacroIconTest_HSlider:SetValue(current - 1)
end
end
This function definition just piggybacks onto the slider bar’s min and max
values to ensure it doesn’t go outside those boundaries. You should now be
able to scroll the frame using both the sliderand the mouse wheel.
Problems with Slider Precision
You may notice that if you scroll using slash commands or the mouse wheel,
youcan scroll through theicons one-by-one. If youtry to use the sliderinstead,
C# PDF Image Extract Library: Select, copy, paste PDF images in C#
Get image information, such as its location, zonal information, metadata, and so on. Able to edit, add, delete, move, and output PDF document image.
how to move pages within a pdf document; how to rearrange pages in a pdf document
VB.NET PDF Library SDK to view, edit, convert, process PDF file
Rapidly and multiple PDF document (pages) creation and edit methods file formats; merge, append, and split PDF files; insert, delete, move, rotate, copy
how to rearrange pages in a pdf reader; how to move pages in pdf files
424
Part III
Advanced Addon Techniques
you can’t really tell how many icons are scrolling on each step. That’s because
there are more than a thousand icons to be displayed, and the slider widget
only has so much precision when working with the mouse.
You could fix this by changing the step value for the slider. In this case,
change itto3,sothesliderwillmoveinstepsof3. Unfortunately,ifyouchange
the precision of the slider, the mouse wheel can no longer scroll icon-by-icon.
You may never run into this issue, but here’s the change you would make to
allow this (altered lines are highlighted):
<OnLoad>
local max = GetNumMacroIcons()
self:SetMinMaxValues(1, max - 5)
self:SetValueStep(3.0)
self:SetValue(1)
</OnLoad>
Summary
Avisual scroll frame is a smooth, pixel-by-pixel scroll frame that can be used
to display contents that are too large for the parent window. Scroll frames of
this nature are used in the default user interface in the Quest Log, and within
the edit box in the macro window.
Afaux scroll frame uses a set number of frames to display a list of rows
or columns by changing offsets using the scroll bar. These scroll frames don’t
change visually when you scroll through them; rather, they redraw the rows
with differentinformation. These pseudoscroll framesare usedin the Auction
House, Friends list, and several other places in the default user interface.
The Code
ScrollFrameTest
ScrollFrameTest.toc
## Interface: 30300
## Title: ScrollFrameTest
## Notes: Test addon for scroll frames
ScrollFrameTest.xml
ScrollFrameTest.lua
ScrollFrameTest.xml
<Ui xmlns=“http://www.blizzard.com/wow/ui/“
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance“
xsi:schemaLocation=“http://www.blizzard.com/wow/ui/
Chapter 22
Creating Scroll Frames 425
http://wowprogramming.com/FrameXML/UI.xsd“>
<ScrollFrame name=“ScrollFrameTest“>
<Size x=“150“ y=“150“/>
<Anchors>
<Anchor point=“CENTER“/>
</Anchors>
<Layers>
<Layer level=“BACKGROUND“>
<Texture setAllPoints=“true“>
<Color r=“0.0“ g=“0.0“ b=“0.0“/>
</Texture>
</Layer>
</Layers>
<Frames>
<Slider name=“ScrollFrameTest_HSlider“
i
orientation=“HORIZONTAL“
minValue=“0“ maxValue=“100“ defaultValue=“0“ valueStep=“1“>
<Size x=“150“ y=“25“/>
<Anchors>
<Anchor point=“TOP“ relativePoint=“BOTTOM“ “ i
relativeTo=“ScrollFrameTest“/>
</Anchors>
<Scripts>
<OnValueChanged>
ScrollFrameTest:SetHorizontalScroll(-1 * i
self:GetValue())
</OnValueChanged>
</Scripts>
<ThumbTexture name=“$parentThumbTexture“
file=“Interface\Buttons\UI-ScrollBar-Knob“>
<Size x=“25“ y=“25“/>
</ThumbTexture>
</Slider>
<Slider name=“ScrollFrameTest_VSlider“ orientation=“VERTICAL“
minValue=“0“ maxValue=“100“ defaultValue=“0“ valueStep=“1“>
<Size x=“25“ y=“150“/>
<Anchors>
<Anchor point=“LEFT“ relativePoint=“RIGHT“ “ i
relativeTo=“ScrollFrameTest“/>
</Anchors>
<Scripts>
<OnValueChanged>
ScrollFrameTest:SetVerticalScroll(self:GetValue())
</OnValueChanged>
</Scripts>
<ThumbTexture name=“$parentThumbTexture“
file=“Interface\Buttons\UI-ScrollBar-Knob“>
<Size x=“25“ y=“25“/>
</ThumbTexture>
</Slider>
426
Part III
Advanced Addon Techniques
</Frames>
<ScrollChild>
<Frame>
<Size x=“250“ y=“250“/>
<Layers>
<Layer level=“ARTWORK“>
<Texture i
file=“Interface\Icons\Spell_Shadow_DemonicFortitude“>
<Size x=“100“ y=“100“/>
<Anchors>
<Anchor point=“CENTER“/>
</Anchors>
</Texture>
</Layer>
</Layers>
</Frame>
</ScrollChild>
</ScrollFrame>
</Ui>
MacroIconTest
MacroIconTest.toc
## Interface: 30200
## Title: MacroIconTest
## Notes: Test addon for a faux scroll frame
MacroIconTest.lua
MacroIconTest.xml
MacroIconTest.lua
function MacroIconTest_UpdateIcons(startIcon)
local name = “MacroIconTestIcon“
for i=1,6 do
local texture = GetMacroIconInfo(startIcon + (i - 1))
local button = getglobal(name .. i)
button:SetNormalTexture(texture)
end
end
function MacroIconTest_OnMouseWheel(self, delta)
local current = MacroIconTest_HSlider:GetValue()
if (delta < 0) and (current < GetNumMacroIcons()) then
MacroIconTest_HSlider:SetValue(current + 1)
elseif (delta > 0) and (current > 1) then
MacroIconTest_HSlider:SetValue(current - 1)
end
end
Chapter 22
Creating Scroll Frames 427
MacroIconTest.xml
<Ui xmlns=“http://www.blizzard.com/wow/ui/“
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance“
xsi:schemaLocation=“http://www.blizzard.com/wow/ui/
http://wowprogramming.com/FrameXML/UI.xsd“>
<Button name=“MacroIconTest_IconTemplate“ virtual=“true“>
<Size x=“32“ y=“32“/>
<NormalTexture name=“$parentIcon“ setAllPoints=“true“/>
<HighlightTexture alphaMode=“ADD“ i
file=“Interface\Buttons\ButtonHilight-Square“/>
</Button>
<Frame name=“MacroIconTest“>
<Size x=“192“ y=“32“/>
<Anchors>
<Anchor point=“CENTER“/>
</Anchors>
<Frames>
<Button name=“$parentIcon1“ i
inherits=“MacroIconTest_IconTemplate“>
<Anchors>
<Anchor point=“TOPLEFT“/>
</Anchors>
</Button>
<Button name=“$parentIcon2“ i
inherits=“MacroIconTest_IconTemplate“>
<Anchors>
<Anchor point=“TOPLEFT“ relativePoint=“TOPRIGHT“ “ i
relativeTo=“$parentIcon1“/>
</Anchors>
</Button>
<Button name=“$parentIcon3“
inherits=“MacroIconTest_IconTemplate“>
<Anchors>
<Anchor point=“TOPLEFT“ relativePoint=“TOPRIGHT“ “ i
relativeTo=“$parentIcon2“/>
</Anchors>
</Button>
<Button name=“$parentIcon4“ i
inherits=“MacroIconTest_IconTemplate“>
<Anchors>
<Anchor point=“TOPLEFT“ relativePoint=“TOPRIGHT“ “ i
relativeTo=“$parentIcon3“/>
</Anchors>
</Button>
<Button name=“$parentIcon5“
i
inherits=“MacroIconTest_IconTemplate“>
<Anchors>
<Anchor point=“TOPLEFT“ relativePoint=“TOPRIGHT“ “ i
relativeTo=“$parentIcon4“/>
428
Part III
Advanced Addon Techniques
</Anchors>
</Button>
<Button name=“$parentIcon6“ “ i
inherits=“MacroIconTest_IconTemplate“>
<Anchors>
<Anchor point=“TOPLEFT“ relativePoint=“TOPRIGHT“ “ i
relativeTo=“$parentIcon5“/>
</Anchors>
</Button>
</Frames>
<Scripts>
<OnLoad>
self:RegisterEvent(“PLAYER_LOGIN“)
</OnLoad>
<OnEvent>
if event == “PLAYER_LOGIN“ then
GetNumMacroIcons()
MacroIconTest_UpdateIcons(1)
end
</OnEvent>
<OnMouseWheel>
MacroIconTest_OnMouseWheel(self, delta)
</OnMouseWheel>
</Scripts>
</Frame>
<Slider name=“MacroIconTest_HSlider“ orientation=“HORIZONTAL“>
<Size y=“25“/>
<Anchors>
<Anchor point=“TOPLEFT“ relativePoint=“BOTTOMLEFT“ i
relativeTo=“MacroIconTest“/>
<Anchor point=“TOPRIGHT“ relativePoint=“BOTTOMRIGHT“ “ i
relativeTo=“MacroIconTest“/>
</Anchors>
<Backdrop edgeFile=“Interface\Buttons\UI-SliderBar-Border“
bgFile=“Interface\Buttons\UI-SliderBar-Background“
tile=“true“>
<EdgeSize>
<AbsValue val=“8“/>
</EdgeSize>
<TileSize>
<AbsValue val=“8“/>
</TileSize>
<BackgroundInsets>
<AbsInset left=“3“ right=“3“ top=“6“ bottom=“6“/>
</BackgroundInsets>
</Backdrop>
<Scripts>
<OnLoad>
local max = GetNumMacroIcons()
self:SetMinMaxValues(1, max - 5)
Documents you may be interested
Documents you may be interested