SetRegionTopPixels Method (GdViewer)
In This Topic
Sets the vertical (Y) coordinate of the top left point, in pixels, where the highlighted region's rectangle is to be located on the displayed document. The highlighted region is specified by its unique identifier related to the document currently displayed in the GdViewer control. These regions, if present, determines the currently defined highlighted regions on the displayed document.
You can define this coordinate of the region's rectangle when adding regions using AddRegion(String,Int32,Int32,Int32,Int32,ForegroundMixMode,Int32) or AddRegionInches(String,Single,Single,Single,Single,ForegroundMixMode,Int32) methods. You can determine this coordinate of the region's rectangle using the GetRegionTopPixels method.
Syntax
Parameters
- RegionID
- A unique region identifier of the specified region. You can obtain this identifier using the GetRegionID method or when creating regions using AddRegion(String,Int32,Int32,Int32,Int32,ForegroundMixMode,Int32) or AddRegionInches(String,Single,Single,Single,Single,ForegroundMixMode,Int32) methods.
- Top
- The new value for the vertical coordinate of the top left point, in pixels, of the highlighted region's rectangle, related to the actual document.
Return Value
A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
We strongly recommend always checking this status first.
Example
How to enlarge all defined highlighted regions by setting their new positions and new sizes.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
Dim text_to_find As String = "GdPicture"
GdViewer1.RemoveAllRegions()
Dim text_found As Boolean = GdViewer1.SearchText(text_to_find, 0, True)
If GdViewer1.GetStat() = GdPictureStatus.OK Then
Dim regCount As Integer = GdViewer1.RegionCount(), regID As Integer = 0
If text_found AndAlso (regCount > 0) Then
For j As Integer = 1 To regCount
regID = GdViewer1.GetRegionID(j)
GdViewer1.SetRegionLeftPixels(regID, GdViewer1.GetRegionLeftPixels(regID) - 10)
GdViewer1.SetRegionTopPixels(regID, GdViewer1.GetRegionTopPixels(regID) - 10)
GdViewer1.SetRegionWidthPixels(regID, GdViewer1.GetRegionWidthPixels(regID) + 20)
GdViewer1.SetRegionHeightPixels(regID, GdViewer1.GetRegionHeightPixels(regID) + 20)
Next
GdViewer1.Redraw()
Else
MessageBox.Show("The given text has not been found.", "GdViewer.SetRegionTopPixels")
End If
Else
MessageBox.Show("The search process has failed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionTopPixels")
End If
Else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionTopPixels")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
string text_to_find = "GdPicture";
GdViewer1.RemoveAllRegions();
bool text_found = GdViewer1.SearchText(text_to_find, 0, true);
if (GdViewer1.GetStat() == GdPictureStatus.OK)
{
int regCount = GdViewer1.RegionCount(), regID = 0;
if (text_found && (regCount > 0))
{
for (int j = 1; j <= regCount; j++)
{
regID = GdViewer1.GetRegionID(j);
GdViewer1.SetRegionLeftPixels(regID, GdViewer1.GetRegionLeftPixels(regID) - 10);
GdViewer1.SetRegionTopPixels(regID, GdViewer1.GetRegionTopPixels(regID) - 10);
GdViewer1.SetRegionWidthPixels(regID, GdViewer1.GetRegionWidthPixels(regID) + 20);
GdViewer1.SetRegionHeightPixels(regID, GdViewer1.GetRegionHeightPixels(regID) + 20);
}
GdViewer1.Redraw();
}
else
MessageBox.Show("The given text has not been found.", "GdViewer.SetRegionTopPixels");
}
else
MessageBox.Show("The search process has failed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionTopPixels");
}
else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionTopPixels");
Example
How to enlarge all defined highlighted regions by setting their new positions and new sizes.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
Dim text_to_find As String = "GdPicture"
GdViewer1.RemoveAllRegions()
Dim text_found As Boolean = GdViewer1.SearchText(text_to_find, 0, True)
If GdViewer1.GetStat() = GdPictureStatus.OK Then
Dim regCount As Integer = GdViewer1.RegionCount(), regID As Integer = 0
If text_found AndAlso (regCount > 0) Then
For j As Integer = 1 To regCount
regID = GdViewer1.GetRegionID(j)
GdViewer1.SetRegionLeftPixels(regID, GdViewer1.GetRegionLeftPixels(regID) - 10)
GdViewer1.SetRegionTopPixels(regID, GdViewer1.GetRegionTopPixels(regID) - 10)
GdViewer1.SetRegionWidthPixels(regID, GdViewer1.GetRegionWidthPixels(regID) + 20)
GdViewer1.SetRegionHeightPixels(regID, GdViewer1.GetRegionHeightPixels(regID) + 20)
Next
GdViewer1.Redraw()
Else
MessageBox.Show("The given text has not been found.", "GdViewer.SetRegionTopPixels")
End If
Else
MessageBox.Show("The search process has failed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionTopPixels")
End If
Else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionTopPixels")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
string text_to_find = "GdPicture";
GdViewer1.RemoveAllRegions();
bool text_found = GdViewer1.SearchText(text_to_find, 0, true);
if (GdViewer1.GetStat() == GdPictureStatus.OK)
{
int regCount = GdViewer1.RegionCount(), regID = 0;
if (text_found && (regCount > 0))
{
for (int j = 1; j <= regCount; j++)
{
regID = GdViewer1.GetRegionID(j);
GdViewer1.SetRegionLeftPixels(regID, GdViewer1.GetRegionLeftPixels(regID) - 10);
GdViewer1.SetRegionTopPixels(regID, GdViewer1.GetRegionTopPixels(regID) - 10);
GdViewer1.SetRegionWidthPixels(regID, GdViewer1.GetRegionWidthPixels(regID) + 20);
GdViewer1.SetRegionHeightPixels(regID, GdViewer1.GetRegionHeightPixels(regID) + 20);
}
GdViewer1.Redraw();
}
else
MessageBox.Show("The given text has not been found.", "GdViewer.SetRegionTopPixels");
}
else
MessageBox.Show("The search process has failed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionTopPixels");
}
else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionTopPixels");
See Also
Reference
GdViewer Class
GdViewer Members
AddRegion(String,Int32,Int32,Int32,Int32,ForegroundMixMode,Int32) Method
AddRegionInches(String,Single,Single,Single,Single,ForegroundMixMode,Int32) Method
GetRegionTopPixels Method
GetRegionID Method
AddRegion(String,Int32,Int32,Int32,Int32,ForegroundMixMode,Int32) Method
AddRegionInches(String,Single,Single,Single,Single,ForegroundMixMode,Int32) Method
GetRegionTopPixels Method
RegionCount Method
GetRegionID Method
SearchText(String,Int32,Boolean) Method
AddRegion(String,Int32,Int32,Int32,Int32,ForegroundMixMode,Int32) Method
AddRegionInches(String,Single,Single,Single,Single,ForegroundMixMode,Int32) Method
RemoveAllRegions Method
GetRegionTop Method
SetRegionTop Method